Communauté  • Livre d'or
Chats noirs.jpg Actualités, astuces, interview... Venez lire la gazette de ce printemps de Vikidia ! DessinInterview.png
Cette page est protégée.

Module:Voir principal

Aller à la navigation Aller à la recherche
 Documentation[modifier] [purger]

Le module : Voir principal sert au rendu du modèle {{Voir principal}} ; voir la documentation de ce modèle.

À faire

local p = {}

function p.VoirPrincipal( frame )
	local args = frame:getParent().args
	local list = mw.html.create( 'ul' )

	-- articles principaux
	local lien = require('Module:Multiparamètres').lien
	local nombre, phrase = lien( args, true )
	if nombre == 1 then
		phrase = '[[Fichier:Icône article.png|20px|Article|link=]] Article principal : ' .. phrase
		list:tag( 'li' ):wikitext( phrase )
		                :done()
	elseif nombre > 1 then
		phrase = '[[Fichier:Icône article.png|20px|Article|link=]] Articles principaux : ' .. phrase
		list:tag( 'li' ):wikitext( phrase )
		                :done()
	end

	-- paramètres nommés
	if args['portail'] then
		phrase = '[[Fichier:Icône portail.png|20px|Portail|link=]] Portail : <i>[[Portail:' .. args['portail'] .. ']]</i>'
		list:tag( 'li' ):wikitext( phrase )
		                :done()
	end
	if args['images'] then
		phrase = '[[Fichier:Icône images.png|20px|Images|link=]] Images : <i>[[:Catégorie:Image ' .. args['images'] .. ']]</i>'
		list:tag( 'li' ):wikitext( phrase )
		                :done()
	end
	if args['ébauche'] then
		phrase = '[[Fichier:Icône ébauche.png|20px|Modèle d’ébauche|link=]] Modèle d’ébauche : <i>[[Modèle:Ébauche ' .. args['ébauche'] .. '|{{Ébauche|' ..  args['ébauche'] .. '}}]]</i>'
		list:tag( 'li' ):wikitext( phrase )
		                :done()
	end
	if args['quiz'] then
		phrase = '[[Fichier:Icône quiz.png|20px|Quiz|link=]] Quiz : <i>[[Quiz:' .. args['quiz'] .. ']]</i>'
		list:tag( 'li' ):wikitext( phrase )
		                :done()
	end
	if args['faq'] then
		phrase = '[[Fichier:LeSavant.svg|20px|FAQ du Savant|link=]] FAQ du Savant : <i>[[Vikidia:Le Savant/FAQ/' .. args['faq'] .. '|' .. args['faq'] .. ']]</i>'
		list:tag( 'li' ):wikitext( phrase )
		                :done()
	end

	local html = mw.html.create( 'div' )
	html:css( 'width', 'auto' )
	    :css( 'min-width', '24%' )
	    :css( 'clear', 'right' )
	    :css( 'float', 'right' )
	    :css( 'margin', '0 0 10px 20px' )
	    :css( 'padding', '3px' )
	    :css( 'border-width', '0 12px 3px 0' )
	    :css( 'border-style', 'solid' )
	    :css( 'background-color', 'white' )
	    :css( 'border-color', '#AA55FF' )
	    :addClass( 'liste-sans-puces' )
	    :node( list )

	return tostring( html )
end

return p