Module:ButtonBox
Appearance
Documentation for this module may be created at Module:ButtonBox/doc
local p = {}
function p.buttonbox()
local query = mw.ext.cargo.query(
"avatars",
"name, image, link, label",
{
limit = 100,
orderBy = "name"
}
)
local out = {}
table.insert(out, '{| class="buttonbox"')
local out = {}
table.insert(out, '{| class="buttonbox"')
for i, row in ipairs(query) do
if (i - 1) % 4 == 0 then
table.insert(out, '|-')
end
local image = row.image
local label = row.label or row.name
local link = row.link or ("[[User:" .. row.name .. "]]")
local cell = '| <div class="buttonbox-entry">'..image..'<div class="buttonbox-label">'..label..'</div> </div>'
table.insert(out, cell)
end
table.insert(out, '|}')
return table.concat(out, '\n')
end
return p