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

--Rhode Island

local util = require("Module:Road data/util")
local RI = require("Module:Road data/strings/USA")

local suffix = " ([dab||%dab%, |]Rhode Island)"

RI.I.link = {
	["95E"] = "Interstate 95E  (Rhode Island)",
    ["184"] = "Interstate 184  (Rhode Island)",
    default = {
    	hook = "splitlen",
    	split = 3,
    	above = RI.I.base .. " (Rhode Island–Massachusetts)",
        below = RI.I.base .. " in Rhode Island"
    	}
	}

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

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

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

RI.US.link = {
	["6A"] = RI.US.base .. " (Rhode Island)",
    ["44A"] = RI.US.base .. " (Rhode Island)",
    default = RI.US.base .. " in Rhode Island"
	}

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

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

RI.RI = {
	shield = "Rhode Island %route%.svg",
	shieldmain = {
		["15"] = {"Rhode Island %route%.svg", "MA Route %route%.svg"},
		["78"] = {"Rhode Island %route%.svg", "Connecticut Highway %route%.svg"},
		["96"] = {"Rhode Island %route%.svg", "MA Route %route%.svg"},
		["114A"] = {"Rhode Island %route%.svg", "MA Route %route%.svg"},
		["177"] = {"Rhode Island %route%.svg", "MA Route %route%.svg"},
		default = "Rhode Island %route%.svg"
	},
	name = "Route %route%",
	link = "Rhode Island Route %route%" .. RI[" dab "],
	abbr = "Route&nbsp;%route%"
}

RI.Route = RI.RI

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

return RI