« Module:Bandeau d'avertissement » : différence entre les versions
Générateur de bandeau pour la maintenance des articles |
(Aucune différence)
|
Version du 26 juin 2021 à 12:43
La documentation pour ce module peut être créée à Module:Bandeau d'avertissement/doc
local p = {}
-----------------------------------------------------------
----- Référentiel des bandeaux de maintenance -----
-----------------------------------------------------------
data = {
["ébauche"] = {
image = "Ici et maintenant.png",
title = "Cet article est une ébauche et mériterait un meilleur développement.",
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)
local banner = data[args.nom:lower()]
local image = banner.image or 'bandeau de maintenance - defaut.png'
local title = banner.title or 'Titre ?'
local description = banner.description
local category = banner.category or ''
local game = args[1] or ''
local note = args[2]
if category ~= '' then
if game ~= '' then
game = require( 'Module:Abréviation' ).name(game) or ''
if game ~= '' then
game = ' (' .. game .. ')'
end
end
category = '[[Catégorie:' .. category .. game .. ']]'
end
title = mw.html.create( 'p' )
: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' )
:addClass( 'avt-maintenance-banner noexcerpt' )
:tag( 'div' )
:addClass( 'avt-maintenance-banner-img' )
:wikitext( '[[Fichier:' .. image .. '|x50px|link=|alt=]]' )
:done()
:tag( 'div' )
:addClass( 'avt-maintenance-banner-text' )
:node(title)
:node(description)
:node(note)
:done()
:done()
return tostring(res) .. category
end
return p