local getArgs = require('Module:Arguments').getArgs
local p = {}
local function makeInvokeFunction(funcName)
-- makes a function that can be returned from #invoke, using
-- [[Module:Arguments]].
return function (frame)
local args = getArgs(frame, {parentOnly = true})
return p[funcName](args)
end
end
p.row = makeInvokeFunction('_row')
function p._row(args)
local somelist = args[1]
local result
result = '{|class="wikitable"\n'
local tmp = mw.text.split(somelist, '\n')
for k1, v1 in pairs(tmp) do
local tmp2 = mw.text.split(v1, '\\')
for k2, v2 in pairs(tmp2) do
if (k2 % 2 == 0) then
result = result .. '||' .. v2 .. '\n'
else
if (k1 % 2 == 0) then
result = result .. '|-\n!' .. k1 .. '\n|style="background:#f77"|' .. v2
else
result = result .. '|-\n!' .. k1 .. '\n|' .. v2
end
end
end
end
result = result .. '|}'
return result
end
p.link = makeInvokeFunction('_link')
function p._link(args)
local result
result = 'Simple loop\n'
for i = 10,100,10 do
result = result .. ':' .. i .. '\n'
end
return result
end
return p