« Module:Bandeau de rubrique » : différence entre les versions

aucun résumé des modifications
Kharmitch (discussion | contributions)
Aucun résumé des modifications
Aucun résumé des modifications
 
(9 versions intermédiaires par un autre utilisateur non affichées)
Ligne 61 : Ligne 61 :
["jeu"] = {
["jeu"] = {
warning  = false,
warning  = false,
image    = 'Portail jeux.png',
text    = function(args)
text    = function(args)
local abbModule = require( "Module:Abréviation" )
local abbModule = require( "Module:Abréviation" )
Ligne 111 : Ligne 112 :
text    = function(args)
text    = function(args)
local link = args[1]
local link = args[1]
local display = args['t1'] or link
if not link then return "Lien ?" end
if not link then return '' end
local text
if args[2] then
text = "Articles principaux : "
else
text = "Article principal : "
end
text = '[[' .. link .. '|' .. display .. ']]'
local linkText = args["t1"] or link
text = text .. "[[:" .. link .. "|" .. linkText .. "]]"
local many = false
for i = 2, 5 do
for i = 2, 5 do
local link = args[i]
link = args[i]
local display = args['t' .. i] or link
if link then
if link then
many = true
linkText = args["t" .. i] or link
text = text .. ', [[' .. link .. '|' .. display .. ']]'
text = text .. ", [[:" .. link .. "|" .. linkText .. "]]"
else
else
break
break
end
end
end
if many then
text = 'Articles principaux : ' .. text
else
text = 'Article principal : ' .. text
end
end
Ligne 140 : Ligne 139 :
["vide"] = {
["vide"] = {
warning  = true,
warning  = true,
category = 'Sections vides ou incomplètes',
image    = 'Portail participation.png',
category = 'Rubrique vide ou incomplète',
text    = function(args)
text    = function(args)
local text = 'Cette rubrique est vide, insuffisamment détaillée ou incomplète. ['
local text = 'Cette rubrique est vide, insuffisamment détaillée ou incomplète. ['
Ligne 172 : Ligne 172 :
local banner = data[args.nom:lower()]
local banner = data[args.nom:lower()]
local image = banner.image or ''
local image = banner.image
local text = banner.text
local text = banner.text
local category = banner.category
local category = banner.category
if category and mw.title.getCurrentTitle().namespace == 0 then
if category and mw.title.getCurrentTitle().namespace == 0 then
local game = args['jeu']
local game = args['jeu'] or args[1]  -- FIXME: args[1] conflit
if game ~= '' then
if game ~= '' then
game = require( 'Module:Abréviation' ).name(game) or ''
game = require( 'Module:Abréviation' ).name(game) or ''
Ligne 189 : Ligne 189 :
end
end
if image ~= '' then
if image then
image = mw.html.create( 'span' )
image = mw.html.create( 'div' )
:addClass( 'avt-section-banner-img' )
:wikitext( '[[Fichier:' .. image .. '|x30px|link=|alt=]]' )
:wikitext( '[[Fichier:' .. image .. '|x30px|link=|alt=]]' )
:done()
:done()
Ligne 202 : Ligne 201 :
local res = mw.html.create( 'div' )
local res = mw.html.create( 'div' )
:addClass( 'avt-section-banner noexcerpt' )
:addClass( 'avt-section-banner noexcerpt' )
:wikitext(tostring(image) .. text)
:node(image)
:tag( 'div' )
:wikitext(text)
:done()
:done()
:done()