Documentation icon دستاویز [تخلیق]
--[==[
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.",
		bannerprefix = "Alt"
	},
	Bus = {
		name = "Business",
		abbrsuffix = "Bus."
	},
	Byp = {
		name = "Bypass",
		abbrsuffix = "Byp.",
		bannerprefix = "By-pass",
		aux = "[[Bypass (road)|Bypass]]"
	},
	Conn = {
		name = "Connector",
		abbrsuffix = "Conn."
	},
	Loop = {name = "Loop"},
	Scenic = {name = "Scenic"},
	Spur = {name = "Spur"},
	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.

USA.I = {
	base = "Interstate %route%",
	shield = "I-%route%.svg",
	name = "Interstate %route%",
	link = "Interstate %route%" .. USA[" dab "],
	abbr = "I&#8209;%route%",
	bannersuffix = "blue",
	browse = {
		{link = "Interstate Highway System", bold = true},
		{
			noprint = true,
			{link = "List of Interstate Highways", name = "Main"},
			{link = "List of auxiliary Interstate Highways", name = "Auxiliary"},
			{link = "List of suffixed Interstate Highways", name = "Suffixed"},
			{link = "List of business routes of the Interstate Highway System", name = "Business"}
		}
	}
}

USA["I-Alt"] = {
	shield = USA.I.shield,
	name = USA.I.name .. " Alternate",
	link = USA.I.base .. " Alternate" .. USA[" dab "],
	abbr = USA.I.abbr .. " Alt.",
	banner = "Alternate plate blue.svg",
	bannersuffix = USA.I.bannersuffix,
	aux = "[[Alternate route]]",
	browse = USA.I.browse
}

USA["I-Toll"] = {
	shield = USA.I.shield,
	name = USA.I.name .. " Toll",
	link = USA.I.link,
	abbr = USA.I.abbr,
	banner = "Toll plate yellow.svg",
	bannersuffix = USA.I.bannersuffix,
	browse = USA.I.browse
}

USA["I-Future"] = {
	shield = "I-%route% (Future).svg",
	name = USA.I.name,
	link = USA.I.link,
	abbr = "Future " .. USA.I.abbr,
	bannersuffix = USA.I.bannersuffix,
	browse = USA.I.browse
}

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

USA["I 1957"] = {
	shield = "I-%route% (1957).svg",
	name = USA.I.name,
	link = USA.I.link,
	abbr = USA.I.abbr,
	browse = USA.I.browse
}

USA["I 1961"] = {
	shield = {
		hook = "splitlen",
		split = 3,
		above = "I-%route% (1961).svg",
		below = "I-%route% (1957).svg"
	},
	name = USA.I.name,
	link = USA.I.link,
	abbr = USA.I.abbr,
	browse = USA.I.browse
}

USA.BL = {
	shield = "Business Loop %route%.svg",
	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]]",
	browse = USA.I.browse
}

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

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,
	browse = USA.I.browse
}

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,
	browse = USA.I.browse
}

USA.US = {
	base = "U.S. Route %route%",
	shield = "US %route%.svg",
	name = "U.S. Route %route%",
	link = "U.S. Route %route%" .. USA[" dab "],
	abbr = "US&nbsp;%route%",
	browse = {
		{link = "United States Numbered Highway System", bold = true},
		{
			noprint = true,
			{link = "List of U.S. Routes", name = "Main"},
			{link = "List of bannered U.S. Routes", name = "Bannered"},
			{link = "List of divided U.S. Routes", name = "Divided"},
			{link = "List of highways bypassed by Interstate Highways", name = "Replaced"}
		}
	}
}

for _,auxType in ipairs({"Alt", "Bus", "Byp", "Conn", "Scenic", "Spur", "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,
		browse = USA.US.browse
	}
end

USA["US-Hist"] = {
	shield = "US %route% (historic).svg",
	name = USA.US.name .. " Historic",
	link = USA.US.base .. USA[" dab "],
	abbr = "Historic " .. USA.US.abbr .. USA[" dab "],
	browse = USA.US.browse
}

for _,year in ipairs({"1926", "1948", "1961"}) do
	USA["US " .. year] = {
		shield = format("US %%route%% (%s).svg", year),
		name = USA.US.name,
		link = USA.US.link,
		abbr = USA.US.abbr,
		browse = USA.US.browse
	}
end

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

return USA