local p = {}
local param = {
rpStart = "rpStart",
rpEnd = "rpEnd",
}
function p.main(frame)
local args = require('Module:Arguments').getArgs(frame, {
parentFirst = true,
wrappers = { 'Template:Rubi' },
})
return p._main(args)
end
function p._main(args)
local ruby = mw.html.create('ruby')
if args.large then ruby:addClass('rubi-large') end
if args.center then ruby:addClass('rubi-center') end
function mobileTag(ruby, text)
if text then
ruby:tag('rp')
:wikitext(text)
:done()
end
end
for k, v in ipairs(args) do
if k % 2 == 0 then
mobileTag(ruby,args[param.rpStart])
ruby:tag('rt'):wikitext(v)
mobileTag(ruby,args[param.rpEnd])
else
ruby:wikitext(v)
end
end
return ruby
end
return p