More actions
This module is used by Template:Size to match the supplied argument to the formatted size tag string.
The main function getSize
accepts the first argument passed to Template:Size and returns the formatted size tag.
local p = {}
local getArgs = require('Module:Arguments').getArgs
function p.getSize(frame)
-- Get arguments from the invoke
-- frameOnly is used to ignore additional arguments passed when
-- Template:Size is called from an infobox, for example
local args = getArgs(frame, {frameOnly = true})
-- Pass arguments to the helper function
size = p._getSize(args)
return size
end
function p._getSize(args)
-- Take the arg as the size tag label
sizeTag = args[1]
size = ""
-- Match the tag to the proper formatted string to display
if sizeTag == "XS" then size = "<code><b><font color=#E04949>XS</font></b></code>" end
if sizeTag == "SM" then size = "<code><b><font color=#E0A400>SM</font></b></code>" end
if sizeTag == "MD" then size = "<code><b><font color=#93E000>MD</font></b></code>" end
if sizeTag == "LG" then size = "<code><b><font color=#00E0A8>LG</font></b></code>" end
if sizeTag == "XL" then size = "<code><b><font color=#49ABE0>XL</font></b></code>" end
if sizeTag == "2X" then size = "<code><b><font color=#A978DA>2X</font></b></code>" end
return size
end
return p