local p = local getArgs = require('Module:Arguments').getArgslocal util = require("Module:Road data/util")local yesno = require('Module:Yesno')local routeModule = require("Module:Infobox road/route")local parserModule = require("Module:Road data/parser")local parser = parserModule.parserlocal format = mw.ustring.formatlocal frame = mw.getCurrentFrame
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 function the(args) if country(args)
"BHS" or country(args)
"COG" or country(args)
"COM" or country(args)
"DOM" or country(args)
"GMB" or country(args)
"MDV" or country(args)
"NLD" or country(args)
"SLB" or country(args)
"GBR" or country(args)
local function africa(args) return "*Trans-African Highway network"end
local function asia(args) return "*Asian Highway Network"end
local function europe(args) if args.type
local function browselinks(args) local ISO = require('Module:ISO 3166') local name = ISO.name if country(args)
'YUG' or country(args)
'ASIA' then return asia(args) elseif country(args)
'TAH' then return africa(args) elseif country(args)
'AUS' then local state = args.state or local stateName = ISO.name local links = "*Highways in Australia\n\n*National Highway\n*Freeways in Australia" if state
'NSW' then return links .. "\n\nHighways in New South Wales" elseif state ~= then return string.format("%s \n\nHighways in %s", links, stateName, stateName) else return links end elseif country(args)
'BEL' then return "*Highways of Belgium\n\n*Motorways\n*National Roads" elseif country(args)
'BRA' then local state = args.state or local stateName = ISO.name local links = "*Highways in Brazil\n\n*Federal" if state
'SP' or state
'BRN' then return "*Brunei National Roads System" elseif country(args)
'TCH' and province
'TCH' and province ~= then TCH = "*Trans-Canada Highway" else TCH = end local provinces if province
'AB' then provinces = "Alberta Provincial Highway Network\n\n*List\n*Former" elseif province
'YT' or province
'NU' then provinces = "Highways in Nunavut" elseif province
'NL' then provinces = "Highways in Newfoundland and Labrador" elseif province
'ON' then if args.type
'Hwy' or args.type
'ON 1960' or args.type
'Sec' or args.type
'CR' or args.type
'MR' or args.type
'Parkway' then provinces = "Parkways of the Great Lakes" elseif args.type
'Toronto' then provinces = "Toronto municipal expressways" elseif args.type
'YT' or province
'MB' then second = "Winnipeg City Routes" elseif province
'NS' then second = "100-series" elseif province
'ON' then if args.type
'Hwy' or args.type
'ON 1960' or args.type
'Sec' or args.type
'Parkway' then second = "Long Sault\n*Niagara\n*St. Clair\n*1000 Islands\n\n*Roads in Ontario" else second = end else second = end return string.format("%s\n\n*%s\n\n*%s", TCH, provinces, second)
elseif country(args)
'CHN' then local province = args.province or local stateName = ISO.name local links if args.type
"Expwy" then links = "*National Trunk Highway System\n\n*Primary\n*Auxiliary\n\n*National Highways\n*Transport in China" elseif args.type
'BJ' or province
'JS' or province
'HA' or province
'CRI' then return "*National Road Network of Costa Rica" elseif country(args)
'DEU' then if args.type
'ESP' then local province = args.province or local stateName = ISO.name local links if args.type
'B' or province
'L' or province
'GC' or province
'ML' then community = "Transport in Melilla" elseif province
'MD' then community = "Transport in the Community of Madrid" else community = end else community = end return string.format("%s\n\n*%s", links, community) elseif country(args)
"E" then return europe(args) else return "*Highways in Finland" end elseif country(args)
"E" then return europe(args) else return "*Roads in France\n\n*Autoroutes\n*Routes nationales" end elseif country(args)
'ENG' or country(args)
'WLS' then if args.type
'GEO' then return "*Roads in Georgia\n\n*International Routes\n*National Routes" elseif country(args)
'GIB' then return "*Streets in Gibraltar" elseif country(args)
'HKG' then return "*Transport in Hong Kong\n\n*Routes\n*Roads and Streets" elseif country(args)
'IND' then local state = args.state or local stateName = ISO.name local links = "*Roads in India\n\n*Expressways\n*National\n*State\n*Asian" if state ~= then return string.format("%s \n\nState Highways in %s", links, stateName, stateName) else return links end elseif country(args)
'IRN' then return "*Highways in Iran\n\n*Freeways" elseif country(args)
'ITA' then return "*Roads in Italy\n\n*Autostrade\n*State\n*Regional\n*Provincial\n*Municipal" elseif country(args)
'KOR' then return "*Highway systems of South Korea\n\n*Expressways\n*National\n*Local" elseif country(args)
'LKA' then return "*Roads in Sri Lanka\n\n*Expressways\n*A-Grade\n*B-Grade" elseif country(args)
'LVA' then return "*National Roads in Latvia" elseif country(args)
'SON' then return string.format("%s \n\nState Highways in %s", links, stateName, stateName) elseif state
'MWI' then return "*Transport in Malawi\n\n*Roads" elseif country(args)
'NIR' then return "*Roads in Northern Ireland\n\n*Motorways\n*A roads in Northern Ireland" elseif country(args)
"E" then return europe(args) else return "*Roads in the Netherlands\n\n*Motorways\n*E-roads\n*Provincial\n*City routes" end elseif country(args)
"E" then return europe(args) else return "*Roads in Norway\n\n*National Roads\n*County Roads" end elseif country(args)
'PHL' then if args.type
'POL' then return "*National roads in Poland\n\n*Voivodeship roads" elseif country(args)
'RUS' then return "*Russian Federal Highways" elseif country(args)
'SRB' then return "*Roads in Serbia\n\n*Motorways" elseif country(args)
"E" then return europe(args) else return "*Roads in Sweden\n\n*National Roads\n*County Roads" end elseif country(args)
'TUR' then return "*Highways in Turkey\n\n*Motorways\n**List\n*State Highways\n**List" elseif country(args)
'UKR' then return "*Roads in Ukraine\n\n*State Highways" elseif country(args)
'USA' then local state = args.state or local stateName = ISO.name local national if args.type
'ADHS' then national = "*Appalachian Development Highway System" elseif args.type
'FH' or args.type
'FH-named' then national = "*Forest Highway System" elseif args.type
'NER' then national = "*New England road marking system" elseif args.type
'NSB' or args.type
'FSB' or args.type
'Npkwy' or args.type
'NTP' or args.type
'BCB' or args.type
'Post' or args.type
'Trail' or args.type
'Arrowhead Trail' or args.type
'Jackson' or args.type
'Jefferson Davis' or args.type
'Lincoln' or args.type
'Roosevelt' or args.type
'National Old Trails Road' then national = "*Auto trails" elseif args.type
'USBR' then national = "*United States Bicycle Route System\n\n*List" elseif string.match(args.type, "^US")
'I' or args.type
'I-named' or args.type
'BL' or string.match(args.type, "^BL")
'Fut' or string.match(args.type, "^IS")
'I 1' or (state
'Turnpike') then national = "*Interstate Highway System\n\n*Main\n*Auxiliary\n*Suffixed\n*Business\n*Future" else national = end local function routes(args) local routes if state
'AZ' or state
'IL' or state
'NV' or state
'NY' or state
'PA' or state
'WA' or state
'FL' or state
'NM' then routes = "state roads" elseif state
'VA' then routes = "primary state highways" elseif state
'WI' then routes = "state trunk highways" else routes = "state highways" end return routes end local function whoCallsThemRoutes(args) local routes if state
'MS' or state
'NV' or state
'NJ' or state
'NY' or state
'PA' or state
then states = elseif state
'ID' or state
'WY' then states = shs(args) elseif state
'AS' then states = "*Highways in American Samoa" elseif state
'AR' then states = string.format("*Arkansas Highway System\n\n*%s\n*Business\n*Spurs\n*Suffixed\n*Scenic\n*Heritage", three(args)) elseif state
'CR' then states = "*County routes in California" else states = string.format("*State highways in California\n\n*%s\n*Scenic\n*History\n*Pre‑1964\n*Unconstructed\n*Deleted\n*Freeways", three(args)) end elseif state
'CT' then states = string.format("%s\n**SSR\n**SR\n*Scenic", shs(args)) elseif state
'DC' then states = "*Streets and Highways of Washington, DC\n\n*Interstate\n*US\n*DC\n*State-Named Streets" elseif state
'CR' and county ~= then states = string.format("*County roads in Florida\n\n*County roads in %s County", county, county) elseif args.type
then states = "*County roads in Florida" else states = string.format("%s\n**Former\n**Pre‑1945\n*Toll\n*Scenic", shsLinked(args)) end elseif state
'GU' then states = "*Guam Highways" elseif state
'IL' then local county = args.county or if args.type
'CR' and county
'IN' then local county = args.county or if args.type
'CR' and county
'IA' then states = string.format("*Iowa Primary Highway System\n\n*%s\n*Secondary\n*Scenic", three(args)) elseif state
'KY' then states = string.format("%s\n*Parkways", shs(args)) elseif state
'PR' or args.type
'ME' then states = string.format("%s\n*Auto trails\n*Lettered highways", shsLinked(args)) elseif state
'CR' and county ~= then states = string.format("* County Roads in %s County", county) elseif args.type
then states = "*County roads in Maryland" else states = string.format("*Maryland highway system\n\n*%s\n*Scenic Byways", three(args)) end elseif state
'MS' then states = string.format("%s", shsLinked(args)) elseif state
'CR' and county ~= or args.type
'CR' and county
'NFSB' and county
'CDH' then states = "*County-Designated Highways" else states = string.format("*Michigan State Trunkline Highway System\n\n*%s\n*Byways", three(args)) end elseif state
'CR' or args.type
'MO' then states = string.format("%s\n*Supplemental", shsLinked(args)) elseif state
'NE' then states = string.format("%s\n*Link\n*Spur\n**State Spurs\n*Recreation", shsLinked(args)) elseif state
'NH' then states = string.format("*New Hampshire Highway System\n\n*%s\n*Turnpikes", three(args)) elseif state
'CR' then if county ~= then states = string.format("*County Routes in %s County\n\n*System\n*500-series routes", county, county) else states = "*County routes in New Jersey\n\n*500-series routes" end else states = string.format("*New Jersey State Highway Routes\n\n*%s\n*Scenic Byways", three(args)) end elseif state
'NY' then local county = args.county or if args.type
'NC' then states = string.format("*North Carolina Highway System\n\n*%s\n*Scenic", three(args)) elseif state
'OH' then if args.type
'OR' then states = string.format("*Oregon Highways\n\n*%s\n*Named\n*Scenic", three(args)) elseif state
'PA' then states = string.format("*Pennsylvania State Route System\n\n*%s\n*Scenic\n*Legislative", three(args)) elseif state
'RI' then states = "*Rhode Island Routes" elseif state
'SD' then states = string.format("*South Dakota State Trunk Highway System\n\n*%s", three(args)) elseif state
'TX' then states = string.format("*Highways in Texas\n\n*%s\n*Toll\n*Loops\n*Spurs\n*FM/RM\n*Park\n*Rec", three(args)) elseif state
'VI' then states = "*USVI Highways" elseif state
'VA' then states = "*Virginia Routes\n\n*Interstate\n*US\n*Primary\n*Secondary\n*Byways\n*History\n*HOT lanes" elseif state
'WV' then local county = args.county or if args.type
'WI' then if args.type
'CTH' then states = "*County Trunk Highways" else states = string.format("*Wisconsin State Trunk Highway System\n\n*%s\n*Scenic\n*Rustic", three(args)) end end return string.format("%s\n\n%s", national, states) elseif country(args)
elseif country(args)
'BRB' or country(args)
'CHL' or country(args)
elseif country(args)
'IMN' or country(args)
'MDG' or country(args)
'UGA' then return string.format("*Roads in %s %s", the(args), name, the(args), name) elseif country(args)
'MNE' or country(args)
'TUN' then return string.format("*Transport in %s %s\n\n*Motorways", the(args), name, the(args), name) elseif country(args)
'BLR' or country(args)
'CPV' or country(args)
'HND' or country(args)
'KWT' or country(args)
'PAK' or country(args)
'ALB' or country(args)
'COL' or country(args)
'DOM' or country(args)
'GUF' or country(args)
'PER' or country(args)
'SVN' or country(args)
function p.browselinks(frame) local args = getArgs(frame) if args.nobrowse ~= nil then return nil else return browselinks(args) end end
return p