Anonymous

Module:Equipment/Recommended: Difference between revisions

From Melvor Idle
m
padding only when compact
mNo edit summary
m (padding only when compact)
Line 37: Line 37:
table.sort(slots, function(a, b) return a.placement < b.placement end)
table.sort(slots, function(a, b) return a.placement < b.placement end)
local function make_row(slot, data)
local function make_row(slot, data, compact)
local tr = mw.html.create('tr')
local tr = mw.html.create('tr')
tr:tag('td'):attr('style', 'padding-bottom: 4px;'):wikitext(string.format('[[File:%s.png|%s|link=%s|36px]]', slot.icon, slot.txt, slot.link))
local sloticon = tr:tag('td')
sloticon:wikitext(string.format('[[File:%s.png|%s|link=%s|36px]]', slot.icon, slot.txt, slot.link))
if compact then
sloticon:attr('style', 'padding-bottom: 4px;')
end
for _, v in ipairs(data) do
for _, v in ipairs(data) do
local itemicon = icons.Icon({v, img=v, type='item'})
local itemicon = icons.Icon({v, img=v, type='item'})
tr:tag('td'):attr('style', 'padding-left: 12px;'):wikitext(itemicon)
local gearname = tr:tag('td'):wikitext(itemicon)
if compact then
gearname:attr('style', 'padding-left: 12px;')
end
end
end
Line 76: Line 83:
end
end


local compact = true
if args.noheader == nil then
if args.noheader == nil then
compact = false
parent:addClass('wikitable')
parent:addClass('wikitable')
parent:tag('tr')
parent:tag('tr')
Line 93: Line 102:
if #row_data > 0 or args.showall then
if #row_data > 0 or args.showall then
parent:node(make_row(v, row_data))
parent:node(make_row(v, row_data, compact))
end
end
end
end
892

edits