Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:Contributors

From Hacks Guide Wiki
This is the approved revision of this page, as well as being the most recent.

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|link=]]',
		text=table.concat(finalText, '\n')
	})
	
	return box
end

return p