可在Module:Icon/doc创建此模块的帮助文档
local p = {}
function p.icon(icon, text, width)
local mIcon = mw.loadData("Module:Icon/list")[icon:lower()]
if not mIcon then
return "<span style=\"color: red; font-size: 11px;\">(unrecognized string \"" .. icon .. "\" for [[Module:Icon]])</span>[[Category:Pages with unrecognized icon strings]]"
end
width = width or mIcon.width or "22px"
if text == 1 then
text = mIcon.caption
elseif text == "" then
text = nil
end
local f = "[[File:%s.png|link=%s|%s|%s]]"
local t = "[[%s|%s]]"
f = string.format(f, mIcon.file, mIcon.link, mIcon.caption, width)
if text then
t = string.format(t, mIcon.link, text)
return f .. t
end
return f
end
return p