<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="fr">
	<id>https://gregorius.dsi.universite-paris-saclay.fr/w/index.php?action=history&amp;feed=atom&amp;title=Module%3ABandeau</id>
	<title>Module:Bandeau - Historique des versions</title>
	<link rel="self" type="application/atom+xml" href="https://gregorius.dsi.universite-paris-saclay.fr/w/index.php?action=history&amp;feed=atom&amp;title=Module%3ABandeau"/>
	<link rel="alternate" type="text/html" href="https://gregorius.dsi.universite-paris-saclay.fr/w/index.php?title=Module:Bandeau&amp;action=history"/>
	<updated>2026-04-28T17:12:31Z</updated>
	<subtitle>Historique des révisions pour cette page sur le wiki</subtitle>
	<generator>MediaWiki 1.35.4</generator>
	<entry>
		<id>https://gregorius.dsi.universite-paris-saclay.fr/w/index.php?title=Module:Bandeau&amp;diff=435&amp;oldid=prev</id>
		<title>Admin : 1 révision importée</title>
		<link rel="alternate" type="text/html" href="https://gregorius.dsi.universite-paris-saclay.fr/w/index.php?title=Module:Bandeau&amp;diff=435&amp;oldid=prev"/>
		<updated>2016-01-13T12:53:57Z</updated>

		<summary type="html">&lt;p&gt;1 révision importée&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Nouvelle page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;--Ce module implémente les modèles de bandeau.&lt;br /&gt;
&lt;br /&gt;
--Standardisation des bandeaux ([[Catégorie:Modèle de bandeau]]).&lt;br /&gt;
--Créer une fonction exportable pour le modèle {{Bandeau}} (ns:all).&lt;br /&gt;
--Créer une fonction exportable pour les bandeaux d'article (ns:0).&lt;br /&gt;
--Créer une fonction exportable pour les bandeaux de section (ns:0).&lt;br /&gt;
--Créer une fonction exportable pour les bandeaux d'ébauche (ns:0).&lt;br /&gt;
--Créer une fonction exportable pour les bandeaux de discussion (ns:1).&lt;br /&gt;
--Créer une fonction exportable pour les bandeaux système (ns:8).&lt;br /&gt;
--Gérer les images multiples.&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
local trim = require('Module:Outils').trim&lt;br /&gt;
local yesno = require('Module:yesno')&lt;br /&gt;
local class = mw.loadData('Module:Bandeau/Class')&lt;br /&gt;
-- local paramEbauche = mw.loadData('Module:Bandeau/Ébauche') -- ne sera chargé que pour un bandeau d'ébauche.&lt;br /&gt;
&lt;br /&gt;
local cfg = {&lt;br /&gt;
	forme = 'bandeau-simple',&lt;br /&gt;
	niveau = 'bandeau-niveau-neutre',&lt;br /&gt;
	formatLien = '[[Fichier:%s|%spx|alt=%s]]',&lt;br /&gt;
	tailleIcone = '45x45',&lt;br /&gt;
	public = 'domaine public',&lt;br /&gt;
	erreurArgument = 'Paramètre &amp;lt;code&amp;gt;|%s=&amp;lt;/code&amp;gt; manquant',&lt;br /&gt;
	erreurEbaucheParam = 'le thème « %s » du modèle [[Modèle:Ébauche|{{ébauche}}]] n’est pas [[Aide:Ébauche/Aide paramètres|défini]].',&lt;br /&gt;
	erreurEbaucheType = 'le thème « %s » doit apparaître en tête de liste du modèle [[Modèle:Ébauche|{{ébauche}}]].',&lt;br /&gt;
	ebaucheImage = '&amp;lt;span style=&amp;quot;white-space:nowrap;word-spacing:5px&amp;quot;&amp;gt;%s&amp;lt;/span&amp;gt;',&lt;br /&gt;
	ebaucheTitre = '%s est une [[Aide:Ébauche|ébauche]].',&lt;br /&gt;
	ebaucheTitreSujet = '%s est une [[Aide:Ébauche|ébauche]] concernant %s.',&lt;br /&gt;
	ebaucheCateg = '[[Catégorie:Wikipédia:ébauche %s]]',&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
local function erreur(texte, formatstring, tag)&lt;br /&gt;
	local res = mw.html.create(tag or 'span')&lt;br /&gt;
	res	:addClass('error')&lt;br /&gt;
		:wikitext('Erreur : ')&lt;br /&gt;
&lt;br /&gt;
	if formatstring then&lt;br /&gt;
		res:wikitext(string.format(formatstring, texte))&lt;br /&gt;
	else&lt;br /&gt;
		res:wikitext(texte)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return tostring(res)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p._bandeau(args)&lt;br /&gt;
	local res = mw.html.create('div')&lt;br /&gt;
	local cells = mw.html.create()&lt;br /&gt;
	local icone = trim(args.image) or trim(args['icône'])&lt;br /&gt;
	local backgroundIcone = class.icones[icone] or ''&lt;br /&gt;
	local texte = (trim(args.texte) or erreur('texte', cfg.erreurArgument))&lt;br /&gt;
&lt;br /&gt;
	res	:attr{ id = args.id }&lt;br /&gt;
		:addClass(class.formes[args.forme] or cfg.forme)&lt;br /&gt;
		:addClass(class.niveau[args.niveau] or cfg.niveau)&lt;br /&gt;
		:addClass('plainlinks')&lt;br /&gt;
		:addClass(args.class)&lt;br /&gt;
		:cssText(args.style)&lt;br /&gt;
	&lt;br /&gt;
	if yesno(args.centrer) then&lt;br /&gt;
		cells = mw.html.create('div')&lt;br /&gt;
			:addClass('bandeau-centrer')&lt;br /&gt;
	end&lt;br /&gt;
	if icone and backgroundIcone == '' then&lt;br /&gt;
		local iconeWiki = icone&lt;br /&gt;
		if not icone:match('%[') then&lt;br /&gt;
			local alt = args.alt or args['légende'] or ''&lt;br /&gt;
			if alt:lower() == cfg.public then&lt;br /&gt;
				alt = '|link='&lt;br /&gt;
			end&lt;br /&gt;
			local taille = args['taille icône'] or cfg.tailleIcone&lt;br /&gt;
			iconeWiki = mw.ustring.format(cfg.formatLien, icone, taille, alt)&lt;br /&gt;
		end&lt;br /&gt;
		cells&lt;br /&gt;
			:tag('div')&lt;br /&gt;
				:addClass('bandeau-cell bandeau-icone')&lt;br /&gt;
				:cssText(args.styleImage) --Provisoire&lt;br /&gt;
				:wikitext(iconeWiki)&lt;br /&gt;
			:done()&lt;br /&gt;
	elseif backgroundIcone ~= '' and args.forme == 'section' then&lt;br /&gt;
		texte = '&amp;amp;ensp;' .. texte&lt;br /&gt;
	end&lt;br /&gt;
	cells&lt;br /&gt;
		:tag('div')&lt;br /&gt;
			:addClass('bandeau-cell ' .. backgroundIcone)&lt;br /&gt;
			:cssText(args.styleTexte) --Provisoire&lt;br /&gt;
			:wikitext(texte)&lt;br /&gt;
			:newline()&lt;br /&gt;
		:done()&lt;br /&gt;
		&lt;br /&gt;
	res	:node(cells)&lt;br /&gt;
	&lt;br /&gt;
	if trim(args['supplément']) then&lt;br /&gt;
		res	:tag('p')   &lt;br /&gt;
				:wikitext(args['supplément'])&lt;br /&gt;
			:done()&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return tostring(res)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p._bandeauAvertissement(args)&lt;br /&gt;
	local htmlTexte = mw.html.create()&lt;br /&gt;
&lt;br /&gt;
	htmlTexte&lt;br /&gt;
		:tag('strong')&lt;br /&gt;
			:addClass('bandeau-titre')&lt;br /&gt;
			:wikitext(trim(args.titre) or erreur('titre', cfg.erreurArgument))&lt;br /&gt;
		:done()&lt;br /&gt;
		:wikitext(args.date)&lt;br /&gt;
		:newline():newline()&lt;br /&gt;
		:wikitext(args.texte)&lt;br /&gt;
&lt;br /&gt;
	local parametres = {&lt;br /&gt;
		forme = 'article',&lt;br /&gt;
		niveau = args.niveau,&lt;br /&gt;
		id = args.id,&lt;br /&gt;
		class = args.class,&lt;br /&gt;
		['icône'] = trim(args['icône']) or trim(args['icône-complexe']) or args.niveau,&lt;br /&gt;
		alt = args.alt or args['légende'],&lt;br /&gt;
		texte = tostring(htmlTexte),&lt;br /&gt;
		['supplément'] = args['supplément']&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	return p._bandeau(parametres)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p._bandeauSection(args)&lt;br /&gt;
	local res = mw.html.create('div')&lt;br /&gt;
	local icone = trim(args.image) or trim(args['icône'])&lt;br /&gt;
	local backgroundIcone = class.icones[icone] or ''&lt;br /&gt;
	local texte = '&amp;amp;ensp;' .. (trim(args.texte) or erreur('texte', cfg.erreurArgument))&lt;br /&gt;
&lt;br /&gt;
	res	:addClass('bandeau-section')&lt;br /&gt;
		:addClass(class.niveau[args.niveau] or cfg.niveau)&lt;br /&gt;
	&lt;br /&gt;
	if icone and backgroundIcone == '' then&lt;br /&gt;
		local iconeWiki = icone&lt;br /&gt;
		if not icone:match('%[') then&lt;br /&gt;
			local alt = args.alt or args['légende'] or ''&lt;br /&gt;
			if alt:lower() == cfg.public then&lt;br /&gt;
				alt = '|link='&lt;br /&gt;
			end&lt;br /&gt;
			iconeWiki = mw.ustring.format(cfg.formatLien, icone, 'text-top|20x17', alt)&lt;br /&gt;
		end&lt;br /&gt;
		res	:wikitext(iconeWiki)&lt;br /&gt;
			:done()&lt;br /&gt;
	end&lt;br /&gt;
	res	:addClass(backgroundIcone)&lt;br /&gt;
		:wikitext(texte)&lt;br /&gt;
		:done()&lt;br /&gt;
&lt;br /&gt;
	return tostring(res)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
p['_ébauche'] = function (args)&lt;br /&gt;
	local paramEbauche = mw.loadData('Module:Bandeau/Ébauche')&lt;br /&gt;
	local ebauches, gestionErreur = {}, {}&lt;br /&gt;
	local frame = mw.getCurrentFrame()&lt;br /&gt;
	local parametres = {&lt;br /&gt;
		icone = 'icône',&lt;br /&gt;
		sujet = 'sujet',&lt;br /&gt;
		selon = 'selon',&lt;br /&gt;
		categ = 'catégorie',&lt;br /&gt;
		type  = 'type',&lt;br /&gt;
		message = 'message'&lt;br /&gt;
	}&lt;br /&gt;
	local getEbaucheTable = function( theme )&lt;br /&gt;
		-- récupére les paramètres lié au theme, à partir du module:Bandeau/Ébauche ou du modèle:Ébauche/paramètres theme&lt;br /&gt;
		local modele = 'Modèle:Ébauche/paramètres ' .. theme&lt;br /&gt;
		local params&lt;br /&gt;
		if paramEbauche[theme] then&lt;br /&gt;
			params = { nom = theme }&lt;br /&gt;
			for n, v in pairs(paramEbauche[theme]) do&lt;br /&gt;
				params[n] = v&lt;br /&gt;
			end&lt;br /&gt;
		elseif mw.title.new( modele ).exists then&lt;br /&gt;
			params = { nom = theme }&lt;br /&gt;
			for n, v in pairs(parametres)  do&lt;br /&gt;
				local param = frame:expandTemplate{title = modele, args = {v}}&lt;br /&gt;
				params[n] = trim(param)&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		return params&lt;br /&gt;
	end&lt;br /&gt;
	local ebaucheParam = function( i, param )&lt;br /&gt;
		-- foction qui retourne la valeur de param pour l'ébauche i, ou une valeur par défaut.&lt;br /&gt;
		return ebauches[i] and ebauches[i][param] or paramEbauche[''][param]&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	for i, theme in ipairs(args) do&lt;br /&gt;
		-- récupération des paramètres de tous les thèmes&lt;br /&gt;
		theme = trim(theme)&lt;br /&gt;
		if theme then&lt;br /&gt;
			local t = getEbaucheTable(theme)&lt;br /&gt;
			if t then&lt;br /&gt;
				table.insert(ebauches, t)&lt;br /&gt;
			else&lt;br /&gt;
				table.insert(&lt;br /&gt;
					gestionErreur, &lt;br /&gt;
					erreur(theme, cfg.erreurEbaucheParam, 'div')&lt;br /&gt;
				)&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local images, titres, categs = {}, {}, {}&lt;br /&gt;
	local tailleIcone = cfg.tailleIcone&lt;br /&gt;
	if #ebauches &amp;gt; 3 then&lt;br /&gt;
		tailleIcone = '35x25'&lt;br /&gt;
	end&lt;br /&gt;
	for i, ebauche in ipairs(ebauches) do&lt;br /&gt;
		-- mise en forme des images&lt;br /&gt;
		if ebauche.icone then&lt;br /&gt;
			table.insert(&lt;br /&gt;
				images, &lt;br /&gt;
				cfg.formatLien:format(&lt;br /&gt;
					ebauche.icone, &lt;br /&gt;
					tailleIcone, &lt;br /&gt;
					ebauche.altIcone or ''&lt;br /&gt;
				)&lt;br /&gt;
			)&lt;br /&gt;
		end&lt;br /&gt;
		if math.fmod(#ebauches, 3) == 1 and (#ebauches - i) == 2	&lt;br /&gt;
			or math.fmod(i, 3) == 0 and (#ebauches - i) &amp;gt; 1&lt;br /&gt;
		then&lt;br /&gt;
			-- sur plusieurs lignes s'il y a plus de 3 images, avec minimum deux images sur la dernière ligne.&lt;br /&gt;
			table.insert(images,'&amp;lt;br&amp;gt;')&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		if i &amp;gt; 1 and ebauche.type and ebauche.type ~= paramEbauche[''].type then&lt;br /&gt;
			-- remplace &amp;quot;Cet article par &amp;quot;Ce portail&amp;quot; ou autre en fonction du premier thème.&lt;br /&gt;
			table.insert(&lt;br /&gt;
				gestionErreur, &lt;br /&gt;
				erreur(ebauche.nom, cfg.erreurEbaucheType, 'div')&lt;br /&gt;
			)&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		-- récupères les différents noms de thème&lt;br /&gt;
		table.insert(titres, ebauche.sujet)&lt;br /&gt;
		&lt;br /&gt;
		-- mise en forme des catégories&lt;br /&gt;
		if ebauche.categ then &lt;br /&gt;
			table.insert( categs, cfg.ebaucheCateg:format( ebauche.categ ) )&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local image &lt;br /&gt;
	if trim(args['icône']) then&lt;br /&gt;
		local theme = getEbaucheTable(args['icône'])&lt;br /&gt;
		if theme and theme.icone then&lt;br /&gt;
			image = cfg.formatLien:format(theme.icone, tailleIcone, theme.altIcone or '')&lt;br /&gt;
		end&lt;br /&gt;
	elseif #images == 1 then&lt;br /&gt;
		image = images[1]&lt;br /&gt;
	elseif #images &amp;gt; 1 then&lt;br /&gt;
		image = cfg.ebaucheImage:format(table.concat(images, ' '))&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local titre&lt;br /&gt;
	if #titres &amp;gt; 0 then&lt;br /&gt;
		titre = cfg.ebaucheTitreSujet:format( &lt;br /&gt;
			ebaucheParam(1, 'type'), &lt;br /&gt;
			mw.text.listToText(titres)&lt;br /&gt;
		)&lt;br /&gt;
	else&lt;br /&gt;
		titre = cfg.ebaucheTitre:format(ebaucheParam(1, 'type'))&lt;br /&gt;
	end&lt;br /&gt;
	local texte&lt;br /&gt;
	if #ebauches == 0 then&lt;br /&gt;
		texte = (ebaucheParam(1, 'message')) .. '.'&lt;br /&gt;
	else&lt;br /&gt;
		texte = (ebaucheParam(1, 'message')) .. ' ' .. (ebaucheParam(1, 'selon')) .. '.'&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local parametres = {&lt;br /&gt;
		niveau = 'ébauche',&lt;br /&gt;
		['icône'] = image,&lt;br /&gt;
		titre = titre,&lt;br /&gt;
		texte = texte,&lt;br /&gt;
		id = args.id&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	local categ = ''&lt;br /&gt;
	if not yesno(args.nocat) then&lt;br /&gt;
		categ = table.concat(categs)&lt;br /&gt;
		if categ == '' then&lt;br /&gt;
			categ = cfg.ebaucheCateg:format('')&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local messageErreur = table.concat(gestionErreur)&lt;br /&gt;
	if messageErreur:len() &amp;gt; 0 and not yesno(args.nocat) then&lt;br /&gt;
		messageErreur = messageErreur .. '[[Catégorie:Page utilisant un modèle avec une syntaxe erronée|Ébauche]]'&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return p._bandeauAvertissement(parametres) .. messageErreur .. categ&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Insertion dans la table p des fonctions appelées par les&lt;br /&gt;
-- modèles à l'aide d'un adaptateur de fonction.&lt;br /&gt;
local function adaptateur(nomFonction)&lt;br /&gt;
	return function (frame)&lt;br /&gt;
		local args&lt;br /&gt;
		if frame.args.texte or frame.args.titre then&lt;br /&gt;
			args = frame.args&lt;br /&gt;
		else&lt;br /&gt;
			args = frame:getParent().args&lt;br /&gt;
		end&lt;br /&gt;
		return p[nomFonction](args)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
 &lt;br /&gt;
local nomsFonction = {'bandeau', 'bandeauAvertissement', 'bandeauSection', 'ébauche' } &lt;br /&gt;
for _, nomFonction in ipairs(nomsFonction) do&lt;br /&gt;
	p[nomFonction] = adaptateur('_' .. nomFonction)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
</feed>