require('strict')
local getArgs = require('Module:Arguments').getArgslocal p =
local function usedRow(args, maxLine) local usedRow = for lineNum = 1, 3 do -- rowHeader has 3 items local row = string.char(lineNum + 64) -- 1 => 'A', 2 => 'B' for line = 1, maxLine do if args[line .. row] then table.insert(usedRow, row) break end end end return usedRowend
local function row(builder, args, usedRow, line) if args[line]
'left' then colspan = colspan + 1 else break end end local td = tr:tag('td') if string.lower(text)
local function abbr(full_text, abbreviation) return string.format('%s', full_text, abbreviation)end
function p._main(args) -- Main module code goes here. local builder = mw.html.create('table') local maxLine = 24 local usedRow = usedRow(args, maxLine) local rowHeader =
builder :addClass('video-game-release-table wikitable plainrowheaders floatright') :css('text-align', 'center') local title = if args.title and args.title ~= then title = args.title else title = 'Release years by platforms' end builder:tag('caption'):wikitext(title) local tr = builder:tag('tr')
tr:tag('th'):attr('scope', 'col'):wikitext('Platform') for _, row in ipairs(usedRow) do if args['region' .. row] then rowHeader[row] = args['region' .. row] end tr:tag('th'):wikitext(rowHeader[row]):attr('scope', 'col') end for line = 1, maxLine do row(builder, args, usedRow, line) end return builderend
function p.main(frame) local args = getArgs(frame) return p._main(args)end
return p