--[==[
To inspect the content of this data module, use Special:ExpandTemplates
and enter the following input text:  
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 = "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 = "Auxiliary route"
},
Bus = {
name = "Business",
abbrsuffix = "Bus.",
arksuffix = "B"
},
Byp = {
name = "Bypass",
abbrsuffix = "Byp.",
bannerprefix = "By-pass",
aux = "Bypass"
},
City = {
name = "City",
arksuffix = "C"
},
Conn = {
name = "Connector",
abbrsuffix = "Conn.",
arksuffix = "Y"
},
Detour = {
name = "Detour",
aux = "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%",,
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,
}
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,
bannersuffix = "blue 1961"
}
end  
USA["I 1971"] = {
shield = USA["I 1961"].shield,
shieldmain = USA["I 1961"].shieldmain,
base = USA.I.base,
name = USA.I.name,
link = USA.I.link,
abbr = USA.I.abbr,
bannersuffix = "blue 1971",
}  
USA["I-named"] = {
shield = "",
name = "%route%",
link = "%route%",
abbr = "%route%",
}  
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 = "Business route",
}  
USA.BS = {