Module:Variable tables

local p = {} local util = require('Module:Util') local abb = require('Module:Abb/data')

function p.documentationTable(frame) args = frame.args rowCounter = 1 dataTable = mw.html.create('table') dataTable:addClass('article-table') :tag('tr') :tag('th') :wikitext('Parent parameter') :done :tag('th') :wikitext('Child parameters') :done :tag('th') :wikitext('Description') :done :done for k, v in ipairs(args) do		rowData = mw.text.split(v, ';;\n') dataRow = mw.html.create('tr') dataRow:tag('th') :wikitext(rowData[1]) :done :tag('td') :wikitext(rowData[2]) if rowData[3] ~= nil then if rowData[4] ~= nil then dataRow:tag('td') :attr('rowspan', rowData[4]) :wikitext(rowData[3]) else dataRow:tag('td') :wikitext(rowData[3]) end end dataTable:node(dataRow) end return dataTable end

function p.creditsTable(frame) args = frame.args dataTable = mw.html.create('table') dataTable:addClass('va-employment-history va-table va-table-full-ib va-table-top va-table-left va-table-shaded') :tag('tr') :tag('th') :css('width', '16%') :wikitext('Year') :done :tag('th') :wikitext('Title') :css('width', '42%') :done :tag('th') :wikitext('Credited as/for') :css('width', '42%') :done :done for k,v in ipairs(args) do		if string.find(v, ';;\n;;\n') == nil then rowData = mw.text.split(v, ';;\n') title = util.trim(rowData[2]) if abb[title] then abr = abb[title] for k2, v2 in pairs(abr) do mw.log('k: ' .. k2 .. 'v: ' .. v2 .. '\n') end title = '\'\ .. abr.link				end				title = title .. '\'\ end dataRow = mw.html.create('tr') dataRow:tag('td') :css('text-align', 'center') :wikitext(rowData[1]) :done :tag('td') :tag('i') :wikitext(title) :done :done :tag('td') :wikitext(rowData[3]) :done :done dataTable:node(dataRow) end end return (dataTable) end

function p.creditsTableWt(frame) args = frame.args dataTable = '{| class="va-employment-history va-table va-table-full-ib va-table-top va-table-left va-table-shaded" style="width:50%; font-size:0.8em"\n' .. '! style = "padding: 5px; line-height:1.2em; width: 16%; display: sticky; top:40px; | Year !! style = "padding: 5px; line-height:1.2em; width: 42%; display: sticky; top:40px; | Title !! style = "padding: 5px; line-height:1.2em; width: 42%; display: sticky; top:40px; | Credited as/for\n|-\n'	line = 1	for k,v in ipairs(args) do		if string.find(v, ';;\n;;\n') == nil then			series = false			rowData = mw.text.split(v, ';;\n')			title = util.trim(rowData[2])			if abb[title] then				for k, v in pairs(abb[title]) do					mw.log('k: ' .. k .. 'v: ' .. v)				end				title = '\'\'\' '.. abb[title].title .. '\'\'\''				series = true			end			extraCss = 'padding: 5px; line-height:1.2em; '			if series then				if line%2 ~= 0 then					extraCss = extraCss .. 'background: #222240;'				else					extraCss = extraCss .. 'background: #111132;'				end			end			dataRow = '| style = "text-align: center;' .. extraCss ..'" | ' .. string.gsub(rowData[1], '\n', '') .. 			' || style = "' .. extraCss .. '" | \'\'' .. title .. '\'\' || style = "' .. extraCss .. ' | ' .. rowData[3] .. '\n|-\n' dataTable = dataTable .. dataRow line = line + 1 end end return (dataTable .. '|}') end

return p