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

-- Michigan
local MI = {}

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

local suffix = " ([dab||%dab%, |]Michigan)"
local special = " ([dab||%dab%, Michigan|Michigan highway])"

MI.I.link =  {
	["96"] = "Interstate 96",
	["196"] = "Interstate 196",
	["296"] = "Interstate 296",
	["496"] = "Interstate 496",
	["696"] = "Interstate 696",
	["94N"] = "Interstate 94N",
	default = {hook = "split",
		split = 100,
		above = "Interstate %route% (Michigan)",
		below = "Interstate %route% in Michigan"
	}
}

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

for k, v in pairs(MI) do if k:find ("^I %d") then 
	v.shield = v.shieldmain
	end
end



MI.BL.link = MI.I.base .. " Business" .. suffix
MI.BL.abbr = "BL " .. MI.I.abbr
MI.BL.name = "Business Loop " .. MI.I.base

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

MI.BS.link = MI.I.base .. " Business" .. suffix
MI.BS.abbr = "BS " .. MI.I.abbr
MI.BS.name = "Business Spur " .. MI.I.base

for k, v in pairs(MI) do if k:find ("^BS") then 
	v.link = MI.BS.link
	v.abbr = MI.BS.abbr
	v.name = MI.BS.name
	end
end

MI.US.name = "US Highway %route%"
MI.US.link = {
	["8"] = "U.S. Route 8",
	["102"] = "U.S. Route 102",
	["112"] = "U.S. Route 112",
	["131"] = "U.S. Route 131",
	["141"] = "U.S. Route 141",
	["223"] = "U.S. Route 223",
	default ="U.S. Route %route% in Michigan"
}

for k, v in pairs(MI) do if k:find ("^US %d") then 
	v.shield = v.shieldmain
	v.name = MI.US.name
	v.link = MI.US.link
	end
end
MI["US 1961"] = MI["US 1948"] -- MI did not use the 1961 version and continued to use the 1948

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

for _,auxType in ipairs({"Alt"}) do
	local spec = MI[" aux "][auxType]
		for k, v in pairs(MI) do if k:find (auxType) then if k:find ("^US") then
			v.shield = "US %route%A.svg"
			v.name = MI.US.name .. "A"
			v.link = MI.US.base .. "A [dab||(%dab%,  Michigan)|in Michigan]"
			v.base = spec.abbrsuffix .. MI.US.abbr
			v.abbr = MI.US.abbr .. "A"
			v.banner = ""
			end
		end
	end
end

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

for _,year in ipairs({'1926', '1948'}) do
	for _,auxType in ipairs({"Alt"}) do
		local type = "US " .. year
		local spec = MI[" aux "][auxType]
		MI[type .. "-".. auxType] = {
			shield = format("US %%route%%A Michigan %s.svg", year),
			name = MI[type].name .. "A",
			link = MI[type].base .. " " .. spec.name .. suffix,
			abbr = MI[type].abbr .. "A",
			aux = spec.aux,
			width = "square",
		}
	end
end
MI["US 1961-Alt"] = MI["US 1948-Alt"]
MI["US 1961-Bus"] = MI["US 1948-Bus"]
MI["US 1961-Byp"] = MI["US 1948-Byp"]
MI["US 1961-Conn"] = MI["US 1948-Conn"]
MI["US 1961-Spur"] = MI["US 1948-Spur"]
MI["US 1961-Truck"] = MI["US 1948-Truck"]

MI.M = {
	base = "M-%route%",
	shield =   {
		["185"] = "M-185 (MISPC).svg",
		["331"] = "",
		["554"] = "",
		default = {
			hook = "split",
			split = 100,
			above = "M-%route% rectangle.svg",
		below = "M-%route%.svg"
		}
	},
	name = "M-%route%",
	link = "M-%route% ([dab||%dab% |]Michigan highway)",
	abbr = "M-%route%",
	width = "expand"
}
MI.MI = MI.M

for _,year in ipairs({"1919", "1926", "1948", "1973"}) do
	MI["M " .. year] = {
		shield = format("M-%%route%% %s.svg", year),
		base = MI.M.base,
		name = MI.M.name,
		link = MI.M.link,
		abbr = MI.M.abbr,
		width = "square",
	}
end

MI["M 1973"].shield = {
	["185"] = "M-185 (MISPC).svg",
	["331"] = "",
	["554"] = "",
	default ="M-%route%.svg"
	
}

MI["Capitol Loop"] = {
	shield = "CapitolLoop.svg",
	link = "Capitol Loop",
	abbr = "Capitol Loop",
	bannersuffix = "green"}

for _,type in ipairs({'M'}) do
	for _,auxType in ipairs({"Alt", "Bus", "Byp", "Conn", "Spur", "Truck"}) do
		local spec = MI[" aux "][auxType]
		MI[type .. "-" .. auxType] = {
			shield = MI[type].shield,
			shieldmain = MI[type].shieldmain,
			name = spec.name .. " " .. MI[type].name,
			link = MI[type].base .. " " .. spec.name .. " ([dab||%dab%, Michigan|Michigan highway])",
			abbr = spec.abbrsuffix .. " " .. MI[type].abbr,
			banner = spec.bannerprefix .. " plate.svg",
			aux = spec.aux,
			width = "expand",
		}
	end
end

for _,year in ipairs({'1926', '1948'}) do
	for _,auxType in ipairs({"Alt", "Bus", "Byp", "Conn", "Spur", "Truck"}) do
		local type = "M " .. year
		local spec = MI[" aux "][auxType]
		MI[type .. "-" .. auxType] = {
			shield = MI[type].shield,
			shieldmain = MI[type].shieldmain,
			name = spec.name .. " " .. MI[type].name,
			link = MI[type].base .. " " .. spec.name .. " ([dab||%dab%, Michigan|Michigan highway])",
			abbr = spec.abbrsuffix .. " " .. MI[type].abbr,
			banner = spec.bannerprefix .. " plate " .. year .. ".svg",
			aux = spec.aux,
			width = "square",
		}
	end
end
MI["MI-Alt"] = MI["M-Alt"]
MI["MI-Bus"] = MI["M-Bus"]
MI["MI-Byp"] = MI["M-Byp"]
MI["MI-Conn"] = MI["M-Conn"]
MI["MI-Spur"] = MI["M-Spur"]
MI["MI-Truck"] = MI["M-Truck"]

MI.Connector = {
	shield = "No image.svg",
	name = "Connector %route%",
	link = "Connector %route% (Michigan highway)",
	abbr = "Connector %route%"
}

MI.NSB.shieldmain = {
	["River Road National Scenic Byway"] = {"MUTCD D6-4.svg", "National Forest Scenic Byway.svg"},
	default = "MUTCD D6-4.svg"
}
MI.NSB.orientation = "upright"

MI.BlankM = {
	shield = "No image.svg",
	name = MI.M.name,
	link = MI.M.link,
	abbr = MI.M.abbr
}

MI["BlankM-Conn"] = {
	shield = MI.BlankM.shield,
	name = MI["M-Conn"].name,
	link = MI["M-Conn"].link,
	abbr = MI["M-Conn"].abbr
}

MI["BlankUS-Bus"] = {
	shield = MI.BlankM.shield,
	name = MI["US-Bus"].name,
	link = MI["US-Bus"].link,
	abbr = MI["US-Bus"].abbr,
	width = "expand"
}

MI["BlankUS-Conn"] = {
	shield = MI.BlankM.shield,
	name = MI["US-Conn"].name,
	link = MI["US-Conn"].link,
	abbr = MI["US-Conn"].abbr,
	width = "expand"
}

-- add new types above this line if you want it to have the state highway browse and maint
for k, v in pairs(MI) do if k:find ("^%a") then
	v.maint = "[[密西根州交通部|MDOT]]"
	v.browse = "[[密歇根州公路幹線系統]]"
	v.browselinks = {
		[1] = "[[密歇根州州際公路一覽|Interstate]]",
		[2] = "[[密歇根州國道一覽|US]]",
		[3] = "[[密歇根州公路幹線一覽|State]]",
		[4] = "[[密歇根州間道|Byways]]"
	}
	end
end

MI.CDH = {
	shield = "County %route%.svg",
	shieldmain = {
		["H-13"] = {"County %route%.svg", "Forest Route 13.svg"},
		default = "County %route%.svg"
	},
	link = "%route% (Michigan county highway)",
	abbr = "%route%",
	bannersuffix = "county",
	color = {
		arg = "route",
		["H-13"] = "hist",
		default = "MUTCDgreen"
	},
	browse = "[[List of county-designated highways in Michigan|County-Designated Highways]]",
	browselinks = ""
}

MI.CR.shield = "Michigan %route% %county% County.svg"
MI.CR.shieldmain = MI.CR.shield
MI.CR.link = {
	ifexists = true,
	default = "County Road %route% (%county% County, Michigan)"}
MI.CR.bannersuffix = {arg = "county",
	default    = "",
	Gogebic      = "county"}
MI.CR.browse = "%county% County Roads"
MI.CR.browselinks = ""

MI.WI = {alias = {module = "USA/WI", type = "WI"}}
MI["US-WI"] = {alias = {module = "USA/WI", type = "US"}}	
MI.IN = {alias = {module = "USA/IN", type = "IN"}}
MI["US-IN"] = {alias = {module = "USA/IN", type = "US"}}	
MI.OH = {alias = {module = "USA/OH", type = "OH"}}
MI["US-OH"] = {alias = {module = "USA/OH", type = "US"}}
MI.ON = {alias = {module = "CAN/ON", type = "ON"}}

return MI