Wikitable3
From RammWiki
More actions
Documentation for this module may be created at Module:Wikitable3/doc
local p = {}
local getArgs = require('Module:Arguments').getArgs
function p.main(frame)
local args = getArgs(frame, {
removeBlanks = false,
trim = false
})
local output = '{|'
-- Table attributes
if args.class then
output = output .. ' class="' .. mw.text.trim(args.class) .. '"'
end
if args.style then
output = output .. ' style="' .. mw.text.trim(args.style) .. '"'
end
output = output .. '\n'
-- Headers
if args.headers then
for _, header in ipairs(mw.text.split(args.headers, '\n\n', true)) do
header = mw.text.trim(header)
if header ~= '' then
header = header:gsub('%|%|', '!!')
if args.headerclass then
output = output .. '|- class="' .. mw.text.trim(args.headerclass) .. '"\n'
else
output = output .. '|-\n'
end
output = output .. '!' .. header .. '\n'
end
end
end
-- Rows
if args.rows then
for _, row in ipairs(mw.text.split(args.rows, '\n\n', true)) do
row = mw.text.trim(row)
if row ~= '' then
output = output .. '|-\n|' .. row .. '\n'
end
end
end
output = output .. '|}'
return output
end
return p