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

-- New Mexico
local NM = {}

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

local suffix = " ([dab||%dab%, |]New Mexico)"

NM.I.link = "Interstate %route% (New Mexico)"

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

NM.BL.link = "Interstate %route% Business ([dab||%dab%, |]New Mexico)"

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

NM.US.name = "U.S. Highway %route%"
NM.US.link = "U.S. Route %route% in New Mexico"

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

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

NM["US-Hist"].shield = "US %route% (NM historic).svg"
NM["US-Hist"].link = NM.US.link

NM.NM = {
	base = "New Mexico State Road %route%",
	shield = "New Mexico %route%.svg",
	name = "State Road %route%",
	link = "New Mexico State Road %route% [dab||(%dab%)|]",
	abbr = "NM&nbsp;%route%",
	orientation = "upright"
	
}

for _,year in ipairs({"1926", "1932", "1952"}) do
	NM["NM " .. year] = {
		shield = format("New Mexico %%route%% %s.svg", year),
		name = NM.NM.name,
		link = NM.NM.link,
		abbr = NM.NM.abbr,
		width = "square",
	}
end

NM.FR = {shield = "",
		 name = "Frontage Road %route%",
		 link = "List of frontage roads in New Mexico#FR&nbsp;%route%",
		 abbr = "FR %route%"}

NM.SBR = {
	shield = "NM bike %route%.svg",
	name = "New Mexico State Bike Route %route%",
	link = "New Mexico State Bike Route %route%",
	abbr = "SBR&nbsp;%route%",
	orientation = "upright"
}

-- add new types above this line if you want it to have the state highway browse and maint
for k, v in pairs(NM) do if k:find ("^%a") then
	v.maint = "[[New Mexico Department of Transportation|NMDOT]]"
	v.browse = "State Roads in New Mexico"
	v.browselinks = {
		[1] = "[[List of Interstate Highways in New Mexico|Interstate]]",
		[2] = "[[List of U.S. Routes in New Mexico|US]]",
		[3] = "[[List of state roads in New Mexico|State]]",
		[4] = "[[New Mexico Scenic and Historic Byway|Scenic]]"
	}
	end
end

for k, v in pairs(NM) do if k:find ("^%a+ %d") then 
	v.maint = "[[New Mexico State Highway Department]]"
	end
end

         
NM.CR.shield = {
	arg = "county",
	default = "CR %route% jct.svg",
	["Doña Ana"] = ""
}
NM.CR.maint = ""

return NM