local p =
local format = mw.ustring.formatlocal roadDataModule = require("Module:Road data/sandbox")
local function routeText(route) local shieldText = roadDataModule.shield(route, nil, nil, nil, true) local linkText = roadDataModule.link(route) local result = mw.html.create("span"):css result:wikitext(shieldText .. ' ' .. linkText) return tostring(result)end
local function previousRoute(route) local cell = mw.html.create('td'):css if not route.type or route.type
local function nextRoute(route) local cell = mw.html.create('td'):css if not route.type or route.type
function p._browse(route) local country = route.country local state = route.state or route.province local county = route.county local previousData = local nextData = local previousRoute = previousRoute(previousData) local nextRoute = nextRoute(nextData) if previousData.typeerror or nextData.typeerror then route.typeerror = true end local centerRoute = mw.html.create('td'):css local route = route.browse_route if route then centerRoute:css("padding-left", "6px") centerRoute:css("padding-right", "6px") centerRoute:wikitext(format("%s", route)) end local browseRow = mw.html.create('tr') browseRow:node(previousRoute):node(centerRoute):node(nextRoute) return tostring(browseRow)end
function p.browse(frame) -- Import module function to work with passed arguments local getArgs = require('Module:Arguments').getArgs local args = getArgs(frame) args.browse_route = args.route return p._browse(args)end
return p