Content deleted Content added
fix |
use sandbox subtemplate |
||
(19 intermediate revisions by 3 users not shown) | |||
Line 1:
local p = {}
local getArgs = require('Module:Arguments').getArgs
local util = require("Module:Road data/util")
local yesno = require('Module:Yesno')
local langModule = require('Module:Lang')
local routeModule = require("Module:Infobox road/route/sandbox")
local parserModule = require("Module:Road data/parser")
local parser = parserModule.parser
Line 23 ⟶ 21:
-- HEADER COLORS
function p.
local args = getArgs(frame)
local header
Line 36 ⟶ 34:
local minor = header == "minor"
local hist = header == "hist" or header == "historic" or header == "historical" or header == "scenic"
local color = parser(args, 'color') or args['header_color']
local freeway = header == "freeway"
Line 45 ⟶ 43:
elseif minor then
return "header-minor"
elseif deleted and header == 'hist' or deleted and color == 'hist' then
return "header-deleted-hist"
elseif deleted then
return "header-deleted"
Line 57:
return "header-default"
end
end
Line 91 ⟶ 86:
local translation = args.translation or parser(args, 'translation') or ''
if
local route = args.route
if route ~= nil then
local arabicModule = require( "Module:Convert to eastern arabic numerals" )
local arabic = arabicModule._convert({route})
local translated = string.gsub( translation, route, arabic)
return frame:expandTemplate{title = 'Nastaliq', args = {translated}}
else
return frame:expandTemplate{title = 'Nastaliq', args = {translation}}
end
elseif translation ~= '' and lang == 'none' then
return translation
elseif country(args) == "CHN" and args.type == "Expwy" then
local trans = require( "Module:Road data/masks/CHN/Expwy translations" )
local route = args.route
return langModule._lang({lang, trans[route]})
elseif country(args) == "HUN" then
local nominal = require( "Module:Road data/masks/HUN" )
Line 141 ⟶ 153:
local function maint(args)
local maint = args.maint or parser(args, 'maint') or
if maint == "none" or
return nil
else
return "Maintained by " .. maint
end
end
Line 157 ⟶ 169:
local function law(args)
local law = parser(args, 'law') or
if
return nil
else
return "Defined by " .. law
end
end
Line 173 ⟶ 185:
function p._existed(args)
local formed = args.established or args.formed or
local deleted = args.decommissioned or args.deleted or
if formed ==
return nil
elseif deleted ==
return formed .. "–present"
else
Line 196 ⟶ 208:
local infobox_args = {}
infobox_args['bodystyle'] = '
infobox_args['child'] = 'yes'
infobox_args['decat'] = 'yes'
infobox_args['label1'] = "Time period"
infobox_args['data1'] = args.time_period
Line 254 ⟶ 267:
local function spurOf(args)
local state = args.state or args.province
local country = args.country
Line 261 ⟶ 273:
local parentRoute = args.spur_of
local aux = parser(args, 'aux') or "Auxiliary route" or nil
local jct = frame:expandTemplate{
title = 'jct', args = {
state = state,
country = country,
county1 = county,
parentType,
parentRoute,
noshield1 = "yes"
}
}
if not parentType and not parentRoute then
Line 284 ⟶ 305:
local infobox_args = {}
infobox_args['bodystyle'] = '
infobox_args['child'] = 'yes'
infobox_args['decat'] = 'yes'
if args["e-road"] then
Line 297 ⟶ 319:
if args.tahn then
local tshield = args["tahn-shield"] or ''
infobox_args['
end
if args.mrn then
local mshield = args["mrn-shield"] or ''
infobox_args['
end
Line 313 ⟶ 335:
local args = getArgs(frame)
return partOf(args)
end
--BROWSE LINKS
local function browse(args)
if args.nobrowse then return nil end
local previousRoute = args.previous_route
local nextRoute = args.next_route
if previousRoute or nextRoute then
local boxModule = require "Module:Road data/browse/sandbox"
local primary = boxModule._browse(args)
local tblModule = require "Module:Road data/browsetable"
return tblModule._browsetable(primary)
end
end
function p.browse(frame)
local args = getArgs(frame)
return browse(args)
end
local function extended(args)
local extended = args.browse
if args.nobrowse or extended == nil then
return nil
else
local tblModule = require "Module:Road data/browsetable"
-- Negative margin to counteract infobox border-spacing
return tblModule._browsetable(extended, 'margin-top:-3px')
end
end
function p.extended(frame)
local args = getArgs(frame)
return extended(args)
end
Line 359 ⟶ 417:
local period = period_params(args)
local existed = args.established or args.formed or nil
local spur =
local part = partOf(args)
Line 378 ⟶ 436:
local function highwaySystem(args)
if args.nobrowse then return nil end
local country = country(args) or args.countries
if country == nil then
Line 394 ⟶ 452:
local args = getArgs(frame)
return highwaySystem(args)
end
|