Module:Road data/strings/USA/SD

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

-- South Dakota
local SD = {}

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

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

SD.I.link = {
	hook = "splitlen",
	split = 3,
	above = "Interstate %route% (South Dakota)",
	below = "Interstate %route% in South Dakota"
}
SD.I.law = "<span class='plainlinks'>[http://sdlegislature.gov/Statutes/Codified_Laws/DisplayStatute.aspx?Type=Statute&Statute=31-4-%section% SDCL §31-4-%section%]</span>"

for k, v in pairs(SD) do if k:find ("^I") then 
	v.link = SD.I.link
	end
end

SD.BL.link = SD.I.base .. " Business" .. suffix

for k, v in pairs(SD) do if k:find ("^B%a") then 
	v.link = SD.BL.link
	end
end

SD.DL = {
	shield = "Downtown Loop %route%.svg",
	name = "Interstate %route% Downtown Loop",
	link = "Interstate %route% Downtown ([dab||%dab%, |]South Dakota)",
	abbr = "I-%route% Dwtn.",
	width = "expand",
	nbrowse = SD.I.nbrowse,
	nbrowselinks = SD.I.nbrowselinks,
	bannersuffix = "green"
}

SD.DS = {
	shield = "Downtown Spur %route%.svg",
	name = "Interstate %route% Downtown Spur",
	link = SD.DL.link,
	abbr = SD.DL.abbr,
	width = "expand",
	nbrowse = SD.I.nbrowse,
	nbrowselinks = SD.I.nbrowselinks,
	bannersuffix = "green"
	
}

SD.US.name = "U.S. Highway %route%"
SD.US.link = {
	["14A"] = "U.S. Route 14A (South Dakota)",
	["16A"] = "U.S. Route 16A",
	default = "U.S. Route %route% in South Dakota"
}
SD.US.law = SD.I.law

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

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

SD.SD = {
	shield = "SD %route%.svg",
	base = "South Dakota Highway %route%",
	name = "Highway %route%",
	link = "South Dakota Highway %route%" .. suffix2,
	abbr = "SD %route%",
	width = "expand",
	law = SD.I.law
}

for _,type in ipairs({"SD"}) do
	for _,year in ipairs({"1926", "1950", "1960"}) do
		SD["SD " .. year] = {
			shield = format("SD %%route%% (%s).svg", year),
			name = SD.SD.name,
			link = SD.SD.link,
			abbr = SD.SD.abbr,
			width = "square"
		}
	end
end

for _,type in ipairs({'SD'}) do
	for _,auxType in ipairs({"Bus", "Spur", "Truck"}) do
		local spec = SD[" aux "][auxType]
		SD[type .. "-" .. auxType] = {
		    shield = SD.SD.shield,
		    name = SD.SD.name .. " " .. spec.name,
		    link = SD.SD.base .. " " .. spec.name .. suffix2,
		    abbr = SD.SD.abbr .. " " .. spec.abbrsuffix,
		    banner = spec.bannerprefix .. " plate South Dakota.svg",
		    aux = spec.aux,
		    width = "expand"
		}
	end
end

SD["SD 1960-Spur"] = {
	shield = SD["SD 1960"].shield,
	name = SD["SD-Spur"].name,
	link = SD["SD-Spur"].link,
	abbr = SD["SD-Spur"].abbr,
	banner = "Spur plate.svg",
	width = square
}

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

SD.BIA = {
	shield = "Indian Route&nbsp;%route%.svg",
	name = "BIA Route&nbsp;%route%",
	link = "",
	abbr = "BIA Route&nbsp;%route%"
}
	
SD.IA = {alias = {module = "USA/IA", type = "IA"}}
SD.MN = {alias = {module = "USA/MN", type = "MN"}}	 
SD.MT = {alias = {module = "USA/MT", type = "MT"}}
SD.ND = {alias = {module = "USA/ND", type = "ND"}}
SD.NE = {alias = {module = "USA/NE", type = "NE"}}	 
SD.WY = {alias = {module = "USA/WY", type = "WY"}}           

return SD