模組解[]
--[==[
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

--[[ 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.",
		arksuffix = "A",
		banneralt = "Alt",
	},
	Aux = {
		name = "Auxiliary",
		aux = "[[List of auxiliary Interstate Highways|Auxiliary route]]"
	},
	Bus = {
		name = "Business",
		abbrsuffix = "Bus.",
		arksuffix = "B"
	},
	Byp = {
		name = "Bypass",
		abbrsuffix = "Byp.",
		bannerprefix = "By-pass",
		aux = "[[Bypass (road)|Bypass]]"
	},
	City = {
		name = "City",
		arksuffix = "C"
	},
	Conn = {
		name = "Connector",
		abbrsuffix = "Conn.",
		arksuffix = "Y"
	},
	Detour = {
		name = "Detour",
		aux = "[[Detour (road)|Detour]]"
	},
	Emerg = {
		name = "Emergency",
		abbrsuffix = "Emerg."
	},
	Express = {
		name = "Express",
		aux = "Express route"
	},
	Future = {
		name = "Future",
		aux = "Future routing"
	},
	Local = {
		name = "Local",
		aux = "Local route"
	},
	Loop = {name = "Loop"},
	Old = {name = "Old"},
	Opt = {
		name = "Optional",
		abbrsuffix = "Opt."
	},
	Scenic = {name = "Scenic"},
	Spur = {
		name = "Spur",
		arksuffix = "S"
	},
	Temp = {
		name = "Temporary",
		abbrsuffix = "Temp."
	},
	Toll = {name = "Toll"},
    Truck = {
        name = "Truck",
        arksuffix = "T"
    },
}
-- 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.banneralt =  entry.banneralt or entry.bannerprefix
	entry.aux = entry.aux or format("[[%s route]]", entry.name)
end

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",
	aux = {
		hook = "splitlen",
		split = 3,
		above = USA[" aux "].Aux,
		below = ""
	}
}

for _,auxType in ipairs({"Alt", "Express", "Future", "Local", "Spur", "Temp", "Toll", "Truck"}) do
	local spec = USA[" aux "][auxType]
	USA["I-" .. auxType] = {
		shield = USA.I.shield,
		shieldmain = USA.I.shieldmain,
		name = USA.I.name .. " " .. spec.name,
		link = USA.I.base .. " " .. spec.name .. USA[" dab "],
		abbr = USA.I.abbr .. " " .. spec.abbrsuffix,
		banner = spec.name .. " plate blue.svg",
		bannersuffix = USA.I.bannersuffix,
		aux = spec.aux,
		width = "expand"
	}
end

USA["I-Future"].shield = "I-%route% (Future).svg"
USA["I-Future"].shieldmain = "I-%route% (Future).svg"
USA["I-Future"].name = "Future " .. USA.I.name
USA["I-Temp"].name = "Temporary " .. USA.I.name
USA["I-Future"].abbr = "Future " .. USA.I.abbr
USA["I-Temp"].abbr = "Temp. " .. USA.I.name
USA["I-Express"].banner = "Express plate yellow.svg"
USA["I-Future"].banner = ""
USA["I-Local"].banner = "Local plate yellow.svg"
USA["I-Toll"].banner = "Toll plate yellow.svg"

USA.Future = USA["I-Future"]
USA["I-Temporary"] = USA["I-Temp"]

for _,year in ipairs({"1957", "1961"}) do
	USA["I " .. year] = {
		shield = {
			arg = "state",
			default = format("I-%%route%% (%s).svg", year),
			["AK"] = format("I-A%%route%% (%s).svg", year),
			["HI"] = format("I-H%%route%% (%s).svg", year)
		},
		shieldmain = {
			arg = "state",
			default = format("I-%%route%% (%s).svg", year),
			["AL"] = format("I-%%route%% (AL %s).svg", year),
			["AK"] = format("I-A%%route%% (AK %s).svg", year),
			["AZ"] = format("I-%%route%% (AZ %s).svg", year),
			["AR"] = format("I-%%route%% (AR %s).svg", year),
			["CA"] = format("I-%%route%% (CA %s).svg", year),
			["CO"] = format("I-%%route%% (CO %s).svg", year),
			["CT"] = format("I-%%route%% (CT %s).svg", year),
			["DE"] = format("I-%%route%% (DE %s).svg", year),
			["DC"] = format("I-%%route%% (DC %s).svg", year),
			["FL"] = format("I-%%route%% (FL %s).svg", year),
			["GA"] = format("I-%%route%% (GA %s).svg", year),
			["HI"] = format("I-H%%route%% (HI %s).svg", year),
			["ID"] = format("I-%%route%% (ID %s).svg", year),
			["IL"] = format("I-%%route%% (IL %s).svg", year),
			["IN"] = format("I-%%route%% (IN %s).svg", year),
			["IA"] = format("I-%%route%% (IA %s).svg", year),
			["KS"] = format("I-%%route%% (KS %s).svg", year),
			["KY"] = format("I-%%route%% (KY %s).svg", year),
			["LA"] = format("I-%%route%% (LA %s).svg", year),
			["ME"] = format("I-%%route%% (ME %s).svg", year),
			["MD"] = format("I-%%route%% (MD %s).svg", year),
			["MA"] = format("I-%%route%% (MA %s).svg", year),
			["MI"] = format("I-%%route%% (MI %s).svg", year),
			["MN"] = format("I-%%route%% (MN %s).svg", year),
			["MS"] = format("I-%%route%% (MS %s).svg", year),
			["MO"] = format("I-%%route%% (MO %s).svg", year),
			["MT"] = format("I-%%route%% (MT %s).svg", year),
			["NE"] = format("I-%%route%% (NE %s).svg", year),
			["NV"] = format("I-%%route%% (NV %s).svg", year),
			["NH"] = format("I-%%route%% (NH %s).svg", year),
			["NJ"] = format("I-%%route%% (NJ %s).svg", year),
			["NM"] = format("I-%%route%% (NM %s).svg", year),
			["NY"] = format("I-%%route%% (NY %s).svg", year),
			["NC"] = format("I-%%route%% (NC %s).svg", year),
			["ND"] = format("I-%%route%% (ND %s).svg", year),
			["OH"] = format("I-%%route%% (OH %s).svg", year),
			["OK"] = format("I-%%route%% (OK %s).svg", year),
			["OR"] = format("I-%%route%% (OR %s).svg", year),
			["PA"] = format("I-%%route%% (PA %s).svg", year),
			["RI"] = format("I-%%route%% (RI %s).svg", year),
			["SC"] = format("I-%%route%% (SC %s).svg", year),
			["SD"] = format("I-%%route%% (SD %s).svg", year),
			["TN"] = format("I-%%route%% (TN %s).svg", year),
			["TX"] = format("I-%%route%% (TX %s).svg", year),
			["UT"] = format("I-%%route%% (UT %s).svg", year),
			["VT"] = format("I-%%route%% (VT %s).svg", year),
			["VA"] = format("I-%%route%% (VA %s).svg", year),
			["WA"] = format("I-%%route%% (WA %s).svg", year),
			["WV"] = format("I-%%route%% (WV %s).svg", year),
			["WI"] = format("I-%%route%% (WI %s).svg", year),
			["WY"] = format("I-%%route%% (WY %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",
	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",
	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,
}

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

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",
}

for _,auxType in ipairs({"Alt", "Bus", "Byp", "City", "Conn", "Detour", "Emerg", "Future", "Old", "Opt", "Scenic", "Spur", "Temp", "Toll", "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 = spec.bannerprefix .. " plate.svg",
		aux = spec.aux,
		width = "expand"
	}
end
USA["US-Toll"].banner = "Toll plate yellow.svg"
USA["US-City"].name = "City " .. USA.US.name
USA["US-City"].abbr = "City " .. USA.US.abbr
USA["US-Temp"].name = "Temporary " .. USA.US.name
USA["US-Temp"].abbr = "Temp. " .. USA.US.abbr

USA["US-Hist"] = {
	shield = "[state||US %route% (%state% historic).svg|US %route% (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 = {
			ifexist = true,
			arg = "state",
			otherwise = format("US %%route%% (%s)", year),
			["AL"] = format("US %%route%% Alabama %s.svg", year),
			["AZ"] = format("US %%route%% Arizona %s.svg", year),
			["AR"] = format("US %%route%% Arkansas %s.svg", year),
			["CA"] = format("US %%route%% California %s.svg", year),
			["CO"] = format("US %%route%% Colorado %s.svg", year),
			["CT"] = format("US %%route%% Connecticut %s.svg", year),
			["DE"] = format("US %%route%% Delaware %s.svg", year),
			["DC"] = format("US %%route%% District of Columbia %s.svg", year),
			["FL"] = format("US %%route%% Florida %s.svg", year),
			["GA"] = format("US %%route%% Georgia %s.svg", year),
			["ID"] = format("US %%route%% Idaho %s.svg", year),
			["IL"] = format("US %%route%% Illinois %s.svg", year),
			["IN"] = format("US %%route%% Indiana %s.svg", year),
			["IA"] = format("US %%route%% Iowa %s.svg", year),
			["KS"] = format("US %%route%% Kansas %s.svg", year),
			["KY"] = format("US %%route%% Kentucky %s.svg", year),
			["LA"] = format("US %%route%% Louisiana %s.svg", year),
			["ME"] = format("US %%route%% Maine %s.svg", year),
			["MD"] = format("US %%route%% Maryland %s.svg", year),
			["MA"] = format("US %%route%% Massachusetts %s.svg", year),
			["MI"] = format("US %%route%% Michigan %s.svg", year),
			["MN"] = format("US %%route%% Minnesota %s.svg", year),
			["MS"] = format("US %%route%% Mississippi %s.svg", year),
			["MO"] = format("US %%route%% Missouri %s.svg", year),
			["MT"] = format("US %%route%% Montana %s.svg", year),
			["NE"] = format("US %%route%% Nebraska %s.svg", year),
			["NV"] = format("US %%route%% Nevada %s.svg", year),
			["NH"] = format("US %%route%% New Hampshire %s.svg", year),
			["NJ"] = format("US %%route%% New Jersey %s.svg", year),
			["NM"] = format("US %%route%% New Mexico %s.svg", year),
			["NY"] = format("US %%route%% New York %s.svg", year),
			["NC"] = format("US %%route%% North Carolina %s.svg", year),
			["ND"] = format("US %%route%% North Dakota %s.svg", year),
			["OH"] = format("US %%route%% Ohio %s.svg", year),
			["OK"] = format("US %%route%% Oklahoma %s.svg", year),
			["OR"] = format("US %%route%% Oregon %s.svg", year),
			["PA"] = format("US %%route%% Pennsylvania %s.svg", year),
			["RI"] = format("US %%route%% Rhode Island %s.svg", year),
			["SC"] = format("US %%route%% South Carolina %s.svg", year),
			["SD"] = format("US %%route%% South Dakota %s.svg", year),
			["TN"] = format("US %%route%% Tennessee %s.svg", year),
			["TX"] = format("US %%route%% Texas %s.svg", year),
			["UT"] = format("US %%route%% Utah %s.svg", year),
			["VT"] = format("US %%route%% Vermont %s.svg", year),
			["VA"] = format("US %%route%% Virginia %s.svg", year),
			["WA"] = format("US %%route%% Washington %s.svg", year),
			["WV"] = format("US %%route%% West Virginia %s.svg", year),
			["WI"] = format("US %%route%% Wisconsin %s.svg", year),
			["WY"] = format("US %%route%% Wyoming %s.svg", 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"
}

USA.Byway = {
	shield = "",
	name = "%route%",
	link = "%route%",
	abbr = "%route%",
	color = "hist",
	bannersuffix = "brown",
}

USA.BCB = {
	shield = "BLM Backcountry Byway.svg",
	name = "%route%",
	link = "%route%",
	abbr = "%route%",
	color = "hist",
	bannersuffix = "brown",
}
USA["Back Country"] = USA.BCB

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"
}

USA.NSB = {
	shield = "MUTCD D6-4.svg",
	name = "%route%",
	link = "%route%",
	abbr = "%route%",
	color = "hist"
}
USA.FSB = USA.NSB

USA.Scenic = {
	shield = "",
	name = "%route%",
	link = "%route%",
	abbr = "%route%",
	color = "hist"
}

USA.ADHS = {
	shield = "",
	name = "%route%",
	link = "%route%",
	abbr = "%route%"
}

USA.ISTEA = {
	shield = "",
	name = "%route%",
	link = "%route%",
	abbr = "%route%"
}

USA.NHS = {
	shield = "",
	name = "%route%",
	link = "%route%",
	abbr = "%route%"
}

USA.Post = {
	shield = "",
	name = "%route%",
	link = "%route%",
	abbr = "%route%",
	color = "hist"
}
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 = '',
	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"
}

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