Module:Infobox road/meta/mask/subtype2
MyWikiBiz, Author Your Legacy — Wednesday November 27, 2024
Jump to navigationJump to searchDocumentation for this module may be created at Module:Infobox road/meta/mask/subtype2/doc
local p = {} local subtypeDefaults = {Alt = "Alternate", Bus = "Business", Byp = "Bypass", Conn = "Connector", Emerg = "Emergency", Loop = "Loop", Old = "Old", Opt = "Optional", Scenic = "Scenic", Spur = "Spur", Temp = "Temporary", Toll = "Toll", Truck = "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 args.subtype local subtypes = {} subtypes.Alt = args.alt subtypes.Bus = args.bus subtypes.Byp = args.byp subtypes.Conn = args.con subtypes.Emerg = args.eme subtypes.Loop = args.lop subtypes.Old = args.old subtypes.Opt = args.opt subtypes.Scenic = args.sce subtypes.Spur = args.spr subtypes.Temp = args.tmp subtypes.Toll = args.tol subtypes.Truck = args.trk return p._subtype(subtype, subtypes) or '' end return p