Module:Portail

De Les Archives de Vault-Tec
Aller à la navigation Aller à la recherche
Documentation du module

Module responsable de la création des objets utilisés sur les portails.

Documentation transclues de Module:Portail/doc.
local p = {}

------------------------------------------------------
-- Fonctions communes
------------------------------------------------------

function getArgs(frame)
	local args = {}
	local argsParent = frame:getParent().args
	for cle, val in pairs(argsParent) do
		if val then
			args[cle] = mw.text.trim(val)
		end
	end
	return args
end

------------------------------------------------------
-- p._
------------------------------------------------------

function p._buildGameContentGroup(args)
	local items = mw.html.create( 'ul' )
	
	for i, item in ipairs(args) do
		items	:tag( 'li' ):wikitext( item ):done()
	end
	
	items	:done()
	
	return tostring(mw.html.create( 'div' )
		:addClass( 'liste-horizontale portal-content-group' )
		:tag( 'div' )
			:addClass( 'portal-content-group-title' )
			:wikitext( args.titre or 'Titre ?' )
			:done()
		:node( items )
	)
end

------------------------------------------------------
-- p.
------------------------------------------------------

function p.buildGameContentGroup(frame) return p._buildGameContentGroup(getArgs(frame)) end

------------------------------------------------------
-- returning module
------------------------------------------------------

return p