Module:Infobox road/link/CHN

local p = {}

local format = mw.ustring.format

local typesModule = require "Module:Infobox road/link/defs" local Country = typesModule.Country local Type = typesModule.Type local Link = typesModule.Link

local expwyNames = {["1"]="Beijing–Harbin", ["2"]="Beijing–Shanghai", ["3"]="Beijing–Taipei", ["4"]="Beijing–Hong Kong–Macau", ["5"]="Beijing–Kunming", ["6"]="Beijing–Lhasa", ["7"]="Beijing–Ürümqi", ["4W"]="Guangzhou–Macau", ["11"]="Hegang–Dalian", ["15"]="Shenyang–Haikou", ["25"]="Changchun–Shenzhen", ["35"]="Jinan–Guangzhou", ["45"]="Daqing–Guangzhou", ["55"]="Erenhot–Guangzhou", ["65"]="Baotou–Maoming", ["75"]="Lanzhou–Haikou", ["85"]="Chongqing–Kunming", ["15W"]="Changshu–Taizhou", ["1111"]="Hegang–Harbin", ["1112"]="Ji'an–Shuangliao", ["1113"]="Dandong–Fuxin", ["1511"]="Rizhao–Lankao", ["1512"]="Ningbo–Jinhua", ["1513"]="Wenzhou–Lishui", ["1514"]="Ningde–Shangrao", ["2511"]="Xinmin–Lubei", ["2512"]="Fuxin–Jinzhou", ["2513"]="Huai'an–Xuzhou", ["4511"]="Longnan–Heyuan", ["5511"]="Jining–Arun", ["5512"]="Jincheng–Xinxiang", ["5513"]="Changsha–Zhangjiajie", ["7511"]="Qinzhou–Dongxing", ["8511"]="Kunming–Mohan", ["10"]="Suifenhe–Manzhouli", ["12"]="Hunchun–Ulanhot", ["16"]="Dandong–Xilinhot", ["18"]="Rongcheng–Wuhai", ["20"]="Qingdao–Yinchuan", ["22"]="Qingdao–Lanzhou", ["30"]="Lianyungang–Khorgas", ["36"]="Nanjing–Luoyang", ["40"]="Shanghai–Xi'an", ["42"]="Shanghai–Chengdu", ["50"]="Shanghai–Chongqing", ["56"]="Hangzhou–Ruili", ["60"]="Shanghai–Kunming", ["70"]="Fuzhou–Yinchuan", ["72"]="Quanzhou–Nanning", ["76"]="Xiamen–Chengdu", ["78"]="Shantou–Kunming", ["80"]="Guangzhou–Kunming", ["1011"]="Harbin–Tongjiang", ["1211"]="Jilin–Heihe", ["1212"]="Shenyang–Jilin", ["1811"]="Huanghua–Shijiazhuang", ["2011"]="Qingdao–Xinhe", ["2012"]="Dingbian–Wuwei", ["3011"]="Liuyuan–Golmud", ["3012"]="Turpan–Hotan", ["3013"]="Kashgar–Irkeshtam", ["3014"]="Kuytun–Aksu", ["3015"]="Kuytun–Tacheng", ["3016"]="Qingshuihe–Yining", ["4011"]="Yangzhou–Liyang", ["4211"]="Nanjing–Wuhu", ["4212"]="Hefei–Anqing", ["5011"]="Wuhu–Hefei", ["5611"]="Dali–Lijiang", ["7011"]="Shiyan–Tianshui", ["7211"]="Nanning–Youyiguan", ["8011"]="Kaiyuan–Hekou", ["91"]="Liaozhong Ring", ["92"]="Hangzhou Bay Ring", ["93"]="Chengdu–Chongqing Ring", ["94"]="Pearl River Delta Ring", ["98"]="Hainan Ring", ["99"]="Taiwan Ring", ["9211"]="Ningbo–Zhoushan", ["9411"]="Dongguan–Foshan", ["0102"]="Changchun Ring", ["1001"]="Harbin Ring", ["1101"]="Dalian Ring", ["1502"]="Quanzhou Ring", ["1503"]="Xiamen Ring", ["2201"]="Changzhi Ring", ["4001"]="Hefei Ring", ["4202"]="Chengdu Second Ring", ["4501"]="Beijing Ring", ["5001"]="Chongqing Ring", ["5501"]="Datong Ring", ["5503"]="Jincheng Ring", ["5601"]="Kunming Ring", ["7201"]="Nanning Ring"}

local links = Country:new

links["G"] = Link:new{formatStr = "China National Highway %s"} -- China National Highways links["X"] = Link:new{formatStr = "X%s"}

do -- Shanghai Provincial expressways local names = {["1"] = "Yingbin Expressway", ["2"] = "Shanghai–Luchaogang Expressway", ["3"] = "Shanghai–Fengxian Expressway", ["4"] = "Shanghai–Jinshan Expressway", ["5"] = "Shanghai–Jiading Expressway", ["6"] = "Shanghai–Nanxiang Expressway", ["7"] = "Chongming Cross-sea West Line", ["19"] = "Xinnong–Jinshanwei Expressway", ["20"] = "Outer Ring Expressway (Shanghai)", ["26"] = "Shanghai–Changzhou Expressway", ["32"] = "Shanghai–Jiaxing–Huzhou Expressway", ["36"] = "Tinglin–Fengjing"} local link = Link:new{exceptions = names} links["S"] = Type:new{Shanghai = link} end -- Shanghai Provincial expressways do -- China National Expressways local function expwyName(args) local route = args.route local name = expwyNames[route] if name then args.expwyName = name return end local rings = {["0401"] = true, ["0601"] = true, ["1501"] = true, ["2001"] = true, ["2501"] = true, ["3001"] = true, ["4201"] = true, ["6001"] = true} if rings[route] then local dab = args.dab or '' args.expwyName = format("%s Ring", dab) return end end local type = Link:new{formatStr = "G%s %s Expressway", formatArgs = {"route", "expwyName"}, preprocessors = {expwyName}} links["Ex"] = type links["Expwy"] = type end -- China National Expressways

p.links = links return p