This module is used to store type data for use with several road templates, including {{jct}} and {{routelist row}}. Background information and a summary of the syntax are listed below.

Syntax

tahrir

Hierarchy and fields

tahrir

At its most basic level, this module is a nested table of strings. At the top is the root table, named for the abbreviation of a country, state, or province. This table stores the type data for a particular place, which is named in the comment in the first line, and is returned at the end of the module. The table is composed of further tables, one per type. The basic syntax for a type table is:

place.type = {
	shield = "",
	name = "",
	link = "",
	abbr = ""
}

The four main fields in a type table are shield, name, link, and abbr. Currently, these are the types used by all countries. By convention, they are always specified, using an empty string "", if there is no value.

  • shield determines the shield that is displayed, if any
  • name specifies the name of the route displayed by an infobox
  • link specifies the target of a link generated, if any
  • abbr determines the displayed abbreviation.

Other common fields in road data tables

  • shieldmain is used when a different shield is desired at the top of an infobox, such as for county roads.
USA.CR = {
	shield = "CR %route% jct.svg",
	shieldmain = "[county||%county% |]County %route%.svg",
	name = "County Road %route%",
	link = "",
	abbr = "CR %route%"
}
  • shieldlist is used when a different shield is desired in lists that utilize the {{Routelist row}} series of templates.
  • base can be used for aliasing different types that have a similar base structure, such as U.S. Highway special routes.
  • banner stores the name of the special route plate, such as Business plate.svg. Can be omitted when unused.
  • width stores a code representing the width of the shield. It is most often helpful when used with banner. Can be omitted entirely when unused; common values are square and expand.
  • section stores the specific section number for those routes that are defined by law.
  • translation specifies the native language name of the route displayed by an infobox
  • lang is the ISO 639-2 code of the native language; this code is used by {{Lang}} and {{Lang-xx}}.
PER.RN = {
	shield = "PE-%route% route sign.svg",
	name = "National Route %route%",
	link = "Peru Highway %route%",
	abbr = "PE-%route%",
	translation = "Ruta nacional %route%",
	lang = "es-pe"
}

Once a type is defined, it can be referenced later in the code. As seen here, it is common to define all parameters for main types like US and then to use aliases for subtypes such as US-Alt.

MO.US = {
	shield = "US %route%.svg",
	base = "U.S. Route %route%",
	link = "U.S. Route %route% in Missouri",
	abbr = "US %route%",
	width = "expand"
}

MO["US-Alt"] = {
	shield = MO.US.shield,
	link = MO.US.base .. " Alternate ([dab||%dab%, |]Missouri)",
	abbr = MO.US.abbr .. " Alt.",
	banner = "Alternate plate.svg",
	width = "expand"
}

Parser arguments

tahrir

When the parser function of Module:Road data/parser is called, it is passed up to three parameters. The second one is the field to parse, and the last one is a rarely-used option designed for multiple-shield types. The first and most important parameter is a table of arguments collected by the calling module, which generally includes the state, country, or both; the type and number of the route; and a few miscellaneous arguments. This table of arguments forms the basis of the parser's format string syntax.

The table accessible by the strings includes the following entries by default:

  • state: The state or province the route is located in.
  • country: The country the route is located in. If the country is not passed by the calling module, the parser will attempt to include it.

The above entries are primarily used to find the string module itself, so they should not be a concern for module writers.

  • type: The type of the route. This determines the entry of the root table that is used by the parser.
  • route: The route "number". This is easily the most important argument for module writers.

The following entries are used less often:

  • county: The county the route is located in. This is usually used for county routes in the United States.
  • township: This entry is similar in function and utility to the county entry.
  • dab: A tag used to disambiguate the link target. This is mostly used for bannered routes in the United States.
  • denom: This rare entry is used exclusively for West Virginia county routes.

Parser hooks, which will be described later, can add entries to this table that may be used by strings.

Basic string syntax

tahrir

The most basic value that can be used for most type table fields is a specially formatted string, which will be referred to in this documentation as a format string. This is the string that will ultimately be parsed and returned by the parser. A format string is an ordinary string object. The power of these strings comes in the form of two special instructions that are recognized by the parser.

The first is anything in %argument% form. The parser will replace such a statement with the value of the argument entry in the arguments table described earlier. This is what allows the route number to be spliced into a shield or link name.

The second special string is in the form of [arg|equals|then|else]. This functions as a rudimentary if-then-else statement. The parser tests the value of arg to see if it is equal to the value specified in equals. equals may be empty, in which case the parser tests the existence of the arg argument. If the result of the test is true, the statement is replaced with the value of the then block. Otherwise, it is replaced with the value of the else block.

The two statements may be combined. The parser will parse the if-then-else statement first, and then perform the argument inclusion. This combination is commonly used with bannered routes in the United States, where the dab argument is tested and the link disambiguation is adjusted accordingly, as follows:

AL["US-Bus"] = {
	shield = "US %route%.svg",
	link = "U.S. Route %route% Business ([dab||%dab%, |]Alabama)",
	abbr = "US-%route% Bus.",
	banner = "Business plate.svg",
	width = "expand"
}

When parsing the link field, the parser first checks to see if the dab argument was provided. If so, it replaces the statement with %dab%, . If not, the statement is replaced with the empty string placed in the else block. Then, the parser replaces %route% with the route number and, if the dab argument was provided, %dab% with the value of that argument.

Switching

tahrir

Some logic is too complicated to represent with only format strings. This framework provides several methods to express complex data. All of these involve storing a nested table as the value of a field.

The most straightforward functionality provided by nested tables is switching. In its most basic form, the table consists of a series of key-value pairs, with the keys being route numbers and the values being the format strings used by those routes. Usually, the format string returned does not need parsing, but the option is there. A default entry should be provided to handle any route numbers not explicitly stated. The following is a representative example of route-based switching (from Module:Road data/strings/USA/AR):

AR.AR = {
	shield = {
		default = "Arkansas %route%.svg",
		["917"] = "Arkansas 917-1.svg",
		["980"] = "Arkansas 980(Airport).svg"
	},
	link = "Arkansas Highway %route% [dab||(%dab%)|]",
	abbr = "Hwy. %route%",
	width = "expand"
}

In this example, Highways 917 and 980 have non-standard shield names, which are explicitly provided. Other route numbers use the default format.

Switching on other arguments is also allowed. The name of the argument to be used for switching is stated in the arg field of the table. Nesting switches on different arguments is also allowed. A good example that uses both forms of switching can be found in Ontario:

local regionalShields = {
	arg = "county",
	["Essex"] = "Essex County Road %route%.png",
	["York"] = "York Regional Road %route%.svg",
	["Durham"] = "Durham Regional Road %route%.svg",
	["Niagara"] = "Niagara Regional Road %route%.svg",
	["Simcoe"] = {
		["52"] = "Simcoe county road 52.png",
		default = "Simcoe County Road %route%.JPG"
	}
}

In this example, which is a shield table that is reused by several types in Ontario, the county argument is used for the primary switch. If the route is in Simcoe County, a second switch is performed, this time on the route number.

Existence testing

tahrir

Another use for tables is existence testing. If a table has the ifexists field set to true, the parser will perform existence testing on the result of parsing the default field. If the test fails, the result of parsing the otherwise field is returned. Existence testing may be chained by using a second ifexists table as the value of the first table's otherwise field, and so on. Here's an example of nested existence testing (from Module:Road data/strings/GBR):

GBR.B = {
	shield = {
		ifexists = true,
		default = "UK road B%route%.svg",
		otherwise = {
			ifexists = true,
		default = "UK road B%route%.png"
		}
	},
	link = "",
	abbr = "B%route%"
}

Due to technical limitations, these string modules cannot contain functions. Rather than force functionality into the string framework, the parser can call functions in a separate hooks module. The functions in this module, Module:Road data/parser/hooks, are more-or-less fully functional functions. The exact functionalities of these hooks are beyond the scope of this documentation. Descriptions of these hooks may be found on their documentation page.

Generally speaking, a hook is called by setting the hook field in a table as equal to the name of a hook. Hooks receive two arguments, both tables: parameters, which is the table in the definition; and args, which is simply the table of arguments normally passed to the parser. The hook returns a string, which is then parsed as usual. A powerful feature of hooks is that they can add arbitrary values to the argument table, which may be referenced in the string returned by the hook. Generally, the format string returned by the hook is specified in some form by the default field of the table, though there are exceptions. Here is an example of a hook (from Module:Road data/strings/MEX):

MEX.SH = {
	shield = {
		ifexists = true,
		arg = "state",
		SON = "HIGHWAYSON %route%.jpg",
		NLE = "Nuevo Leon State Highway %route%.PNG",
		default = ""
	},
	link = {
		hook = "mask",
		mask = "Road data/masks/MEX",
		base = "state",
		masked = "fullstate",
		default = "%fullstate% State Highway %route%"
	},
	abbr = "SH %route%"
}

In this example, the parser will process the link by calling the mask hook. In short, this hook takes the argument referenced in base, passes it through the mask module specified in mask, and stores it in the field in the arguments noted in masked. The hook returns the string given in default, which has access to the fullstate argument added by the hook.

Other functionality

tahrir

Functionality exists to display multiple shields for one route, which is used to display tolled and free shields for routes where they differ. This is done by supplying a table with two values, which are listed without indices. The parser is called twice by the calling module, and it returns one shield per call. An example may be found in Texas:

TX.Both = {
	shield = {"Texas %route%.svg", "Toll Texas %route% new.svg"},
	link = "Texas State Highway %route%",
	abbr = "SH %route%",
	width = 40
}

Structure

tahrir

Each country has its own module. In the United States and Canada, each state/territory/province also has its own module. Each module begins with a comment stating the name of the country or state, followed by the root table declaration, as follows (from Module:Road data/strings/USA/AS):

-- American Samoa
local AS = {}

The root table is named based on the established abbreviation for the country or state, which is the same as the abbreviation used in the module title. This table stores the various types used in that particular place. Most of the remaining code in the module defines these various types. The module ends by returning the root table:

return AS

Aliasing

tahrir

There are two ways to define a type as an alias. If the type is defined within the module, simply set the new type as equal to the type being aliased, as shown above (from Module:Road data/strings/HKG):

HKG.Route = {
	shield = "HK Route%route%.svg",
	link = "Route %route% (Hong Kong)",
	abbr = "Route %route%"
}

HKG.route = HKG.Route

If the type is defined in a separate module, such as a state highway type being used in another state's module, a special syntax may be used to refer to that module (from Module:Road data/strings/USA/NJ):

NJ.NY = {alias = {module = "USA/NY", type = "NY"}}

This code sets the NY type as a link to the NY type in Module:Road data/strings/USA/NY. The parser will import that module and process the type as if the original module had declared it itself. The alias declaration may not add or override any data in the type table it points to.

Inheriting types

tahrir

It is possible to predefine several types for a location by inheriting them from another module. In this example, the module for Albania inherits all of the specified types from the Europe module.

-- Albania
local ALB = {}

local util = require("Module:Road data/util")
util.addAll(ALB, require("Module:Road data/strings/EUR"))

Andoza:N.b. Only one module may be inherited at this time.

Advanced uses

tahrir

It is possible to create multiple types based on a specified pattern using ipairs. In this example from Module:Road data/strings/USA/WA, the US 1926, US 1948, and US 1961 types are all created from the same code. At the bottom that is an override for US 1961's shieldmain.

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

WA["US 1961"].shieldmain = "US %route% (1961).svg"

Similarly, subtypes can be created in the same manner. This example creates 9 subtypes each for WA and SR. The aux is inherited from Module:Road data/strings/USA. That, in turn, modifies auxType and spec accordingly.

for _,type in ipairs({'WA', 'SR'}) do
	for _,auxType in ipairs({"Alt", "Bus", "Byp", "Conn", "Opt", "Scenic", "Spur", "Temp", "Truck"}) do
		local spec = WA[" aux "][auxType]
		WA[type .. "-" .. auxType] = {
			shield = WA[type].shield,
			shieldmain = WA[type].shieldmain,
			name = WA[type].name .. " " .. spec.name,
			link = WA[type].link .. " " .. spec.name .. suffix,
			abbr = WA[type].abbr .. " " .. spec.abbrsuffix,
			banner = spec.bannerprefix .. " plate.svg",
			aux = spec.aux,
			width = WA[type].width
		}
	end
end

There are a few style guidelines that should be followed:

  1. Align table fields using tabs. All tables should be aligned so that fields line up with each other, as shown in the above examples.
  2. Each table field should be on its own line.
  3. Add spaces to either side of an assignment operator (equals sign).
  4. Leave a blank line between types. Type aliases should be set off from their base type by a blank line, but no blank lines should be placed between the aliases themselves.

--[==[
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,
		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",
	width = "expand"
}


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 = "[[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,
	bannersuffix = "green 1961"
}

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,
	bannersuffix = "green 1961"
}

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",
	color = {
		arg = "route",
		["66"] = "hist"
	}
}

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",
		bannersuffix = format("%s", year)
	}
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",
	bannersuffix = "1961"
}

USA["US 1971"] = {
	shield = USA.US.shield,
	base = USA.US.base,
	name = USA.US.name,
	link = USA.US.link,
	abbr = USA.US.abbr,
	width = "expand",
	bannersuffix = "1971"
}

for k, v in pairs(USA) do if k:find ("US 19%d%d") then 
	v.color = {
		arg = "route",
		["66"] = "hist"
	}
	end
end

USA["US-named"] = {
	shield = "",
	name = "%route%",
	link = "%route%",
	abbr = "%route%",
}

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

USA.Npkwy = {
	shield = "",
	shieldmain = "Logo of the United States National Park Service.svg",
	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["FH-named"] = {
	shield = "",
	name = "%route%",
	link = "%route%",
	abbr = "%route%",
	color = "hist",
}

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.NFSB = {
	shield = "National Forest Scenic Byway.svg",
	name = "%route% National Forest Scenic&nbsp;Byway",
	link = "%route% National Forest Scenic Byway",
	abbr = "%route% National Forest Scenic Byway",
	color = "hist"
}

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",
		["VT"] = "US Bike %route% (M1-9 IA-15).svg",
		["WI"] = "US Bike %route% (M1-9 IA-15).svg",
		["WV"] = "US Bike %route% (M1-9 IA-15).svg",
		default = {
			["21"] = "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