local p = {}
local insert = table.insert
local jctTypeData = {["Hwy"] = "Hwy", ["Highway"] = "Hwy", ["Sudbury"] = "MR",
["SB"] = "MR", ["Greater Sudbury"] = "MR", ["GS"] = "MR",
["Muskoka"] = "DR", ["Durham"] = "RR", ["Hamilton"] = "RR",
["Halton"] = "RR", ["Niagara"] = "RR", ["Peel"] = "RR",
["Ottawa"] = "RR", ["Waterloo"] = "RR", ["York"] = "RR",
["KL"] = "KLR", ["Kawartha Lakes"] = "KLR", ["Durham Regional Highway"] = "RR",
["DRH"] = "RR"}
local regionData = {Hwy = '', Highway = ''}
function p.jcon(frame)
local args = frame:getParent().args
local type = args[1] or ''
if type == '' then return end
local route1 = args[2] or ''
if route1 == '' then return end
local route2 = args.con or ''
local route3 = args.con2 or ''
local jctType = jctTypeData[type] or 'CR'
local region = regionData[type] or type
local jctCall = {"{{jct", "province=ON", jctType, route1}
if region ~= '' then
insert(jctCall, "county=" .. region)
end
if route2 ~= '' then
insert(jctCall, jctType)
insert(jctCall, route2)
end
if route3 ~= '' then
insert(jctCall, jctType)
insert(jctCall, route3)
end
-- Add direction and location stuff
return table.concat(jctCall, "|") .. "}}"
end
return p