Module:S5TechniqueTable
From Gensopedia
More actions
Documentation for this module may be created at Module:S5TechniqueTable/doc
local p = {}
function p.render(frame)
-- Create outer table
local tbl = mw.html.create('table')
:addClass('table')
:css('border', '1px solid #0077c0')
-- Add identifying class for CSS
tbl:addClass('attacktable-responsive')
-- Header row
local headerRow = tbl:tag('tr')
local headers = {
{ text = 'Name', width = '35%', border = 'border-top-left-radius:0;' },
{ text = 'Type', width = '10%' },
{ text = 'Element', width = '10%' },
{ text = 'Target', width = '10%' },
{ text = 'Effect', width = '35%', border = 'border-top-right-radius:0;' }
}
for _, h in ipairs(headers) do
headerRow:tag('th')
:addClass('header')
:cssText(h.border or '')
:css('width', h.width)
:css('text-align', 'center')
:wikitext(h.text)
:done()
end
-- Collect rows
for i = 1, 7 do
local attack = frame.args['attack_' .. i]
if attack and attack ~= '' then
local r = tbl:tag('tr')
r:tag('td'):wikitext(attack or 'Attack ' .. i)
r:tag('td'):wikitext(frame.args['type_' .. i] or 'Physical')
r:tag('td'):wikitext(frame.args['element_' .. i] or 'Darkness')
r:tag('td'):wikitext(frame.args['range_' .. i] or 'Single')
r:tag('td'):wikitext(frame.args['effect_' .. i] or '—')
end
end
return tostring(tbl)
end
return p