local p = local getArgs = require('Module:Arguments').getArgslocal roadDataModule = require("Module:Road data")local util = require("Module:Road data/util")local parserModule = require("Module:Road data/parser")local parser = parserModule.parserlocal format = mw.ustring.formatlocal frame = mw.getCurrentFramelocal templatestyles = 'Infobox road/styles.css'
local function country(args) local state = args.state or args.province local country local countryModule = mw.loadData("Module:Road data/countrymask") local country = args.country or countryModule[state] return countryend
local size = "40px"
local function banner(args) if args.marker_image then return nil end if args.shielderr then return nil end local shield = parser(args, 'banner') if not shield or shield
local function shield(args) if args.marker_image then return args.marker_image end
local shield = parser(args, 'shieldmain') or parser(args, 'shield') if not shield or shield
local width = title.file.width local height = title.file.height if (orientation and orientation
'table' then local res = local sizes = for i,v in ipairs(shield) do sizes[i] = v res[i] = string.format('', v, shield_size(v), alt) end return table.concat(res, ' ') else return string.format('', shield, shield_size(shield, orientation), alt) endend
-- Links/abbreviationslocal function name(args) local name = args.name or parser(args, 'name') or parser(args, 'abbr') return nameend
function p._routeInfo(args) local banner = banner(args) local shield = shield(args) local name = name(args)
if not args.type and not args.route and not args.name and not args.marker_image then local container = nil else local container = mw.html.create('div'):cssText('text-align:center;') if shield
'none' or args.name and not args.marker_image and not args.type and not args.route then container:tag('p'):cssText('margin:0.1em;'):wikitext(name) elseif args.marker_image ~= and args.name
nil and not args.type and not args.route then container:tag('p'):cssText('margin:0.1em;'):wikitext(shield) elseif args.country
function p.infobox(args) local lengthModule = require "Module:Infobox road/length" local IBR = require "Module:Infobox road/sandbox" local headerStyle = IBR.headerStyle(args)
local infobox = infobox['above'] = p._routeInfo(args) infobox['subheader'] = args.alternate_name infobox['subheader2'] = "
" infobox['label1'] = "Location" infobox['data1'] = args.location infobox['label2'] = "Length" infobox['data2'] = lengthModule._length(num, args) infobox['label3'] = "Existed" infobox['data3'] = IBR._existed(args) infobox['label4'] = "History" infobox['data4'] = args.history if country(args)
return frame:extensionTag .. frame:expandTemplate end
function p.infobox(frame) local args = getArgs(frame) return p.infobox(args)end
return p