پودمان:Infobox road/meta/mask/subtype2

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

local subtypeDefaults = {Alt = "جایگزین", Bus = "تجاری", Byp = "کنارگذر", Conn = "رابط", Emerg = "اضطراری", Loop = "کمربندی", Old = "قدیمی",
                         Opt = "انتخابی", Scenic = "توریستی", Spur = "اختصاصی", Temp = "موقت", Toll = "عوارضی", Truck = "ترابری"}

function p._subtype(subtype, subtypes)
    setmetatable(subtypes, {__index = subtypeDefaults})
    return subtypes[subtype]
end

function p.subtype(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 subtype = config.subtype or config['زیرنوع'] or args.subtype or args['زیرنوع']
    local subtypes = {}
    subtypes.Alt = args.alt or args['جایگزین']
    subtypes.Bus = args.bus or args['اتوبوس']
    subtypes.Byp = args.byp or args['کنارگذر']
    subtypes.Conn = args.con or args['رابط']
    subtypes.Emerg = args.eme or args['اضطراری']
    subtypes.Loop = args.lop or args['کمربندی']
    subtypes.Old = args.old or args['قدیمی']
    subtypes.Opt = args.opt or args['اختیاری']
    subtypes.Scenic = args.sce or args['توریستی'] or args['خوش‌منظره']
    subtypes.Spur = args.spr or args['اختصاصی']
    subtypes.Temp = args.tmp or args['موقت']
    subtypes.Toll = args.tol or args['عوارضی']
    subtypes.Truck = args.trk or args['ترابری']
    
    return p._subtype(subtype, subtypes) or ''
end

return p