local p = {}
local getArgs = require('Module:Arguments').getArgs
local tWrapper = require('Module:Template wrapper')
function p.build(frame, args)
local tbl = {}
local current = ''
for k,v in pairs(args) do
if tonumber(k) ~= nil and string.match(v, '[GgAaFfCcUuRrTtPp]%d%d?') then
current = v
tbl[v] = {}
else
table.insert(tbl[current], {[k] = v})
end
end
local out = mw.html.create('')
for k,v in pairs(tbl) do
out:newline():wikitext(tWrapper.wrap(frame:newChild{ title = frame:getTitle(), args = {
['_template'] = 'db-'..mw.ustring.lower(k),
['raw'] = 'yes',
['rationale'] = 'test'
}}))
end
return mw.dumpObject(tostring(out))
end
function p.main(frame)
local args = getArgs(frame)
return p.build(frame, args)
end
function p.dump(frame)
return mw.dumpObject(mw.text.unstripNoWiki(frame.args[1]))
end
return p