No edit summary |
No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 40: | Line 40: | ||
local box = messageBox.main('fmbox', { | local box = messageBox.main('fmbox', { | ||
image='[[File:OOjs UI icon logo-cc.svg|40px | image='[[File:OOjs UI icon logo-cc.svg|40px]]', | ||
text=table.concat(finalText, '\n') | text=table.concat(finalText, '\n') | ||
}) | }) |
Revision as of 11:17, 12 June 2022
Implements {{Contributors}}.
local messageBox = require('Module:Message box')
local p = {}
function p.argsToIndexedTable( args )
local newtable = {}
for k, v in pairs(args) do
local num = tonumber(k)
if num ~= nil then
newtable[num] = v
end
end
return newtable
end
function p.main( frame )
local fp = frame:getParent()
local contribs = p.argsToIndexedTable( fp.args )
local lang = mw.language.getContentLanguage()
local prefix = lang:convertPlural(
#contribs,
"The main author of this article is ",
"The main authors of this article are "
)
local suffix = '.'
local finalText = {
prefix..mw.text.listToText(contribs)..suffix,
}
if fp.args.extra then
table.insert(finalText, fp.args.extra)
end
local box = messageBox.main('fmbox', {
image='[[File:OOjs UI icon logo-cc.svg|40px]]',
text=table.concat(finalText, '\n')
})
return box
end
return p