Module:Jct/shields

From Wikipedia

Documentation for this module may be created at Module:Jct/shields/doc

local p = {}

local shields = {}
do -- Shield definitions
    function shields:shield(args)
        local country = self[args.country]
        return country and country:shield(args) or ''
    end
    do
        local USA = require "Module:Jct/shields/USA"
        shields["USA"] = USA.shields
    end
end -- Shield definitions

p.shields = shields

function p._shield(args)
    return shields:shield(args)
end

function p.shield(frame)
    local pframe = frame:getParent()
    local config = frame.args -- the arguments passed BY the template, in the wikitext of the template itself
    local args = pframe.args -- the arguments passed TO the template, in the wikitext that transcludes the template
    
    local state = config.state or args.state
    local type = config.type or args.type
    local subtype = config.subtype or args.subtype or nil
    local route = args.num or args.route or config.route or config.num or "{{{num}}}"
    local country = "USA"
    return p._shield{country=country, state=state, type=type, route=route, subtype=subtype}
end

return p