Kontent qismiga oʻtish

Modul:Road data/strings/USA/TX

Vikipediya, erkin ensiklopediya

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.

Hierarchy and fields

[manbasini tahrirlash]

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

[manbasini tahrirlash]

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

[manbasini tahrirlash]

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.

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

[manbasini tahrirlash]

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

[manbasini tahrirlash]

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
}

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

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

[manbasini tahrirlash]

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

[manbasini tahrirlash]

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"]`.
]==]

-- Texas
local TX = {}

local util = require("Module:Road data/util")
local format = mw.ustring.format
util.addAll(TX, require("Module:Road data/strings/USA"))

local suffix = " ([dab||%dab%, |]Texas)"
local suffix2 = " [dab||(%dab%)|]"

-- Interstate types
TX.I.link = {
	["2"] = "Interstate 2",
	["14"] = "Interstate 14",
	["27"] = "Interstate 27",
	["30"] = "Interstate 30",
	["35E"] = "Interstate 35E (Texas)",
	["35W"] = "Interstate 35W (Texas)",
	["37"] = "Interstate 37",
	["45"] = "Interstate 45",
	["69C"] = "Interstate 69C",
	["69E"] = "Interstate 69E",
	["69W"] = "Interstate 69W",
	["410"] = "Interstate 410",
	["820"] = "Interstate 820",
	default = {
		hook = "split",
		split = 100,
		above = "Interstate %route% (Texas)",
		below = "Interstate %route% in Texas"
	}
}
TX.IH = TX.I

for _,auxType in ipairs({"Alt", "Express", "Future", "Local", "Spur", "Temp", "Toll", "Truck"}) do
	local spec = TX[" aux "][auxType]
		for k, v in pairs(TX) do if k:find (auxType) then if k:find ("^I-") then 
			v.link = "Interstate %route% " .. spec.name .. suffix
		end
	end
end
TX["I-Toll"].shield = "Toll Texas Interstate Highway %route%.svg"
TX["I-Express"].shield = "%route% Express Lane free.svg"
TX["I-Express"].banner = ""
TX["I-Future"].shield = TX.I.shield
TX["I-Future"].link = TX.I.link
TX["I-Future"].banner = "Future plate blue.svg"

TX.BL.shieldmain = "Business Interstate %route% (TX).svg"
TX.BL.name = "Business " .. TX.I.name
TX.BL.link = "Interstate %route% Business" .. suffix

for k, v in pairs(TX) do if k:find ("^B%a") then 
	v.shieldmain = TX.BL.shieldmain
	v.name = TX.BL.name
	v.link = TX.BL.link
	end
end
TX["I-Bus"]=TX.BL
TX.BLBS.shieldmain = {TX.BL.shield, TX.BS.shield}

-- US types
TX.US.name = "U.S. Highway %route%"
TX.US.link = "U.S. Route %route% in Texas"

for k, v in pairs(TX) do if k:find ("^US %d") then 
	v.name = TX.US.name
	v.link = TX.US.link
	end
end

for _,auxType in ipairs({"Alt", "Bus", "Byp", "City", "Conn", "Emerg", "Opt", "Scenic", "Spur", "Temp", "Toll", "Truck"}) do
	local spec = TX[" aux "][auxType]
		for k, v in pairs(TX) do if k:find (auxType) then if k:find ("^US") then
			v.shieldmain = TX.US.shield
			v.name = spec.name .. " " .. TX.US.name
			v.link = TX.US.base .. " " .. spec.name .. suffix
			v.abbr = TX.US.abbr .. " " .. spec.abbrsuffix
			end
		end
	end
end
TX.UA = TX["US-Alt"]
TX.BU = TX["US-Bus"]

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

TX["US-Bus"] = {
	shield = TX.US.shield,
	name = "Business " .. TX.US.name,
	link = "U.S. Route %route% Business" .. suffix,
	abbr = "Bus. " .. TX.US.abbr,
	banner = "Business plate.svg", -- see SHSD p. 3-7 https://ftp.dot.state.tx.us/pub/txdot-info/trf/shsd/2012/section3.pdf
	width = "expand",
	aux = TX[" aux "]
}
TX["Bus-US"] = TX["US-Bus"]

TX["US-Alt-Bus"] = {
	shield = TX.US.shield,
	name = "Business " .. TX["US-Alt"].name,
	link = "U.S. Route %route% Business Alternate" .. suffix,
	abbr = "Bus. " .. TX["US-Alt"].abbr,
	banner = "Business alternate plate.svg",
	width = "expand",
	aux = TX[" aux "].Alt
}


-- SH (main) types
TX.SH = {
	shield = "Texas %route%.svg",
	shieldmain = {
		["249"] = {"Texas %route%.svg", "Tomball Tollway.svg"},
		default = "Texas %route%.svg"
	},
	base = "Texas State Highway %route%",
	name = "State Highway %route%",
	link = "Texas State Highway %route%" .. suffix2,
	abbr = "SH&nbsp;%route%"
}
TX.TX = TX.SH

for _,type in ipairs({"SH", "TX"}) do
	for _,auxType in ipairs({"Alt", "Byp", "Conn", "Opt", "Scenic", "Spur", "Temp", "Truck"}) do
		local spec = TX[" aux "][auxType]
		TX[type .. "-" .. auxType] = {
			shield = TX.SH.shield,
			name = spec.name .. " " .. TX.SH.name,
			link = TX.SH.base .. " " .. spec.name .. suffix2,
			abbr = TX.SH.abbr .. " " .. spec.abbrsuffix,
			banner = spec.bannerprefix .. " plate.svg",
			aux = spec.aux,
			width = "square"
		}
	end
end

TX["SH-Bus"] = {
	shield = "Texas %route%.svg",
	name = "Business&nbsp;" .. TX.SH.name,
	link = "Texas State Highway %route% Business" .. suffix2,
	abbr = "Bus.&nbsp;" .. TX.SH.abbr,
	banner = "Business plate.svg",
	aux = TX[" aux "],
	width = "square"
}
TX["TX-Bus"] = TX["SH-Bus"]
TX["Bus-SH"] = TX["SH-Bus"]
TX["Bus-TX"] = TX["SH-Bus"]

TX["SH-Bus 1969"] = {
	shield = "Texas Business %route%.svg",
	name = TX["SH-Bus"].name,
	link = TX["SH-Bus"].link,
	abbr = TX["SH-Bus"].abbr,
}
TX["TX-Bus 1969"] = TX["SH-Bus 1969"]

for _,type in ipairs({"SH", "TX"}) do
	for _,year in ipairs({"1917", "1935", "old"}) do
			TX[type .. "-" .. year] = {
				shield = format("Texas %%route%% %s.svg", year),
				name = TX.SH.name,
				link = TX.SH.link,
				abbr = TX.SH.abbr,
				width = "square"
			}
		end
	end
end
TX["SH-old"].shield = "Old Texas %route%.svg"
TX["TX-old"].shield = TX["SH-old"].shield

-- Loop/Spur types
TX.Beltway = {
	shield = "Texas Beltway %route%.svg",
	shieldmain = {
		hook = "pagename",
		article = "Texas State Highway Beltway 8",
 		iftrue = {"Texas Beltway %route%.svg", "Sam Houston Tollway.svg"},
 		default = "Texas Beltway %route%.svg"
	},
	name = "State Highway Beltway %route%",
	link = "Texas State Highway Beltway %route%",
	abbr = "Beltway&nbsp;%route%"
}
TX.BW = TX.Beltway

TX.Loop = {
	shield = "Texas Loop %route%.svg",
	base = "Texas State Highway Loop %route%",
	name = "State Highway Loop %route%",
	link = {
		default = "Texas State Highway Loop %route%" .. suffix2,
		["1910"] = "Andrews Loop 1910"
	},
	abbr = "Loop&nbsp;%route%"}
TX.SL = TX.Loop

TX.Spur = {
	shield = "Texas Spur %route%.svg",
	base = "Texas State Highway Spur %route%",
	name = "State Highway Spur %route%",
	link = "Texas State Highway Spur %route%" .. suffix2,
	abbr = "Spur&nbsp;%route%"
}
TX.SS = TX.Spur

-- FM/RM types
TX.FM = {
	shield = "Texas FM %route%.svg",
	name = "Farm to Market Road %route%",
	base = "Farm to Market Road %route%",
	link = "Farm to Market Road %route%",
	abbr = "FM&nbsp;%route%"
}
TX.Farm = TX.FM

TX.RM = {
	shield = "Texas RM %route%.svg",
	base = "Ranch to Market Road %route%",
	name = "Ranch to Market Road %route%",
	link = "Ranch to Market Road %route%",
	abbr = "RM&nbsp;%route%"
}
TX.Ranch = TX.RM

for _,type in ipairs({"FM", "RM"}) do
	for _,year in ipairs({"1956"}) do
		TX[type .. "-" .. year] = {
			shield = format("Texas %s %%route%% (%s).svg", type, year),
			name = TX[type].name,
			link = TX[type].link,
			abbr = TX[type].abbr,
			width = "square"
		}
	end
end
TX["FM 1956"] = TX["FM-1956"]

for _,type in ipairs({"FM", "RM"}) do
	for _,auxType in ipairs({"Bus", "Loop", "Spur"}) do
		local spec = TX[" aux "][auxType]
		TX[type .. "-" .. auxType] = {
			name = TX[type].name .. " " .. spec.name,
			link = TX[type].base .. " " .. spec.name .. suffix2,
			abbr = type .. " " .. spec.abbrsuffix .. " %route%",
			aux = spec.aux,
			width = "square"
		}
	end
end
TX["FM-Bus"].shield = "Texas Business FM %route%.svg"
TX["FM-Loop"].shield = TX.Loop.shield
TX["FM-Spur"].shield = TX.Spur.shield

-- Misc SH types --
TX.Park = {
	shield = "Texas Park Road %route%.svg",
	link = "Texas Park Road %route%",
	abbr = "PR&nbsp;%route%",
	color = "hist"
}
TX.PR = TX.Park

TX.NASA = {
	shield = "Texas NASA Road %route%.svg",
	name = "NASA Road %route%",
	link = "NASA Road %route%",
	abbr = "NASA&nbsp;%route%"
}
	
TX.RR = {
	shield = "Texas RM %route%.svg",
	name = "Ranch Road %route%",
	link = "Ranch Road %route%",
	abbr = "RR&nbsp;%route%"
}

TX.RE = {
	shield = "Texas Recreational Road %route%.svg",
	name = "Recreational Road %route%", 
	link = "Texas Recreational Road %route%", 
	abbr = "RE&nbsp;%route%",
	color = "hist",
	bannersuffix = "brown"
}

TX["RE-Spur"] = {
	shield = TX.Spur.shield, 
	name = TX.RE.name .. " Spur",
	link = TX.RE.name .. " Spur",
	abbr = "RE Spur&nbsp;%route%",
	color = "hist",
	aux = TX[" aux "].Spur,
}

TX.PA = {
	shield = {
		ifexists = true,
		default = "Texas PA %route%.svg",
		otherwise = ""
	},
	name = "Principal Arterial Road %route%",
	link = "Texas Principal Arterial Road %route%",
	abbr = "PA&nbsp;%route%"
}

-- add new types above this line if you want it to have the state highway browse and maint
for k, v in pairs(TX) do if k:find ("^%a") then
	v.maint = "[[Texas Department of Transportation|TxDOT]]"
	end
end

for k, v in pairs(TX) do if k:find ("%d") then 
	v.maint = "[[Texas State Highway Department]]"
	end
end

TX.INTL = {
	shield = "",
	name = "International Parkway",
	link = "International Parkway", 
	abbr = "International Parkway"
}
TX.IP = TX.INTL

local tollAbbrs = {
	default = TX.SH.abbr .. " Toll",
	Hardy = "Hardy Toll Road",
	HTR = "Hardy Toll Road",
	["Sam Houston"] = "Sam Houston Tollway",
	SHT = "Sam Houston Tollway",
	Tomball = "Tomball Tollway",
	TBT = "Tomball Tollway",
	Westpark = "Westpark Tollway",
	WPT = "Westpark Tollway",
	CTP = "Chisholm Trail Parkway",
	DNT = "Dallas North Tollway",
	PGBT = "Pres. George Bush Turnpike",
	SRT = "Sam Rayburn Tollway",
	FBT = "Fort Bend Tollway",
	FBPTR = "Fort Bend Parkway Toll Road", --is Tollroad one word as signed on SH 6?
	["Fort Bend Westpark"] = "Fort Bend Westpark Tollway",
	FBWPT = "Fort Bend Westpark Tollway",
	KFML = "I-10 Toll (Katy Tollway)",
	["1"] = "Loop %route% Toll",
	["49"] = "Loop %route% Toll",
	["71"] = "71 Toll Lanes",
	["183"] = "183 Toll Road",
	["183A"] = "183A Toll Road",
	["290"] = "290 Toll Road"
}

--Toll maint
local BCTRA = "Brazoria County Toll Road Authority"
local CTRMA = "[[Central Texas Regional Mobility Authority]]"
local CTTP = "Central Texas Turnpike Project"
local FBCTRA = "[[Fort Bend County Toll Road Authority]]"
local HCTRA = "[[Harris County Toll Road Authority]]"
local MCTRA = "[[Montgomery County Toll Road Authority]]"
local NETRMA = "[[North East Texas Regional Mobility Authority]]"
local NTTA = "[[North Texas Tollway Authority]]"

-- Toll types
TX.Toll = {
	shield = {
		default = "Toll Texas %route% new.svg",
		Hardy = "Hardy Toll Road.svg",
		HTR = "Hardy Toll Road.svg",
		["Sam Houston"] = "Sam Houston Tollway.svg",
		SHT = "Sam Houston Tollway.svg",
		Tomball = "Tomball Tollway.svg",
		TBT = "Tomball Tollway.svg",
		Westpark = "Westpark Tollway.svg",
		WPT = "Westpark Tollway.svg",
		FBT = "Fort Bend Toll Road.svg",
		FBPTR = "",
		["Fort Bend Westpark"] = "",
		FBWPT = "",
		KFML= "Toll Texas Interstate Highway 10.svg",
		["71"] = "71 Toll Lane free.svg",
		["183"] = "183 Toll Road free.svg",
		["183A"] = "183A Toll Road free.svg",
		["290"] = "290 Toll Road free.svg"
	},
	shieldmain = {
		default = "Toll Texas %route% new.svg",
		Hardy = "Hardy Toll Road.svg",
		HTR = "Hardy Toll Road.svg",
		["Sam Houston"] = "Sam Houston Tollway.svg",
		SHT = "Sam Houston Tollway.svg",
		Tomball = "Tomball Tollway.svg",
		TBT = "Tomball Tollway.svg",
		Westpark = {
			hook = "pagename",
			article = "Westpark Tollway",
	 		iftrue = {"Fort Bend Westpark Tollway logo.png", "Westpark Tollway.svg"},
	 		default = "Westpark Tollway.svg"
			},
		WPT = {
			hook = "pagename",
			article = "Westpark Tollway",
	 		iftrue = {"Fort Bend Westpark Tollway logo.png", "Westpark Tollway.svg"},
	 		default = "Westpark Tollway.svg"
			},
		FBT = {
			hook = "pagename",
			article = "Fort Bend Parkway",
	 		iftrue = {"Fort Bend Parkway Toll Road logo.png", "Fort Bend Toll Road.svg"},
	 		default = "Fort Bend Toll Road.svg"
			},
		FBPTR = {
			hook = "pagename",
			article = "Fort Bend Parkway",
	 		iftrue = {"Fort Bend Parkway Toll Road logo.png", "Fort Bend Toll Road.svg"},
	 		default = "Fort Bend Toll Road.svg"
			},
		["Fort Bend Westpark"] = {
			hook = "pagename",
			article = "Westpark Tollway",
	 		iftrue = {"Fort Bend Westpark Tollway logo.png", "Westpark Tollway.svg"},
	 		default = "Westpark Tollway.svg"
			},
		FBWPT = {
			hook = "pagename",
			article = "Westpark Tollway",
	 		iftrue = {"Fort Bend Westpark Tollway logo.png", "Westpark Tollway.svg"},
	 		default = "Westpark Tollway.svg"
			},
		CTP = "Toll Texas Chisholm Trail Parkway.svg",
		DNT = "Toll Texas Dallas North Tollway.svg",
		PGBT = "Toll Texas President George Bush Turnpike.svg",
		SRT = "Toll Texas Sam Rayburn Tollway.svg",
		KFML= "Toll Texas Interstate Highway 10.svg",
		["71"] = "71 Toll Lane.svg", -- also has free version
		["183"] = "183 Toll Road.svg", -- also has free version
		["183A"] = "183A Toll Road.svg", -- also has free version
		["290"] = "290 Toll Road.svg" -- also has free version
	},
	name = tollAbbrs,
	link = {
		default = TX.SH.link,
		Hardy = "Hardy Toll Road",
		HTR = "Hardy Toll Road",
		["Sam Houston"] = "Sam Houston Tollway",
		SHT = "Sam Houston Tollway",
		Tomball = "Tomball Tollway",
		TBT = "Tomball Tollway",
		Westpark = "Westpark Tollway",
		WPT = "Westpark Tollway",
		CTP = "Chisholm Trail Parkway",
		DNT = "Dallas North Tollway",
		PGBT = "President George Bush Turnpike",
		SRT = "Sam Rayburn Tollway",
		FBT = "Fort Bend Tollway",
		FBPTR = "Fort Bend Parkway Toll Road",
		["Fort Bend Westpark"] = "Fort Bend Westpark Tollway",
		FBWPT = "Fort Bend Westpark Tollway",
		KFML = "Katy Tollway",
		["1"] = TX.Loop.link,
		["49"] = TX.Loop.link,
		["71"] = "71 Toll Lanes",
		["183"] = "183 Toll Road",
		["183A"] = "183A Toll Road",
		["290"] = "290 Toll Road"
	},
	abbr = tollAbbrs,
	bannersuffix = {
		default = "blue",
		["Sam Houston"] = "HCTRA",
		SHT = "HCTRA",
		Westpark = "HCTRA",
		WPT = "HCTRA",
		Tomball = "HCTRA",
		TBT = "HCTRA",
		["Fort Bend Westpark"] = "HCTRA",
		FBWPT = "HCTRA",
		Hardy = "HCTRA",
		HTR = "HCTRA",
		FBT = "HCTRA",
		FBPTR = "HCTRA"
	},
	orientation = "upright",
	maint = {
		default = "",
		Hardy = HCTRA,
		HTR = HCTRA,
		["Sam Houston"] = HCTRA,
		SHT = HCTRA,
		Tomball = HCTRA,
		TBT = HCTRA,
		Westpark = FBCTRA .. " and " .. HCTRA,
		WPT = FBCTRA .. " and " .. HCTRA,
		CTP = NTTA,
		DNT = NTTA,
		PGBT = NTTA,
		SRT = NTTA,
		FBT =  FBCTRA .. " and " .. HCTRA,
		FBPTR = FBCTRA .. " and " .. HCTRA,
		["Fort Bend Westpark"] =  FBCTRA .. " and " .. HCTRA,
		FBWPT =  FBCTRA .. " and " .. HCTRA,
		KFML = HCTRA,
		["1"] = CTTP,
		["45"] = CTTP,
		["49"] = NETRMA,
		["71"] = CTRMA,
		["130"] = CTTP,
		["183"] = CTRMA,
		["183A"] = CTRMA,
		["249"] = MCTRA,
		["288"] = BCTRA .. " and " .. TX.SH.maint,
		["290"] = CTRMA,
		["360"] = NTTA,
		["375"] = "Camino Real Regional Mobility Authority",
		["550"] = "Cameron County Regional Mobility Authority",
	}
}

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

TX.AATT = {
	shield = "Toll Texas AATT new.svg",
	shieldmain = "Toll Texas Addison Airport Toll Tunnel.svg",
	name = "Addison Airport Toll Tunnel",
	link = "Addison Airport Toll Tunnel",
	abbr = "Addison Airport Toll Tunnel",
	orientation = "upright",
	bannersuffix = "blue",
	maint = NTTA
}

TX.DFW = {
	shield = "",
	name = "Dallas-Fort Worth Turnpike",
	link = "Dallas-Fort Worth Turnpike",
	abbr = "D/FW Turnpike"
}

TX.LLTB = {
	shield = "Toll Texas LLTB new.svg",
	shieldmain = "Toll Texas Lewisville Lake Toll Bridge.svg",
	name = "Lewisville Lake Toll Bridge",
	link = "Lewisville Lake Toll Bridge",
	abbr = "Lewisville Lake Toll Bridge",
	orientation = "upright",
	bannersuffix = "blue",
	maint = NTTA
}

TX.MCLB = {
	shield = "Toll Texas MCLB new.svg",
	shieldmain = "Toll Texas Mountain Creek Lake Bridge.svg",
	name = "Mountain Creek Lake Bridge",
	link = "Mountain Creek Lake Bridge",
	abbr = "Mountain Creek Lake Bridge",
	orientation = "upright",
	bannersuffix = "blue",
	maint = NTTA
}

TX["SH-Express"] = {
	shield = "%route% Express Lane free.svg",
	name = TX.SH.name .. " Express ",
	link = TX.SH.base .. " Express ".. suffix2,
	abbr = TX.SH.abbr .. " Express",
	banner = "",
	maint = {
		default = NTTA,
		["1"] = CTTP
	}
}
	
TX["Loop Dual"] = {
	shield = {"Texas Loop %route%.svg", "Toll Texas %route% new.svg"},
	shieldmain = {"Texas Loop %route%.svg", "Toll Texas %route% new.svg"},
	name = TX.Loop.name,
	link = TX.Loop.link,
	abbr = TX.Loop.abbr
}

TX["Loop-Express"] = {
	shield = {
		default = TX.Loop.shield, --actually has a special variant of the toll shield http://maps.google.com/maps?ll=32.820965,-97.201688&spn=0.012929,0.024784&t=m&z=16&layer=c&cbll=32.820896,-97.205511&panoid=coL0_PX6xfY9Ia3Rkrr8cA&cbp=12,353.63,,1,-8.72
		["1"] = "1 Express Lane free.svg"
	},
	name = "Loop %route% Express",
	link = TX.Loop.base .. " Express ".. suffix2,
	abbr = TX.Loop.abbr .. " Express",
	banner = "",
	bannersuffix = "blue",
	maint = {
		default = "",
		["1"] = CTRMA
	}
}
	
TX["SL-Express"] = TX["Loop-Express"]

TX.CR.shield = {
		arg        = "county",
		default    = "",
		Brazoria		= "Generic green square county %route%.svg"
	}
TX.CR.maint = ""
TX.CR.browse = ""
TX.CR.browselinks = ""
	
TX.MEX = {alias = {module = "MEX", type = "FH"}}
TX["I-AR"] = {alias = {module = "USA/AR", type = "I"}}
TX["US-AR"] = {alias = {module = "USA/AR", type = "US"}}
TX.AR = {alias = {module = "USA/AR", type = "AR"}}
TX.LA = {alias = {module = "USA/LA", type = "LA"}}
TX.OK = {alias = {module = "USA/OK", type = "SH"}}
TX.NM = {alias = {module = "USA/NM", type = "NM"}}

return TX