Module:S5EnemyLocationTable
From Gensopedia
More actions
Documentation for this module may be created at Module:S5EnemyLocationTable/doc
local p = {}
function p.render(frame)
local args = frame.args
-- if there’s no location_1, show the default single-line text
if not args['location_1'] or args['location_1'] == '' then
return args['location'] or 'Deep Twilight Forest Ruins (Chapter 5)'
end
-- build the table
local tbl = mw.html.create('table')
:css('width', '100%')
:css('height', '100%')
:css('border-collapse', 'collapse')
:css('table-layout', 'fixed')
-- header row
local header = tbl:tag('tr')
header:tag('th')
:css('width', '20%')
:wikitext('Chapter')
header:tag('th')
:wikitext('Area')
-- data rows
for i = 1, 6 do
local location = args['location_' .. i]
if location and location ~= '' then
local row = tbl:tag('tr')
row:tag('td'):wikitext(args['ch_' .. i] or '')
row:tag('td'):wikitext(location)
end
end
return tostring(tbl)
end
return p