Module:SB Infobox Begin Test
Jump to navigation
Jump to search
Documentation for this module may be created at Module:SB Infobox Begin Test/doc
local getArgs = require('Module:Arguments').getArgs
local p = {}
local function switch_key_val(tbl)
local rtbl = {}
for k,v in pairs(tbl) do
rtbl[v] = k
end
return rtbl
end
function p.main(frame)
local args = getArgs(frame)
return p._main(args)
end
function p.section(frame)
local args = getArgs(frame)
local remap = switch_key_val(args)
return p._section(remap)
end
function p._section(args)
local output = ""
for k,v in pairs(args) do
local newRow = mw.html.create('div')
:addClass('SB-Infobox-Data-Cell')
newRow:tag('div')
:addClass('SB-Infobox-Cell-Header')
:wikitext(v)
newRow:tag('div')
:addClass('SB-Infobox-Cell-Body')
:wikitext(k)
output = newRow .. output
end
return string.gsub(output, "(<-- Begin -->)", "%1<div class='wrapper'></div>", 1)
end
function p._main(args)
local output = ""
for k,v in pairs(args) do
output = output .. v
end
return output
end
return p