Module:Render/sandbox

local wikiSafeName = require('Module:LinkUtils').wikiSafeName local p = {}

function p.icon(file, name, link, rare, type, size, count, classes, content, inline) size = size or 128 local padding = math.floor(size*14/128) size = size - padding inline = inline and 'span' or 'div' local sb = mw.html.create(inline) :addClass('item-icon') if classes ~= nil then sb:addClass(classes) end local img = sb:tag(inline) :addClass('img') :addClass('x-'..(rare or 0)) :addClass('y-'..(type or 0)) :css('width', size..'px') :css('height', size..'px') :css('padding', (padding/2)..'px') if count ~= nil then img:tag(inline) :addClass('item-count') :wikitext('×'..count) end img:wikitext(string.format( ,     file or , size, name and name ~=  and '|'..wikiSafeName(name) or , link and link ~=  and '|link='..wikiSafeName(link) or  ))	if content ~= nil then sb:wikitext(content) end return tostring(sb) end

return p