پرش به محتوا

پودمان:Infobox road/link/USA

از ویکی‌پدیا، دانشنامهٔ آزاد
توضیحات پودمان[ایجاد] [پاکسازی]
local p = {}

local typesModule = require "Module:Infobox road/link/defs"
Country = typesModule.Country
Type = typesModule.Type
Link = typesModule.Link

local Preprocessors = {}

do
    local statesData = mw.loadData("Module:U.S. States/data")
    local mapping = statesData.stateName
    function stateName(state)
        return mapping[state]
    end
end

local ArgsMeta = {}
function ArgsMeta.__index(t, key)
    if key == "stateName" then
        local state = t.state or ''
        local stateName = stateName(state)
        t.stateName = stateName
        return stateName
    end
end

local links = Country:new{argsmeta = ArgsMeta}
do -- Link definitions
    do -- Interstates
        local type = Link:new{formatStr = "Interstate %route% [stateName||in %stateName%|]"}
        links["I"] = type
        links["Interstate"] = type
        links["I 1957"] = type
        links["Future"] = type
    end -- Interstates
    
    do -- U.S. Routes
        local type = Link:new{formatStr = "U.S. Route %route% [stateName||in %stateName%|]"}
        links["US"] = type
        links["US 1926"] = type
        links["US 1948"] = type
        links["US 1950"] = type
    end -- U.S. Routes
    
    links["NER"] = Link:new{formatStr = "New England Interstate Route %route%"} -- New England Interstate Routes
    
end -- Link definitions

p.links = links
return p