Aller au contenu

« Module:Bandeau d'avertissement » : différence entre les versions

m
aucun résumé des modifications
Kharmitch (discussion | contributions)
Générateur de bandeau pour la maintenance des articles
 
Kharmitch (discussion | contributions)
mAucun résumé des modifications
 
(4 versions intermédiaires par le même utilisateur non affichées)
Ligne 2 : Ligne 2 :


-----------------------------------------------------------
-----------------------------------------------------------
-----     Référentiel des bandeaux de maintenance    -----
-----             Types de bandeau                  -----
-----------------------------------------------------------
-----------------------------------------------------------


data = {
local bannerColor = {
["ébauche"] = {
info       = 'avt-warn-banner-info',
image       = "Ici et maintenant.png",
maintenance = 'avt-warn-banner-maintenance',
title        = "Cet article est une ébauche et mériterait un meilleur développement.",
licence     = 'avt-warn-banner-license'
description  = "Vous pouvez aider les Archives de Vault-Tec en partageant vos connaissances sur le sujet ([[Aide:Modifier les pages|comment ?]]) ; n'hésitez pas à consulter le [[Les Archives de Vault-Tec:Guide de l'utilisateur|guide de l'utilisateur]] pour connaitre toutes nos recommandations.",
category     = "Ébauches"
},
}
}


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


function p._build(args)
function p._build(args)
local banner = data[args.nom:lower()]
-- Info du bandeau
local image = banner.image or 'bandeau de maintenance - defaut.png'
local image = args["image"] or 'bandeau de maintenance - defaut.png'
local title = banner.title or 'Titre ?'
local header = args["en-tête"] or 'En-tête ?'
local description = banner.description
local description = args["description"] or 'Description ?'
local category = banner.category or ''
local category = args["catégorie"] or ''
local game = args["jeu"] or ''
local bannerType = args["type"]
local game = args[1] or ''
-- Création de la catégorie si présente avec éventuel jeu
local note = args[2]
if category ~= '' then
if category ~= '' then
Ligne 51 : Ligne 35 :
end
end
title = mw.html.create( 'p' )
-- Création du bandeau
:addClass( 'avt-maintenance-banner-title' )
:wikitext( title )
:done()
if description then
description = mw.html.create( 'p' )
:addClass( 'avt-maintenance-banner-desc' )
:wikitext( description )
:done()
end
if note then
note = mw.html.create( 'p' )
:addClass( 'avt-maintenance-banner-note' )
:wikitext( 'Note : ' .. note )
:done()
end
local res = mw.html.create( 'div' )
local res = mw.html.create( 'div' )
:addClass( 'avt-maintenance-banner noexcerpt' )
:addClass( 'avt-warn-banner noexcerpt ' .. bannerColor[bannerType] )
:tag( 'div' )
:tag( 'div' )
:addClass( 'avt-maintenance-banner-img' )
:addClass( 'avt-warn-banner-img' )
:wikitext( '[[Fichier:' .. image .. '|x50px|link=|alt=]]' )
:wikitext( '[[Fichier:' .. image .. '|x50px|link=|alt=]]' )
:done()
:done()
:tag( 'div' )
:tag( 'div' )
:addClass( 'avt-maintenance-banner-text' )
:addClass( 'avt-warn-banner-text' )
:node(title)
:tag( 'p' )
:node(description)
:addClass( 'avt-warn-banner-header' )
:node(note)
:wikitext( header )
:done()
:tag( 'p' )
:addClass( 'avt-warn-banner-desc' )
:wikitext( description )
:done()
:done()
:done()
:done()
:done()
Ligne 86 : Ligne 58 :
return tostring(res) .. category
return tostring(res) .. category
end
end
-----------------------------------------------------------
-----                Points d'entrée                -----
-----------------------------------------------------------
function p.build(frame)
local args = {}
for cle, val in pairs(frame.args) do
if val then
val = mw.text.trim(val)
if val ~= '' then
args[cle] = val
end
end
end
return p._build(args)
end
-----------------------------------------------------------


return p
return p
Bureaucrate, commentadmin, emailconfirmed, Administrateurs d’interface, staff, Administrateur
62 737

modifications