Difference between revisions of "Module:SB Infobox Begin"
Jump to navigation
Jump to search
m |
m |
||
Line 17: | Line 17: | ||
function p.section(frame) | function p.section(frame) | ||
local args = getArgs(frame) | local args = getArgs(frame) | ||
local remap = switch_key_val(args) | --local remap = switch_key_val(args) | ||
return p._section(args) | return p._section(args) | ||
end | end | ||
Line 24: | Line 24: | ||
local output = "" | local output = "" | ||
local s = '' | local s = '' | ||
mw.log('error message') | |||
for _,t in ipairs(args) do | for _,t in ipairs(args) do | ||
if type(t) == 'table' then | if type(t) == 'table' then | ||
Line 33: | Line 33: | ||
return type(t) .. ' ' .. tostring(t) | return type(t) .. ' ' .. tostring(t) | ||
end | end | ||
s = 'yay' | |||
end | end | ||
return s | return s |
Revision as of 09:57, 25 May 2021
Documentation for this module may be created at Module:SB Infobox Begin/doc
local getArgs = require('Module:Arguments').getArgs
local p = {}
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(args)
end
function p._section(args)
local output = ""
local s = ''
mw.log('error message')
for _,t in ipairs(args) do
if type(t) == 'table' then
for k, v in pairs(t) do
s = s .. tostring(k) .. ' = ' .. tostring(v) .. '\n'
end
else
return type(t) .. ' ' .. tostring(t)
end
s = 'yay'
end
return s
--[[local newRow = mw.html.create('div')
:addClass('SB-Infobox-Data-Cell')
newRow:tag('div')
:addClass('SB-Infobox-Cell-Header')
:wikitext(tostring(t))
newRow:tag('div')
:addClass('SB-Infobox-Cell-Body')
:wikitext(tostring(t))
output = output .. tostring(newRow)
end
--return tostring(output)--]]
end
function p._main(args)
local output = ""
for k,v in pairs(args) do
output = output .. tostring(v)
end
return tostring(output)
end
return p