Jump to content

Module:Road data/strings/USA/sandbox: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
No edit summary
testing
Line 17: Line 17:
local util = require("Module:Road data/util")
local util = require("Module:Road data/util")
local format = mw.ustring.format
local format = mw.ustring.format
local stateName = mw.loadData("Module:Jct/statename")


--[[ REGION-SPECIFIC SETTINGS ]]--
--[[ REGION-SPECIFIC SETTINGS ]]--
Line 67: Line 68:
name = "Alternate",
name = "Alternate",
abbrsuffix = "Alt.",
abbrsuffix = "Alt.",
bannerprefix = {
arg = "state",
default = "Alternate",
["DE"] = "Alt",
["FL"] = "Alt",
["KS"] = "Alt",
["MS"] = "Alt",
["NV"] = "Alt",
["NJ"] = "Alt",
["OH"] = "Alt",
["OK"] = "Alt",
["SC"] = "Alt",
["WV"] = "Alt",
["DC"] = "Alt",
},
},
},
Bus = {
Bus = {
Line 133: Line 119:
-- ‑ is nonbreaking hyphen.
-- ‑ is nonbreaking hyphen.


local alternateBlueSpec = {
local alternateSpec = {
arg = "state",
arg = "state",
default = "Alternate plate blue.svg",
default = "Alternate",
["DE"] = "Alt plate blue.svg",
["DE"] = "Alt",
["FL"] = "Alt plate blue.svg",
["FL"] = "Alt",
["KS"] = "Alt plate blue.svg",
["IA"] = "Alt",
["MS"] = "Alt plate blue.svg",
["KS"] = "Alt",
["NV"] = "Alt plate blue.svg",
["MS"] = "Alt",
["NJ"] = "Alt plate blue.svg",
["NV"] = "Alt",
["OH"] = "Alt plate blue.svg",
["NJ"] = "Alt",
["OK"] = "Alt plate blue.svg",
["OH"] = "Alt",
["SC"] = "Alt plate blue.svg",
["OK"] = "Alt",
["WV"] = "Alt plate blue.svg",
["SC"] = "Alt",
["DC"] = "Alt plate blue.svg",
["WV"] = "Alt",
["DC"] = "Alt",
}
}


Line 213: Line 200:
banner = {
banner = {
arg = auxType,
arg = auxType,
["Alt"] = alternateBlueSpec,
["Alt"] = tostring(alternateSpec.state) .. " plate blue.svg",
["Express"] = spec.bannerprefix .. " plate yellow.svg",
["Express"] = spec.bannerprefix .. " plate yellow.svg",
["Future"] = "",
["Future"] = "",
["Local"] = spec.bannerprefix .. " plate yellow.svg",
["Local"] = spec.bannerprefix .. " plate yellow.svg",
["Temp"] = spec.bannerprefix .. " plate blue.svg",
["Toll"] = spec.bannerprefix .. " plate yellow.svg",
["Toll"] = spec.bannerprefix .. " plate yellow.svg",
default = spec.bannerprefix .. " plate blue.svg"
default = spec.bannerprefix .. " plate blue.svg"
Line 317: Line 303:
link = USA.US.base .. " " .. spec.name .. USA[" dab "],
link = USA.US.base .. " " .. spec.name .. USA[" dab "],
abbr = USA.US.abbr .. " " .. spec.abbrsuffix,
abbr = USA.US.abbr .. " " .. spec.abbrsuffix,
banner = spec.bannerprefix .. " plate.svg",
banner = {
arg = auxType,
["Alt"] = tostring(alternateSpec.state) .. " plate.svg",
default = spec.bannerprefix .. " plate.svg"
},
aux = spec.aux,
aux = spec.aux,
width = "expand"
width = "expand"

Revision as of 03:13, 16 September 2021

--[==[
To inspect the content of this data module, use [[Special:ExpandTemplates]]
and enter the following input text:
  {{#invoke:Road data/dump|dump|module=Module:<name-of-this-module>}}

To inspect the content of this data module when editing, enter the following
into the Debug console:
  local util = require("Module:Road data/util")
  print(util.arrayToString(p))
To inspect a particular route type, change `p` above to include the route type,
e.g., `p.I` and `p["US-Hist"]`.
]==]

-- United States
local USA = {}

local util = require("Module:Road data/util")
local format = mw.ustring.format
local stateName = mw.loadData("Module:Jct/statename") 

--[[ REGION-SPECIFIC SETTINGS ]]--
USA[" common "] = {
	country = "United States",
	locations = {
		indep_city = {
			linksuffix = ", %region%",
			prefix = "[[Independent city (United States)|City]] of ",
			jcttoparticle = "the "
		},
		sub1 = {
			linksuffix = " County, %region%",
			jcttopnamesuffix = " County"
		},
		sub2 = {
			linksuffix = "[sub1dab||, %sub1dab% County|], %region%"
		},
		sub2areas = {
			city = {
				linksuffix = " (city)",
				jcttoparticle = "the ",
				nameprefix = "City of "
			},
			town = {
				linksuffix = " (town)",
				jcttoparticle = "the ",
				nameprefix = "Town of "
			},
			township = {
				linksuffix = " Township",
				namesuffix = " Township",
			},
			village = {
				linksuffix = " (village)",
				jcttoparticle = "the ",
				nameprefix = "Village of "
			}
		}
	}
}

--[[ ROUTE TYPES ]]--
-- disambiguation switch
USA[" dab "] = "[dab|| (%dab%)|]"

-- definitions for auxiliary routes
USA[" aux "] = {
	Alt = {
		name = "Alternate",
		abbrsuffix = "Alt.",
	},
	Bus = {
		name = "Business",
		abbrsuffix = "Bus."
	},
	Byp = {
		name = "Bypass",
		abbrsuffix = "Byp.",
		bannerprefix = "By-pass",
		aux = "[[Bypass (road)|Bypass]]"
	},
	City = {name = "City"},
	Conn = {
		name = "Connector",
		abbrsuffix = "Conn."
	},
	Detour = {
		name = "Detour",
		aux = "[[Detour (road)|Detour]]"
	},
	Emerg = {
		name = "Emergency",
		abbrsuffix = "Emerg."
	},
	Future = {name = "Future"},
	Express = {name = "Express"},
	Local = {name = "Local"},
	Loop = {name = "Loop"},
	Opt = {
		name = "Optional",
		abbrsuffix = "Opt."
	},
	Scenic = {name = "Scenic"},
	Spur = {name = "Spur"},
	Temp = {
		name = "Temporary",
		abbrsuffix = "Temp."
	},
	Toll = {name = "Toll"},
	Truck = {name = "Truck"},
}
-- fill out default values
for _,entry in pairs(USA[" aux "]) do
	entry.abbrsuffix = entry.abbrsuffix or entry.name
	entry.bannerprefix =  entry.bannerprefix or entry.name
	entry.aux = entry.aux or format("[[%s route]]", entry.name)
end

-- &nbsp; is nonbreaking space.
-- &#8209; is nonbreaking hyphen.

local alternateSpec = {
	arg = "state",
	default = "Alternate",
	["DE"] = "Alt",
	["FL"] = "Alt",
	["IA"] = "Alt",
	["KS"] = "Alt",
	["MS"] = "Alt",
	["NV"] = "Alt",
	["NJ"] = "Alt",
	["OH"] = "Alt",
	["OK"] = "Alt",
	["SC"] = "Alt",
	["WV"] = "Alt",
	["DC"] = "Alt",
}

USA.I = {
	base = "Interstate %route%",
	shield = "I-%route%.svg",
	shieldmain= {
		arg = "state",
		["AK"] = "I-A%route%.svg",
		["AL"] = "I-%route% (AL).svg",
		["AR"] = "I-%route% (AR).svg",
		["AZ"] = "I-%route% (AZ).svg",
		["CA"] = "I-%route% (CA).svg",
		["HI"] = "I-H%route%.svg",
		["IA"] = "I-%route% (IA).svg",
		["KS"] = "I-%route% (KS).svg",
		["MT"] = "I-%route% (big).svg",
		["NJ"] = "I-%route% (NJ).svg",
		["NM"] = "I-%route% (NM).svg",
		["NV"] = "I-%route% (NV).svg",
		["NY"] = "I-%route% (long).svg",
		["OK"] = "I-%route% (OK).svg",
		["PR"] = "I-PR%route%.svg",
		["SC"] = "I-%route% (SC).svg",
		["TX"] = "I-%route% (TX).svg",
		["UT"] = "I-%route% (UT).svg",
		["WV"] = "I-%route% (WV).svg",
		["WY"] = "I-%route% (WY).svg",
		default = "I-%route%.svg"
	},
	name = "Interstate %route%",
	link = "Interstate %route%" .. USA[" dab "],
	abbr = "I-%route%",
	width = "expand",
	bannersuffix = "blue",
	nbrowse = "[[Interstate Highway System]]",
	nbrowselinks = {
		[1] = "[[List of Interstate Highways|Main]]",
		[2] = "[[List of auxiliary Interstate Highways|Auxiliary]]",
		[3] = "[[List of suffixed Interstate Highways|Suffixed]]",
		[4] = "[[List of business routes of the Interstate Highway System|Business]]",
		[5] = "[[Future Interstate Highways|Future]]"
	},
}

for _,auxType in ipairs({"Alt", "Express", "Future", "Local", "Toll", "Temp"}) do
	local spec = USA[" aux "][auxType]
	USA["I-" .. auxType] = {
		shield = {
			arg = auxType,
			["Future"] = "I-%route% (Future).svg",
			default = USA.I.shield
		},
		name = {
			arg = auxType,
			["Temp"] = spec.name .. " " .. USA.I.name,
			default = USA.I.name .. " " .. spec.name
		},
		link = USA.I.base .. " " .. spec.name .. USA[" dab "],
		abbr = {
			arg = auxType,
			["Future"] = spec.abbrsuffix .. " " .. USA.I.abbr,
			["Temp"] = spec.abbrsuffix .. " " .. USA.I.abbr,
			default = USA.I.abbr .. " " .. spec.abbrsuffix
		},
		banner = {
			arg = auxType,
			["Alt"] = tostring(alternateSpec.state) .. " plate blue.svg",
			["Express"] = spec.bannerprefix .. " plate yellow.svg",
			["Future"] = "",
			["Local"] = spec.bannerprefix .. " plate yellow.svg",
			["Toll"] = spec.bannerprefix .. " plate yellow.svg",
			default = spec.bannerprefix .. " plate blue.svg"
		},
		bannersuffix = USA.I.bannersuffix,
		aux = spec.aux,
		width = "expand"
	}
end
USA.Future = USA["I-Future"]
USA["I-Temporary"] = USA["I-Temp"]

for _,year in ipairs({"1957", "1961"}) do
	USA["I " .. year] = {
		shield = format("I-%%route%% (%s).svg", year),
		shieldmain = format("I-%%route%% ([%%state%%||%%state%% |]%s).svg", year),
		base = USA.I.base,
		name = USA.I.name,
		link = USA.I.link,
		abbr = USA.I.abbr,
	}
end

USA.BL = {
	shield = "Business Loop %route%.svg",
	shieldmain = "Business Loop %route%.svg",
	name = USA.I.name .. " Business",
	link = USA.I.base .. " Business" .. USA[" dab "],
	abbr = USA.I.abbr .. " BL",
	aux = "[[List of business routes of the Interstate Highway System|Business route]]",
	width = "expand"
}

USA.BS = {
	shield = "Business Spur %route%.svg",
	shieldmain = "Business Spur %route%.svg",
	name = USA.BL.name,
	link = USA.BL.link,
	abbr = USA.I.abbr .. " BS",
	aux = USA.BL.aux,
	width = "expand"
}

USA["BL 1957"] = {
	shield = "Business Loop %route% (1957).svg",
	name = USA.BL.name,
	link = USA.BL.link,
	abbr = USA.BL.abbr,
	aux = USA.BL.aux,
}

USA["BS 1957"] = {
	shield = "Business Spur %route% (1957).svg",
	name = USA.BS.name,
	link = USA.BS.link,
	abbr = USA.BS.abbr,
	aux = USA.BS.aux,
}

for k, v in pairs(USA) do if k:find ("^%a") then 
	v.nbrowse = USA.I.nbrowse
	v.nbrowselinks = USA.I.nbrowselinks
	end
end


USA.US = {
	base = "U.S. Route %route%",
	shield = {
		arg = "state",
		["CA"] = "US %route% (1961 cutout).svg",
		default = "US %route%.svg"
	},
	shieldmain = {
		arg = "state",
		["CA"] = "US %route% (1961 cutout).svg",
		default = {
			["85"] = {"US %route%.svg", "CanAm Highway.svg"},
			default = "US %route%.svg"
		}
	},
	name = "U.S. Route %route%",
	link = "U.S. Route %route%" .. USA[" dab "],
	abbr = "US&nbsp;%route%",
	width = "expand",
	nbrowse = "[[United States Numbered Highway System]]",
	nbrowselinks = {
		[1] = "[[List of United States Numbered Highways|Main]]",
		[2] = "[[List of special routes of the United States Numbered Highway System|Special]]",
		[3] = "[[List of divided U.S. Routes|Divided]]"
	}
}

for _,auxType in ipairs({"Alt", "Bus", "Byp", "Conn", "Opt", "Scenic", "Spur", "Temp", "Truck"}) do
	local spec = USA[" aux "][auxType]
	USA["US-" .. auxType] = {
		shield = USA.US.shield,
		name = USA.US.name .. " " .. spec.name,
		link = USA.US.base .. " " .. spec.name .. USA[" dab "],
		abbr = USA.US.abbr .. " " .. spec.abbrsuffix,
		banner = {
			arg = auxType,
			["Alt"] = tostring(alternateSpec.state) .. " plate.svg",
			default = spec.bannerprefix .. " plate.svg"
		},
		aux = spec.aux,
		width = "expand"
	}
end

USA["US-Hist"] = {
	shield = "US %route% ([state||(%state% historic)|historic]).svg",
	name = "Historic " .. USA.US.name,
	link = USA.US.base .. USA[" dab "],
	abbr = "Historic " .. USA.US.abbr .. USA[" dab "],
	orientation = "upright",
	color = "hist"
}

for _,year in ipairs({"1926", "1948"}) do
	USA["US " .. year] = {
		shield = format("US %%route%% (%s).svg", year),
		shieldmain = format("US %%route%% [%%state%%||%%state%% %s|(%s)].svg", year, year),
		base = USA.US.base,
		name = USA.US.name,
		link = USA.US.link,
		abbr = USA.US.abbr,
		width = "square"
	}
end

USA["US 1961"] = {
	shield = "US %route% (1961).svg",
	base = USA.US.base,
	name = USA.US.name,
	link = USA.US.link,
	abbr = USA.US.abbr,
	width = "square"
}

for k, v in pairs(USA) do if k:find ("^US") then 
	v.nbrowse = USA.US.nbrowse
	v.nbrowselinks = USA.US.nbrowselinks
	end
end

USA.FFH = {
	shield = "Forest Route %route%.svg",
	name = "Federal Forest Highway %route%",
	link = "Forest Highway %route%",
	abbr = "FFH&nbsp;%route%",
	color = "hist",
	bannersuffix = "brown"
}
        
USA.FH = {
	shield = "Forest Route %route%.svg",
	name = "Forest Highway %route%",
	link = "Forest Highway %route%",
	abbr = "FH&nbsp;%route%",
	color = "hist",
	bannersuffix = "brown"
}
         
USA.FR = {
	shield = "Forest Route %route%.svg",
	name = "Forest Route %route%",
	link = "Forest Highway %route%",
	abbr = "FR&nbsp;%route%",
	color = "hist",
	bannersuffix = "brown"
}

for k, v in pairs(USA) do if k:find ("^F") then 
	v.nbrowse = "[[Forest Highway|Forest Highway System]]"
	end
end
         
USA.NSB = {
	shield = "MUTCD D6-4.svg",
	name = "%route%",
	link = "%route%",
	abbr = "%route%",
	color = "hist",
	nbrowse = "[[Scenic byways in the United States|Scenic Byways]]",
	nbrowselinks = {
		[1] = "[[National Scenic Byway|National]]",
		[2] = "[[National Forest Scenic Byway|National Forest]]",
		[3] = "[[Bureau of Land Management Back Country Byway|BLM]]",
		[4] = "[[National Parkway|NPS]]",
	}
}
USA.NFSB = USA.NSB
USA.FSB = USA.NSB

USA.ADHS = {
	shield = "",
	name = "%route%",
	link = "%route%",
	abbr = "%route%",
	nbrowse = "[[Appalachian Development Highway System]]"
}

USA.ISTEA = {
	shield = "",
	name = "%route%",
	link = "%route%",
	abbr = "%route%",
	nbrowse = "[[Intermodal Surface Transportation Efficiency Act|High-Priority Corridors]]"
}

USA.NHS = {
	shield = "",
	name = "%route%",
	link = "%route%",
	abbr = "%route%",
	nbrowse = "[[National Highway System (United States)|National Highway System]]",
	nbrowselinks = {
		[1] = "[[Interstate Highway System|Interstates]]",
		[2] = "[[Strategic Highway Network|STRAHNET]]"
	}
}

USA.Post = {
	shield = "",
	name = "%route%",
	link = "%route%",
	abbr = "%route%",
	color = "hist",
	nbrowse = "[[Post_road#United_States|Post Roads in the United States]]"
}
USA.Postal = USA.Post
         
USA.CR = {
	shield = "CR %route% jct.svg",
	shieldmain = "[county||%county% |]County %route%.svg",
	base = "County Road %route%",
	name = "County Road %route%",
	link = "",
	abbr = "CR %route%"
}

USA.road = {
	shield = '',
	shieldmain = '',
	name = "%route%",
	link = '',
	abbr = "%route%",
}
         
-- https://mutcd.fhwa.dot.gov/resources/interim_approval/ialistreq.htm#ia15
USA.USBR = {
	shield = {
		arg = "state",
		["AZ"] = "US Bike %route% (M1-9 IA-15).svg",
		["CA"] = "US Bike %route% (M1-9 IA-15).svg",
		["GA"] = "US Bike %route% (M1-9 IA-15).svg",
		["ID"] = "US Bike %route% (M1-9 IA-15).svg",
		["IL"] = "US Bike %route% (M1-9 IA-15).svg",
		["IN"] = "US Bike %route% (M1-9 IA-15).svg",
		["KY"] = "US Bike %route% (M1-9 IA-15).svg",
		["MD"] = "US Bike %route% (M1-9 IA-15).svg",
		["MI"] = "US Bike %route% (M1-9 IA-15).svg",
		["MO"] = "US Bike %route% (M1-9 IA-15).svg",
		["OH"] = "US Bike %route% (M1-9 IA-15).svg",
		["TN"] = "US Bike %route% (M1-9 IA-15).svg",
		["UT"] = "US Bike %route% (M1-9 IA-15).svg",
		["VA"] = "US Bike %route% (M1-9 IA-15).svg",
		["WV"] = "US Bike %route% (M1-9 IA-15).svg",
		default = "US Bike %route% (M1-9).svg"
	},
	name = "U.S. Bicycle Route %route%",
	link = "U.S. Bicycle Route %route%" .. USA[" dab "],
	abbr = "USBR %route%",
	orientation = "upright",
	nbrowse = "[[United States Bicycle Route System]]",
	nbrowselinks = "[[United States Bicycle Route System#List of routes and planned corridors|List]]"
}

util.addAll(USA, require("Module:Road data/strings/USA/regional/GRR"))
util.addAll(USA, require("Module:Road data/strings/USA/regional/NER"))
util.addAll(USA, require("Module:Road data/strings/USA/regional/Tour"))
util.addAll(USA, require("Module:Road data/strings/USA/regional/Trails"))

return USA