local p = {};
local getArgs = require('Module:Arguments').getArgs
function p.main(frame)
local args = getArgs(frame) return p.iconify(args)
end
function p.iconify(args)
local icon = mw.ustring.lower(args.icon)
icon = mw.ustring.gsub(icon, "-", "_") icon = mw.ustring.gsub(icon, "'", "")
icon = args.image or mw.ustring.format("%s %s.png", args.group, icon)
local width = args.width or "24px" local link = args.link or args.icon local extra = args.extra and "|" .. args.extra or ""
local ic = mw.ustring.format("%s%s", icon, link, width, extra)
if args.mod ~= nil then ic = mw.ustring.format("%s %s", ic, args.mod) end
if args.text == "link" then ic = mw.ustring.format("%s %s", ic, link, args.icon) elseif args.text == "nosp" then ic = ic .. args.icon -- no space, so no need for format elseif args.text == nil then ic = mw.ustring.format("%s %s", ic, args.icon) end
return ic
end
return p