模組:Infobox road/browselinks
外观
local p = {}
local getArgs = require('Module:Arguments').getArgs
local 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.parser
local format = mw.ustring.format
local 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 country
end
local function the(args)
if country(args) == "ALA" or country(args) == "BHS" or country(args) == "CAF" or country(args) == "COG" or country(args) == "COD" or country(args) == "COM" or country(args) == "CZE" or country(args) == "DOM" or country(args) == "FSM" or country(args) == "GMB" or country(args) == "IMN" or country(args) == "MDV" or country(args) == "MHL" or country(args) == "NLD" or country(args) == "PHL" or country(args) == "SLB" or country(args) == "ARE" or country(args) == "GBR" or country(args) == "USA" then
return ''
else
return ''
end
end
local function linken(a, b, c)
if c == '' or c == nil then
return frame:expandTemplate ({title='link-en', args = { a, b}})
else
return frame:expandTemplate ({title='link-en', args = { a, b, c}})
end
end
local function africa(args)
return "*'''[[非洲橫貫公路網|非洲橫貫公路]]'''"
end
local function asia(args)
return "*'''[[亞洲公路網|亞洲公路]]'''"
end
local function europe(args)
if args.type == "Pan" then
return "*'''" .. linken('泛歐走廊','Pan-European corridors') .. "'''"
else
return "*'''[[欧洲高速公路]]'''"
end
end
local function browselinks(args)
local ISO = require('Module:ISO 3166')
local name = ISO.name({country(args)})
if country(args) == '' or country(args) == 'YUG' or country(args) == nil then
return nil
elseif country(args) == 'ASIA' then
return asia(args)
elseif country(args) == 'EUR' then
return europe(args)
elseif country(args) == 'TAH' then
return africa(args)
elseif country(args) == 'ARE' then
return string.format("*'''[[%s%s交通]]'''\n\n*" .. linken('杜拜道路列表','List of roads in Dubai','杜拜道路'), the(args), name)
elseif country(args) == 'AUS' then
local state = args.state or ''
local stateName = ISO.name({"AUS-" .. state})
local links = "*'''" .. linken('澳洲公路','Highways in Australia') .. "'''\n\n*" .. linken('澳洲國道','National Highway (Australia)','國道') .. "\n*" .. linken('澳洲高速公路','Freeways in Australia')
if state == 'ACT' then
return links .. "\n\n'''" .. linken('坎培拉道路基礎設施','Road infrastructure in Canberra') .. "'''"
elseif state == 'NSW' then
return links .. "\n\n'''" .. linken('新南威爾斯州公路','Highways in New South Wales') .. "'''"
elseif state ~= '' then
return string.format("%s \n\n'''[[%s公路列表|%s公路]]'''", links, stateName, stateName)
else
return links
end
elseif country(args) == 'AUT' then
return "*'''奧地利公路'''\n\n*" .. linken('奧地利高速公路','Autobahns of Austria','高速公路') .. "\n*" .. linken('奧地利高速公路#快速公路','Autobahns of Austria#Schnellstraßen','快速公路') .. "\n*" .. linken('州道 (德語)','Landesstraße','州道')
elseif country(args) == 'BEL' then
return "*'''比利時公路'''\n\n*" .. linken('比利時高速公路列表','List of motorways in Belgium','高速公路') .. "\n*" .. linken('比利時國道列表','List of national roads in Belgium','國道')
elseif country(args) == 'BOL' then
return "*'''玻利維亞公路'''\n\n" .. linken('玻利維亞國道列表','List of National Roads in Bolivia','國道')
elseif country(args) == 'BRA' then
local state = args.state or ''
local stateName = ISO.name({"BRA-" .. state})
local links = "*'''" .. linken('巴西公路列表','List of highways in Brazil','巴西公路') .. "'''\n\n*" .. linken('巴西聯邦公路列表','List of federal highways in Brazil','聯邦公路')
if state == 'RS' then
return string.format("%s \n\n*" .. linken('南大河州州道列表','List of state highways in Rio Grande do Sul','南大河州州道'), links)
elseif state == 'SP' then
return string.format("%s \n\n*" .. linken('聖保羅州州道列表','List of state highways in São Paulo','聖保羅州州道'), links)
elseif state == 'MG' then
return string.format("%s \n\n*" .. linken('米納斯吉拉斯州州道列表','List of state highways in Minas Gerais','米納斯吉拉斯州州道'), links)
else
return links
end
elseif country(args) == 'BRN' then
return "*'''" .. linken('汶萊國家道路系統|Brunei National Roads System') .. "'''"
elseif country(args) == 'CAN' then
local province = args.province or ''
local stateName = ISO.name({"CAN-" .. province})
local TCH
if args.type == 'TCH' and province == '' then
TCH = "*'''[[加拿大橫貫公路]]'''\n\n*" .. linken('國家公路系統 (加拿大)','National Highway System (Canada)','國家公路系統')
elseif args.type == 'TCH' and province ~= '' then
TCH = "*'''[[加拿大橫貫公路]]'''"
else
TCH = ''
end
local provinces
if province == '' then
provinces = ''
elseif province == 'NT' then
provinces = "'''" .. linken('西北地區區道列表','List of Northwest Territories highways','西北地區區道') .. "'''"
elseif province == 'YT' or province == 'YK' then
provinces = "'''" .. linken('育空地區區道列表','List of Yukon territorial highways','育空地區區道') .. "'''"
elseif province == 'NU' then
provinces = "'''" .. linken('努納武特地區公路','Highways in Nunavut') .. "'''"
elseif province == 'BC' then
provinces = "'''" .. linken('卑詩省省道列表','List of British Columbia provincial highways','卑詩省省道') .. "'''"
elseif province == 'NL' then
provinces = "'''" .. linken('紐芬蘭與拉布拉多省公路列表','List of Newfoundland and Labrador highways','紐芬蘭與拉布拉多省公路') .. "'''"
elseif province == 'QC' then
provinces = "'''" .. linken('魁北克省公路','Highways in Quebec','魁北克省省道') .. "'''"
elseif province == 'ON' then
if args.type == 'Fwy' or args.type == 'Hwy' or args.type == 'ON' or args.type == 'ON 1960' or args.type == 'Secondary' or args.type == 'Sec' or args.type == 'TCH' then
provinces = "'''" .. linken('安大略省省道網','Ontario Provincial Highway Network','安大略省省道') .. "'''"
elseif args.type == 'CR' or args.type == 'DR' or args.type == 'MR' or args.type == 'RR' then
provinces = "'''" .. linken('安大略省縣道列表','List of county roads in Ontario','安大略省縣道') .. "'''"
elseif args.type == 'Parkway' then
provinces = "'''五大湖林蔭公路'''"
elseif args.type == 'Toronto' then
provinces = "'''多倫多道路'''"
else
provinces = "'''" .. linken('安大略省道路','Roads in Ontario') .. "'''"
end
else
provinces = string.format("'''[[%s省道列表|%s省道]]'''", stateName, stateName)
end
local second
if province == 'YT' or province == 'YK' then
second = linken('育空地區道路列表','List of Yukon roads','其他')
elseif province == 'MB' then
second = linken('溫尼辟市道列表','List of Winnipeg City Routes','溫尼辟市道')
elseif province == 'NB' then
second = linken('紐賓士域省舊省道列表','List of former New Brunswick provincial highways','舊省道')
elseif province == 'NS' then
second = linken('100系列公路 (諾華斯高沙省)','100-series highways (Nova Scotia)','100系列公路')
elseif province == 'QC' then
second = linken('魁北克省高速公路','Autoroutes of Quebec','高速公路') .. "\n*" .. linken('魁北克省省道列表','List of Quebec provincial highways','省道列表') .. "\n*" .. linken('魁北克省舊省道列表','List of former Quebec provincial highways','舊省道')
elseif province == 'ON' then
if args.type == 'Fwy' or args.type == 'Hwy' or args.type == 'ON' or args.type == 'ON 1960' or args.type == 'Secondary' or args.type == 'Sec' or args.type == 'TCH' then
second = linken('安大略省省道列表','List of Ontario provincial highways','現存') .. "\n*" .. linken('安大略省舊省道列表','List of former Ontario provincial highways','舊省道') .. "\n*[[400系列公路]]"
elseif args.type == 'Parkway' then
second = linken('長湍林蔭公路','Long Sault Parkway','長湍') .. "\n*" .. linken('尼亞加拉林蔭公路','Niagara Parkway','尼亞加拉') .. "\n*" .. linken('圣克莱尔林荫公路','St. Clair Parkway','圣克莱尔') .. "\n*" .. linken('千島林蔭公路','Thousand Islands Parkway','千島') .. "\n\n*'''" .. linken('安大略省道路列表','Roads in Ontario') .. "'''"
elseif args.type == 'Toronto' then
second = linken('多倫多南北向道路列表','List of north–south roads in Toronto','南北向') .. "\n*" .. linken('多倫多東西向道路列表','List of east–west roads in Toronto','東西向') .. "\n*" .. linken('多倫多不規則方向道路列表','List of contour roads in Toronto','不規則方向')
else
second = ''
end
else
second = ''
end
return string.format("%s\n\n*%s\n\n*%s", TCH, provinces, second)
elseif country(args) == 'CHE' then
return "*'''[[瑞士交通]]'''\n\n*[[瑞士高速公路|高速公路]]"
elseif country(args) == 'CHN' or country(args) == 'PRC' then
local province = args.province or ''
local stateName = ISO.name({"CHN-" .. province})
local links
if args.type == "Ex" or args.type == "Expwy" then
links = "*'''[[中华人民共和国国家高速公路网]]'''\n\n*[[中华人民共和国国家高速公路路线编号|路線編號]]\n\n*[[中华人民共和国国道|國道]]\n*[[中华人民共和国交通]]\n\n*[[中华人民共和国公路分类|公路分類]]"
elseif args.type == "G" then
links = "*'''[[中华人民共和国国家高速公路网]]'''\n\n*[[中华人民共和国国家高速公路路线编号|路線編號]]"
else
links = "*'''[[中华人民共和国交通]]'''\n\n*[[中华人民共和国公路分类|公路分類]]"
end
if province ~= nil or '' then
return string.format("%s \n\n*'''[[%s高速公路]]'''", links, stateName)
else
return links
end
elseif country(args) == 'CRI' then
return "*'''{{link-en|哥斯達黎加國道|National Road Network of Costa Rica}}'''"
elseif country(args) == 'CYP' then
return "*'''{{link-en|塞浦路斯道路與高速公路|Roads and motorways in Cyprus}}'''"
elseif country(args) == 'DEU' then
if args.type == "E" then
return europe(args)
else
return "*'''德國道路'''\n\n*[[德國高速公路|高速公路]]\n**{{link-en|德國高速公路列表|List of autobahns in Germany|列表}}\n*{{link-en|國道 (德語)|Bundesstraße|國道}}\n**{{link-en|德國國道列表|List of federal highways in Germany|列表}}\n\n*{{link-en|州道 (德語)|Landesstraße|州道}}\n*{{link-en|德國歐洲高速公路列表|List of E-roads in Germany|歐洲高速公路}}"
end
elseif country(args) == 'ESP' then
local province = args.province or ''
local stateName = ISO.name({"ESP-" .. province})
local links
if args.type == "E" then
links = europe(args)
else
links = "*'''{{link-en|西班牙高速公路|Highways in Spain}}'''\n\n*'''{{link-en|西班牙國道列表|List of national roads in Spain|西班牙國道}}'''"
end
local community
if province ~= '' then
if province == 'B' or province == 'GI' or province == 'L' or province == 'T' then
community = "'''{{link-en|加泰羅尼亞主要公路列表|List of primary highways in Catalonia|加泰羅尼亞主要公路}}'''"
elseif province == 'GC' or province == 'TF' then
community = "'''{{link-en|加那利亞群島交通|Transport in the Canary Islands}}'''"
elseif province == 'ML' then
community = "'''{{link-en|梅利利亞交通|Transport in Melilla}}'''"
elseif province == 'M' or province == 'MD' then
community = "'''{{link-en|馬德里交通|Transport in Madrid}}'''"
else
community = ''
end
else
community = ''
end
return string.format("%s\n\n*%s", links, community)
elseif country(args) == 'FIN' then
if args.type == "E" then
return europe(args)
else
return "*'''[[芬蘭公路]]'''"
end
elseif country(args) == 'FRA' then
if args.type == "E" then
return europe(args)
else
return "*'''法國道路'''\n\n*{{link-en|法國高速公路|Autoroutes of France|高速公路}}\n*{{link-en|法國國道|Route nationale|國道}}"
end
elseif country(args) == 'GBR' or country(args) == 'ENG' or country(args) == 'SCT' or country(args) == 'WLS' then
if args.type == "Roman" then
return "*'''{{link-en|不列顛尼亞羅馬道路|Roman roads in Britannia}}'''"
else
return "*'''{{link-en|英國道路|Roads in the United Kingdom}}'''\n\n*{{link-en|英國高速公路列表|List of motorways in the United Kingdom|高速公路}}\n*{{link-en|英國道路分區列表|List of roads zones in Great Britain|A級與B級道路分區}}"
end
elseif country(args) == 'GEO' then
return "*'''{{link-en|格魯吉亞道路|List of roads in Georgia (country)}}'''"
elseif country(args) == 'GHA' then
return "*'''{{link-en|加納道路網|Ghana Road Network}}'''"
elseif country(args) == 'GIB' then
return "*'''{{link-en|直布羅陀街道|Streets in Gibraltar}}'''"
elseif country(args) == 'GRC' then
return "*'''{{link-en|希臘公路|Highways in Greece}}'''"
elseif country(args) == 'HKG' then
return "*'''[[香港交通]]'''\n\n*[[香港幹線編號系統|幹線]]\n*[[香港特色街道名稱|道路與街道]]"
elseif country(args) == 'HUN' then
return "*'''匈牙利道路'''\n\n*{{link-en|匈牙利公路|Highways in Hungary|公路}}\n*{{link-en|匈牙利道路#主要道路|Roads in Hungary#Main roads|主要道路}}\n*{{link-en|匈牙利道路#地方道路|Roads in Hungary#Local roads|地方道路}}"
elseif country(args) == 'IND' then
local state = args.state or ''
local stateName = ISO.name({"IND-" .. state})
local links = "*'''{{link-en|印度道路|Roads in India}}'''\n\n*{{link-en|印度高速公路|Expressways of India|高速公路}}\n*[[印度国道|國道]]\n*{{link-en|印度邦道|State highways in India|邦道}}\n*[[亞洲公路網|亞洲公路]]"
if state ~= '' then
return string.format("%s \n\n'''[[%s邦道列表|%s邦道]]'''", links, stateName, stateName)
else
return links
end
elseif country(args) == 'IRL' then
return "*'''{{link-en|愛爾蘭道路|Roads in Ireland}}'''\n\n*{{link-en|愛爾蘭高速公路|Motorways in the Republic of Ireland|高速公路}}\n*{{link-en|國家主要道路|National primary road|主要道路}}\n*{{link-en|國家次要道路|National secondary road|次要道路}}\n*{{link-en|地方道路 (愛爾蘭)|Regional road (Ireland)|地方道路}}"
elseif country(args) == 'IRN' then
return "*'''{{link-en|伊朗道路與公路列表|List of roads and highways in Iran|伊朗公路}}'''\n\n*{{link-en|伊朗高速公路|Freeways in Iran|高速公路}}"
elseif country(args) == 'ISR' then
return "*'''{{link-en|以色列道路|Roads in Israel}}'''\n\n*{{link-en|以色列公路列表|List of highways in Israel|公路}}"
elseif country(args) == 'ITA' then
return "*'''意大利道路'''\n\n*{{link-en|意大利高速公路|Autostrade of Italy|高速公路}}\n*{{link-en|意大利國道|State highways (Italy)|國道}}\n*{{link-en|意大利大區道|Regional road (Italy)|大區道}}\n*{{link-en|意大利省道|Provincial road (Italy)|省道}}"
elseif country(args) == 'JPN' then
return "*'''[[一般國道|日本國道]]'''\n\n*[[日本高速公路|日本高速公路]]"
elseif country(args) == 'KOR' then
return "*'''{{link-en|韓國公路系統|Highway system in South Korea}}'''\n\n*[[韓國高速公路|高速公路]]\n*{{link-en|韓國國道|National highways of South Korea|國道}}\n*{{link-en|韓國地方道|Local highways of South Korea|地方道}}"
elseif country(args) == 'KOS' then -- this is not an official ISO code
return "*'''{{link-en|科索沃道路|Roads in Kosovo}}'''"
elseif country(args) == 'LKA' then
return "*'''斯里蘭卡道路'''\n\n*{{link-en|斯里蘭卡高速公路|Expressways of Sri Lanka|高速公路}}\n*{{link-en|斯里蘭卡A級公路列表|List of A-Grade highways in Sri Lanka|A級公路}}\n*{{link-en|斯里蘭卡B級公路列表|List of B-Grade highways in Sri Lanka|B級公路}}"
elseif country(args) == 'LUX' then
return "*'''{{link-en|盧森堡高速公路列表|List of motorways in Luxembourg|盧森堡高速公路}}'''"
elseif country(args) == 'LVA' then
return "*'''{{link-en|拉脫維亞國道列表|List of national roads in Latvia|拉脫維亞國道}}'''"
elseif country(args) == 'MEX' then
local state = args.state or ''
local stateName = ISO.name({"MEX-" .. state})
local links = "*'''{{link-en|墨西哥聯邦公路|Mexican Federal Highway}}'''\n\n*{{link-en|墨西哥聯邦公路列表|List of Mexican Federal Highways|列表}}\n*{{link-en|墨西哥高速公路|List of Mexican autopistas|高速公路}}"
if state == 'SON' then
return string.format("%s \n\n'''{{link-en|索諾拉州公路列表|List of highways in Sonora|索諾拉州公路}}'''", links)
elseif state == 'DUR' then
return string.format("%s \n\n'''{{link-en|杜蘭戈州公路|Durango state highways}}'''", links)
else
return links
end
elseif country(args) == 'MWI' then
return "*'''{{link-en|馬拉維交通|Transport in Malawi}}'''\n\n*{{link-en|馬拉維道路|Roads in Malawi|道路}}"
elseif country(args) == 'MYS' then
return "*'''[[马来西亚高速公路与快速公路列表|馬來西亞公路]]'''\n\n*[[马来西亚高速公路|高速公路]]\n*[[马来西亚联邦公路系统|聯邦公路]]\n*[[马来西亚州级公路系统|州級公路]]"
elseif country(args) == 'NIR' then
return "*'''{{link-en|北愛爾蘭道路|Roads in Northern Ireland}}'''\n\n*{{link-en|英國高速公路列表#北愛爾蘭|List of motorways in the United Kingdom#Northern Ireland|高速公路}}\n*{{link-en|北愛爾蘭A級公路列表|List of A roads in Northern Ireland|北愛爾蘭A級公路}}"
elseif country(args) == 'NLD' then
if args.type == "E" then
return europe(args)
else
return "*'''{{link-en|荷蘭道路|Roads in the Netherlands}}'''\n\n*{{link-en|荷蘭高速公路列表|List of motorways in the Netherlands|高速公路}}\n*{{link-en|荷蘭歐洲高速公路列表|List of E-roads in the Netherlands|歐洲高速公路}}\n*{{link-en|荷蘭省道列表|List of provincial roads in the Netherlands|省道}}\n*{{link-en|荷蘭市道列表|List of city routes in the Netherlands|市道}}"
end
elseif country(args) == 'NOR' then
if args.type == "E" then
return europe(args)
else
return "*'''挪威道路'''\n\n*{{link-en|挪威國道|Norwegian national road|國道}}\n*{{link-en|挪威郡道|Norwegian county road|郡道}}"
end
elseif country(args) == 'NZL' then
return "*'''{{link-en|新西蘭國道|New Zealand state highway network}}'''\n\n*{{link-en|新西蘭高速公路與快速公路列表|List of motorways and expressways in New Zealand|高速公路與快速公路}}\n*{{link-en|新西蘭國道列表|List of New Zealand state highways|列表}}"
elseif country(args) == 'PHL' then
if args.type == "AH" then
return asia(args)
else
return "*'''菲律賓道路'''\n\n*{{link-en|菲律賓國道|Philippine highway network}}\n*{{link-en|菲律賓高速公路|Philippine expressway network|高速公路}}\n**{{link-en|菲律賓高速公路列表|List of expressways in the Philippines|列表}}"
end
elseif country(args) == 'POL' then
return "*'''{{link-en|波蘭國道|National roads in Poland}}'''\n\n*{{link-en|波蘭省道|Voivodeship road|省道}}"
elseif country(args) == 'ROU' then
return "*'''{{link-en|羅馬尼亞道路|Roads in Romania}}'''\n\n*{{link-en|羅馬尼亞公路|Highways in Romania|公路}}"
elseif country(args) == 'RUS' then
return "*'''{{link-en|俄羅斯聯邦公路|Russian federal highways}}'''"
elseif country(args) == 'SGP' then
return "*'''[[新加坡高速公路]]'''"
elseif country(args) == 'SRB' then
return "*'''[[塞尔维亚道路]]'''\n\n*[[塞尔维亚高速公路|高速公路]]"
elseif country(args) == 'SWE' then
if args.type == "E" then
return europe(args)
else
return "*'''瑞典道路'''\n\n*{{link-en|瑞典國道|Swedish national road|國道}}\n*{{link-en|瑞典省道|Swedish county road|省道}}"
end
elseif country(args) == 'THA' then
return "*'''{{link-en|泰國公路|Thai highway network}}'''\n\n*{{link-en|泰國高速公路|Thai motorway network|高速公路}}\n*[[亞洲公路網|亞洲公路]]"
elseif country(args) == 'TUR' then
return "*'''{{link-en|土耳其公路列表|List of highways in Turkey|土耳其公路}}'''\n\n*{{link-en|土耳其高速公路|Otoyol|高速公路}}\n**{{link-en|土耳其高速公路列表|List of otoyol routes in Turkey|列表]]\n*{{link-en|土耳其國道|Turkish State Highway System|國道}}"
elseif country(args) == 'TWN' then
return "*'''[[臺灣公路]]'''\n\n*[[中華民國國道|國道]]\n*[[臺灣省道|省道]]\n*[[中華民國縣道|縣道]]\n*[[中華民國市道|市道]]\n*[[中華民國鄉道|鄉道]]\n*[[中華民國區道|區道]]\n*[[中華民國專用公路|專用公路]]"
elseif country(args) == 'UKR' then
return "*'''{{link-en|烏克蘭道路|Roads in Ukraine}}'''\n\n*{{link-en|烏克蘭國道|State highways (Ukraine)|國道}}"
elseif country(args) == 'URY' then
return "*'''{{link-en|烏拉圭國道|National Routes of Uruguay}}'''"
elseif country(args) == 'USA' then
local state = args.state or ''
local stateName = ISO.name({"USA-" .. state})
local national
if args.type == nil then
national = ''
elseif args.type == 'ADHS' then
national = "*'''{{link-en|阿帕拉契開發公路系統|Appalachian Development Highway System}}'''"
elseif args.type == 'FFH' or args.type == 'FH' or args.type == 'FR' or args.type == 'FH-named' then
national = "*'''{{link-en|森林公路|Forest Highway}}'''"
elseif args.type == 'ISTEA' then
national = "*'''{{link-en|多樣式地面運輸效率法令|Intermodal Surface Transportation Efficiency Act|高優先級走廊}}'''"
elseif args.type == 'NER' then
national = "*'''{{link-en|新英格蘭編號公路系統|New England road marking system}}'''"
elseif args.type == 'NHS' then
national = "*'''" .. linken('國家公路系統 (美國)','National Highway System (United States)') .. "'''\n\n*[[州際公路系統|州際公路]]"
elseif args.type == 'NSB' or args.type == 'NFSB' or args.type == 'FSB' or args.type == 'Byway' or args.type == 'Npkwy' or args.type == 'GRR' or args.type == 'NTP' or args.type == 'BRP' or args.type == 'BCB' or args.type == 'Back Country' then
national = "*'''{{link-en|美國的風景道路|Scenic byways in the United States|風景道路}}'''\n\n*[[美國風景道路|國家]]\n*{{link-en|國家森林風景道路|National Forest Scenic Byway|國家森林}}\n*{{link-en|土地管理局回鄉道路列表|List of Bureau of Land Management Back Country Byway|回鄉道路}}\n*{{link-en|國家小道|National Parkway}}"
elseif args.type == 'Post' or args.type == 'Postal' then
national = "*'''{{link-en|郵政道路#美國|Post road#United States|美國郵政道路}}'''"
elseif args.type == 'Trail' or args.type == 'Albert Pike' or args.type == 'Arrowhead Trail' or args.type == 'Dixie' or args.type == 'Jackson' or args.type == 'Jefferson' or args.type == 'Jefferson Davis' or args.type == 'LCT' or args.type == 'Lincoln' or args.type == 'National' or args.type == 'Roosevelt' or args.type == 'Spanish' or args.type == 'National Old Trails Road' then
national = "*'''{{link-en|自動車徑|Auto trail}}'''"
elseif args.type == 'Tour' then
national = "*'''{{link-en|五大湖環遊線|Great Lakes Circle Tour}}'''"
elseif args.type == 'USBR' then
national = "*'''{{link-en|美國單車徑系統|United States Bicycle Route System}}'''"
elseif string.match( args.type, "^US" ) == 'US' then
national = "*'''[[美國國道]]'''\n\n*{{link-en|美國國道列表|List of United States Numbered Highways|列表}}\n*{{link-en|美國國道特別線列表|List of special routes of the United States Numbered Highway System|特別線}}\n*{{link-en|美國國道並行線列表|List of divided U.S. Routes|並行線}}"
elseif args.type == 'I' or args.type == 'Interstate' or args.type == 'I-named' or args.type == 'I' .. state or args.type == 'BL' or string.match( args.type, "^BL" ) == 'BL' or string.match( args.type, "^Fut" ) == 'Fut' or string.match( args.type, "^IS" ) == 'IS' or string.match( args.type, "^I %d" ) == 'I 1' or (state == 'OH' and args.type == 'Turnpike') then
national = "*'''[[州際公路系統]]'''\n\n*[[美國州際公路系統主線列表|主線]]\n*[[美國州際公路輔助線列表|輔助線]]\n*{{Link-en|帶後綴的美國州際公路列表|List of suffixed Interstate Highways|帶後綴路線}}\n*{{link-en|美國州際公路系統商業線列表|List of business routes of the Interstate Highway System|商業線}}\n*{{Link-en|未來的美國州際公路列表|List of future Interstate Highways|未來路線}}"
else
national = ''
end
local function three(args)
return string.format("[[%s州際公路列表|州際公路]]\n*[[%s美國國道列表|國道]]\n*[[%s州道列表|州道]]", stateName, stateName, stateName)
end
local function shs(args)
return string.format("*'''%s公路系統'''\n\n*%s", stateName, three(args))
end
local function shsLinked(args)
return string.format("*'''[[%s公路系統]]'''\n\n*%s", stateName, three(args))
end
local states
if state == '' then
states = ''
elseif state == 'AL' or state == 'ID' or state == 'ND' or state == 'WY' then
states = shs(args)
elseif state == 'AK' then
states = "*'''[[List of Alaska Routes|Alaska Routes]]'''\n\n*[[List of Interstate Highways in Alaska|Interstate]]\n*[[Alaska's Scenic Byways|Scenic Byways]]"
elseif state == 'AS' then
states = "*'''[[List of highways in American Samoa|Highways in American Samoa]]'''"
elseif state == 'AZ' then
states = string.format("%s\n*[[Unconstructed state routes in Arizona|Proposed]]\n*[[Former state routes in Arizona|Former]]", shs(args))
elseif state == 'AR' then
states = string.format("*'''[[Arkansas Highway System]]'''\n\n*%s\n*[[List of Arkansas state highway business routes|Business]]\n*[[List of Arkansas state highway spurs|Spurs]]\n*[[List of suffixed Arkansas state highways|Suffixed]]\n*[[Arkansas Scenic Byways|Scenic]]\n*[[Arkansas Heritage Trail|Heritage]]", three(args))
elseif state == 'CA' then
if args.type == 'CR' then
states = "*'''[[County routes in California]]'''"
else
states = string.format("*'''[[State highways in California]]'''\n\n*%s\n*[[State Scenic Highway System (California)|Scenic]]\n*[[History of California's state highway system|History]]\n*[[List of state highways in California (pre-1964)|Pre‑1964]]\n*[[Unconstructed state highways in California|Unconstructed]]\n*[[Deleted state highways in California|Deleted]]\n*[[California Freeway and Expressway System|Freeways]]", three(args))
end
elseif state == 'CO' then
states = string.format("%s\n*[[List of Colorado Scenic and Historic Byways|Scenic]]", shs(args))
elseif state == 'CT' then
states = string.format("%s\n**[[List of Special Service Roads in Connecticut|SSR]]\n**[[List of State Roads in Connecticut|SR]]", shs(args))
elseif state == 'DE' then
states = "*'''[[Delaware State Route System]]'''\n\n*[[List of numbered routes in Delaware|List]]\n*[[Delaware Byways|Byways]]"
elseif state == 'DC' then
states = "*'''[[Streets and highways of Washington, D.C.|Streets and Highways of Washington, DC]]'''\n\n*[[List of Interstate Highways in Washington, D.C.|Interstate]]\n*[[List of U.S. Highways in Washington, D.C.|US]]\n*[[List of numbered highways in Washington, D.C.|DC]]\n*[[List of state-named roadways in Washington, D.C.|State-Named Streets]]"
elseif state == 'FL' then
local county = args.county or ''
if args.type == 'CR' and county ~= '' then
states = string.format("*'''[[County roads in Florida]]'''\n\n*[[List of county roads in %s County, Florida|County roads in %s County]]", county, county)
elseif args.type == 'CR' and county == '' then
states = "*'''[[County roads in Florida]]'''"
else
states = string.format("%s\n**[[List of former state roads in Florida|Former]]\n**[[State roads in Florida before 1945|Pre‑1945]]\n*[[List of toll roads in Florida|Toll]]\n*[[Florida Scenic Highways|Scenic]]", shsLinked(args))
end
elseif state == 'GA' then
states = "*'''Georgia State Highway System'''\n\n*[[List of Interstate Highways in Georgia (U.S. state)|Interstate]]\n*[[List of U.S. Highways in Georgia (U.S. state)|US]]\n*[[List of state routes in Georgia (U.S. state)|State]]\n*\n*[[List of special state routes in Georgia (U.S. state)|Special]]"
elseif state == 'GU' then
states = "*'''[[List of highways in Guam|Guam Highways]]'''"
elseif state == 'HI' then
states = "*'''[[List of state highways in Hawaii|Routes in Hawaii]]'''"
elseif state == 'IL' then
local county = args.county or ''
if args.type == 'CR' and county ~= '' then
states = string.format("*'''%s County Roads'''", county)
elseif args.type == 'CR' and county == '' then
states = "*'''County roads in Illinois'''"
else
states = string.format("%s\n*[[Illinois State Toll Highway Authority|Tollways]]", shsLinked(args))
end
elseif state == 'IN' then
local county = args.county or ''
if args.type == 'CR' and county ~= '' then
states = string.format("*'''%s County Roads'''", county)
elseif args.type == 'CR' and county == '' then
states = "*'''County roads in Indiana'''"
else
states = string.format("%s\n*[[Indiana Scenic Byways|Scenic]]", shs(args))
end
elseif state == 'IA' then
states = string.format("*'''[[Iowa Primary Highway System]]'''\n\n*%s\n*[[County roads in Iowa|Secondary]]\n*[[List of Iowa Scenic Byways|Scenic]]", three(args))
elseif state == 'KS' then
states = string.format("%s\n*[[List of Kansas state highway spurs|Spurs]]", shs(args))
elseif state == 'KY' then
states = string.format("%s\n*[[List of parkways and named highways in Kentucky|Parkways]]", shs(args))
elseif state == 'LA' then
local county = args.county or args.parish or ''
if args.type == 'PR' or args.type == 'CR' then
if county ~= '' then
states = string.format("*'''%s Parish Roads'''", county)
else
states = "*'''Parish roads in Louisiana'''"
end
else
states = string.format("%s\n*[[Louisiana Scenic Byways|Scenic]]", shs(args))
end
elseif state == 'ME' then
states = string.format("%s\n*[[List of auto trails in Maine|Auto trails]]\n*[[List of lettered highways in Maine|Lettered highways]]", shsLinked(args))
elseif state == 'MD' then
local county = args.county or ''
if args.type == 'CR' and county ~= '' then
states = string.format("*''' County Roads in %s County'''", county)
elseif args.type == 'CR' and county == '' then
states = "*'''County roads in Maryland'''"
else
states = string.format("*'''[[Maryland highway system]]'''\n\n*%s\n*[[Maryland Scenic Byways|Scenic Byways]]", three(args))
end
elseif state == 'MA' or state == 'MS' then
states = string.format("%s", shsLinked(args))
elseif state == 'MI' then
local county = args.county or ''
if args.type == 'CR' and county ~= '' or args.type == 'NFSB' and county ~= '' then
states = string.format("*'''%s County Roads'''", county)
elseif args.type == 'CR' and county == '' or args.type == 'NFSB' and county == '' then
states = "*'''County roads in Michigan'''"
elseif args.type == 'CDH' then
states = "*'''[[List of county-designated highways in Michigan|County-Designated Highways]]'''"
else
states = string.format("*'''[[Michigan State Trunkline Highway System]]'''\n\n*%s\n*[[Pure Michigan Byway|Byways]]", three(args))
end
elseif state == 'MN' then
local county = args.county or ''
if args.type == 'CR' or args.type == 'CSAH' then
if county ~= '' then
states = string.format("*'''[[County roads in Minnesota|County roads of Minnesota]]'''\n\n*[[List of county roads in %s County, Minnesota|%s County]]", county, county)
else
states = "*'''[[County roads in Minnesota|County roads of Minnesota]]'''"
end
else
states = string.format("*'''Minnesota Trunk Highway System'''\n\n*%s\n*[[Legislative route (Minnesota)|Legislative route]]s", three(args))
end
elseif state == 'MO' then
states = string.format("%s\n*[[Missouri supplemental route|Supplemental]]", shsLinked(args))
elseif state == 'MT' then
states = string.format("*'''[[Montana Highway System]]'''\n\n*%s\n*[[List of secondary highways in Montana|Secondary]]", three(args))
elseif state == 'NE' then
states = string.format("%s\n*[[List of Nebraska Connecting Link, Spur, and Recreation Highways|Link]]\n*[[List of Nebraska Connecting Link, Spur, and Recreation Highways|Spur]]\n**[[List of state spur highways in Nebraska|State Spurs]]\n*[[List of Nebraska Connecting Link, Spur, and Recreation Highways|Recreation]]", shsLinked(args))
elseif state == 'NV' then
states = string.format("%s\n*\n*[[List of state routes in Nevada prior to 1976|Pre‑1976]]\n*[[List of Nevada Scenic Byways|Scenic]]", shs(args))
elseif state == 'NH' then
states = string.format("*'''[[New Hampshire Highway System]]'''\n\n*%s\n*[[List of turnpikes in New Hampshire|Turnpikes]]", three(args))
elseif state == 'NJ' then
local county = args.county or ''
if args.type == 'CR' then
if county ~= '' then
states = string.format("*'''{{link-en|新澤西州縣道|County routes in New Jersey}}'''\n\n*[[新澤西州%s縣道列表|%s縣道]]\n*{{link-en|新澤西州500系列縣道列表|List of 500-series county routes in New Jersey|500系列縣道}}", county, county)
else
states = "*'''{{link-en|新澤西州縣道|County routes in New Jersey}}'''\n\n*{{link-en|新澤西州500系列縣道列表|List of 500-series county routes in New Jersey|500系列縣道}}"
end
else
states = string.format("*'''{{link-en|新澤西州州道列表|List of state highways in New Jersey|新澤西州州道}}'''\n\n*%s\n*{{link-en|新澤西州風景道路列表|List of New Jersey Scenic Byways|風景道路}}", three(args))
end
elseif state == 'NM' then
states = string.format("%s\n*{{link-en|新墨西哥州風景與歷史道路列表|List of New Mexico Scenic and Historic Byways|風景與歷史道路}}", shs(args))
elseif state == 'NY' then
local county = args.county or ''
if args.type == 'CR' then
if county ~= '' then
states = string.format("*'''" .. linken('紐約州縣道','County routes in New York') .. "'''\n\n*[[紐約州%s縣道列表|%s縣道]]", county, county)
else
states = "*'''" .. linken('紐約州縣道','County routes in New York') .. "'''"
end
else
states = string.format("*'''" .. linken('紐約州編號公路','Numbered highways in New York','紐約州公路') .. "'''\n\n*%s\n*" .. linken('紐約州參考道路列表','List of reference routes in New York','參考道路') .. "\n*[[紐約州公園大道系統|公園大道]]", three(args))
end
elseif state == 'NC' then
states = string.format("*'''[[North Carolina Highway System]]'''\n\n*%s\n*[[North Carolina Scenic Byways|Scenic]]", three(args))
elseif state == 'MP' then
states = "*'''[[List of numbered highways in the Northern Mariana Islands|Northern Mariana Islands Highways]]'''"
elseif state == 'OH' then
if args.type == 'CR' then
states = "*'''[[County roads in Ohio]]'''"
else
states = string.format("%s\n*[[Ohio Scenic Byway|Scenic]]", shs(args))
end
elseif state == 'OR' then
states = string.format("*'''[[State highways in Oregon|Oregon Highways]]'''\n\n*%s\n*[[List of named state highways in Oregon|Named]]\n*[[Oregon State Scenic Byways|Scenic]]", three(args))
elseif state == 'OK' then
states = string.format("%s\n*[[Turnpikes of Oklahoma|Turnpikes]]", shs(args))
elseif state == 'PA' then
states = string.format("*'''[[Pennsylvania State Route System]]'''\n\n*%s\n*[[Pennsylvania Scenic Byways|Scenic Byways]]\n*[[List of Legislative Routes in Pennsylvania|Legislative]]", three(args))
elseif state == 'PR' then
states = "*'''[[Roads in Puerto Rico]]'''\n\n*[[List of highways in Puerto Rico|List]]"
elseif state == 'RI' then
states = "*'''[[Numbered routes in Rhode Island|Rhode Island Routes]]'''"
elseif state == 'SC' then
states = string.format("%s\n*[[South Carolina Scenic Byways|Scenic]]", shsLinked(args))
elseif state == 'SD' then
states = string.format("*'''South Dakota State Trunk Highway System'''\n\n*%s", three(args))
elseif state == 'TN' then
states = string.format("*'''[[Tennessee State Route System|Tennessee State Routes]]'''\n\n*%s", three(args))
elseif state == 'TX' then
states = string.format("*'''[[Texas state highway system|Highways in Texas]]'''\n\n*%s\n*[[Toll roads in Texas|Toll]]\n*[[List of state highway loops in Texas|Loops]]\n*[[List of state highway spurs in Texas|Spurs]]\n*[[List of Farm to Market Roads in Texas|FM/RM]]\n*[[List of Park Roads in Texas|Park]]\n*[[List of Recreational Roads in Texas|Rec]]", three(args))
elseif state == 'UT' then
states = string.format("%s\n*\n*[[List of state highways serving Utah state parks and institutions|Minor]]\n*[[Utah Scenic Byways|Scenic]]", shs(args))
elseif state == 'VI' then
states = "*'''[[List of United States Virgin Islands highways|USVI Highways]]'''"
elseif state == 'VT' then
states = "*'''[[List of state highways in Vermont|State highways in Vermont]]'''"
elseif state == 'VA' then
states = "*'''[[State highways in Virginia|Virginia Routes]]'''\n\n*[[List of Interstate Highways in Virginia|Interstate]]\n*[[List of U.S. Highways in Virginia|US]]\n*[[List of primary state highways in Virginia|Primary]]\n*[[List of secondary state highways in Virginia|Secondary]]\n*[[Virginia Byway|Byways]]\n*[[History of state highways in Virginia|History]]\n*[[Virginia HOT lanes|HOT lanes]]"
elseif state == 'WA' then
states = string.format("*'''[[State highways in Washington]]'''\n\n*%s\n*[[Washington State Scenic and Recreational Highways|Scenic]]\n*[[List of Primary State Highways in Washington|Pre-1964]]\n*[[1964 state highway renumbering (Washington)|1964 renumbering]]\n*[[List of former state routes in Washington|Former]]", three(args))
elseif state == 'WV' then
local county = args.county or ''
if args.type == 'CR' then
if county ~= '' then
states = string.format("*'''[[List of county routes in West Virginia|County Routes in West Virginia]]'''\n\n*[[List of county routes in %s County, West Virginia|%s County Routes]]", county, county)
else
states = "*'''[[List of county routes in West Virginia|County Routes in West Virginia]]'''"
end
else
states = string.format("%s", shsLinked(args))
end
elseif state == 'WI' then
if args.type == 'CR' or args.type == 'CTH' then
states = "*'''[[County Trunk Highways (Wisconsin)|County Trunk Highways]]'''"
else
states = string.format("*'''[[Wisconsin State Trunk Highway System]]'''\n\n*%s\n*[[Wisconsin Scenic Byways|Scenic]]\n*[[Rustic Road (Wisconsin)|Rustic]]", three(args))
end
end
return string.format("%s\n\n%s", national, states)
elseif country(args) == 'ZAF' then
return "*'''{{link-en|南非編號公路|Numbered routes in South Africa}}'''"
elseif country(args) == 'ARG' or country(args) == 'BRB' or country(args) == 'IRQ' or country(args) == 'CHL' or country(args) == 'PRY' then
return string.format("*'''[[%s%s公路列表|%s%s公路]]'''", the(args), name, the(args), name)
elseif country(args) == 'BGD' or country(args) == 'IMN' or country(args) == 'ISL' or country(args) == 'MDG' or country(args) == 'NPL' or country(args) == 'UGA' then
return string.format("*'''[[%s%s道路列表|%s%s道路]]'''", the(args), name, the(args), name)
elseif country(args) == 'DNK' or country(args) == 'MNE' or country(args) == 'PRK' or country(args) == 'TUN' then
return string.format("*'''[[%s%s交通]]'''\n\n*[[%s%s高速公路|高速公路]]", the(args), name, the(args), name)
elseif country(args) == 'AZE' or country(args) == 'BLR' or country(args) == 'BLZ' or country(args) == 'CPV' or country(args) == 'CUB' or country(args) == 'HND' or country(args) == 'JAM' or country(args) == 'KWT' or country(args) == 'MDA' or country(args) == 'PAK' or country(args) == 'PRT' then
return string.format("*'''[[%s%s道路]]'''", the(args), name)
elseif country(args) == 'ALB' or country(args) == 'BGR' or country(args) == 'COL' or country(args) == 'CZE' or country(args) == 'DOM' or country(args) == 'ECU' or country(args) == 'GUF' or country(args) == 'HRV' or country(args) == 'PER' or country(args) == 'SVK' or country(args) == 'SVN' or country(args) == 'VEN' then
return string.format("*'''[[%s%s公路]]'''", the(args), name)
else
return string.format("*'''[[%s%s交通]]'''", the(args), name)
end
end
function p.browselinks(frame)
local args = getArgs(frame)
if args.nobrowse ~= nil then
return nil
else
return browselinks(args)
end
end
return p