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

aucun résumé des modifications
Kharmitch (discussion | contributions)
Aucun résumé des modifications
Kharmitch (discussion | contributions)
Aucun résumé des modifications
Ligne 2 : Ligne 2 :


--------------------------------------------------------
--------------------------------------------------------
-----     Référentiel des bandeaux de rubrique     -----
-----   Référentiel des bandeaux de rubrique     -----
--------------------------------------------------------
--------------------------------------------------------


Ligne 40 : Ligne 40 :
local article = args[1]
local article = args[1]
local title = mw.title.new(article)
local title = mw.title.new(article)
       
        local inclusionType = ''
local inclusionType = ''
        local section = args['section']
local section = args['section']
        local heading = args['rubrique']
local heading = args['rubrique']
       
        if section then
if section then
        inclusionType = ' · Section ' .. section
inclusionType = ' · Section ' .. section
        elseif heading then
elseif heading then
        inclusionType = ' · Rubrique ' .. heading
inclusionType = ' · Rubrique ' .. heading
        else
else
        inclusionType = ' · Introduction'
inclusionType = ' · Introduction'
        end
end
       
return 'Extrait de l\'article [[' .. article .. ']]'
return 'Extrait de l\'article [[' .. article .. ']]'
.. inclusionType
.. inclusionType
.. ' · ([' .. title:fullUrl('action=edit') .. ' modifier])'
.. ' · ([' .. title:fullUrl('action=edit') .. ' modifier])'
.. ' · ([[Aide:Inclusion|Qu\'est ce que c\'est ?]])'
.. ' · ([[Aide:Inclusion|Qu\'est ce que c\'est ?]])'
        end
end
    },
},
    ["jeu"] = {
["jeu"] = {
    warning  = false,
warning  = false,
    text    = function(args)
text    = function(args)
    local abbModule = require( "Module:Abréviation" )
local abbModule = require( "Module:Abréviation" )
   
    -- Il doit y avoir un moins un jeu reconnu, dans le cas
-- Il doit y avoir un moins un jeu reconnu, dans le cas
    -- contraire, on ne retourne rien
-- contraire, on ne retourne rien
    -- Le lien est par défaut le nom de la page mais il peut
-- Le lien est par défaut le nom de la page mais il peut
    -- être surchargé
-- être surchargé
   
    local abb = args[1]
local abb = args[1]
    local link = args["lien"] or mw.title.getCurrentTitle().text
local link = args["lien"] or mw.title.getCurrentTitle().text
   
    if not abb then return "" end
if not abb then return "" end
   
    local game = abbModule.name(abb)
local game = abbModule.name(abb)
    if not game then return "" end
if not game then return "" end
   
    -- Au pluriel si plusieurs jeux
-- Au pluriel si plusieurs jeux


    local text = ''
local text = ''
    if args[2] then
if args[2] then
    text = "Articles associés aux jeux : "
text = "Articles associés aux jeux : "
    else
else
    text = "Article associé au jeu : "
text = "Article associé au jeu : "
    end
end
   
    text = text .. "[[" .. (args["lien1"] or link) .. " (" .. game .. ")|''" .. game .. "'']]"
text = text .. "[[" .. (args["lien1"] or link) .. " (" .. game .. ")|''" .. game .. "'']]"
   
    -- On ajoute les jeux 2 à 10 mais on s'arrête si le
-- On ajoute les jeux 2 à 10 mais on s'arrête si le
    -- n-ième est absent.
-- n-ième est absent.
   
    for i = 2, 10 do
for i = 2, 10 do
    abb = args[i]
abb = args[i]
    if abb then
if abb then
    game = abbModule.name(abb)
game = abbModule.name(abb)
    if game then
if game then
    local linkAbb = args["lien" .. i] or link
local linkAbb = args["lien" .. i] or link
    text = text .. ", [[" .. linkAbb .. " (" .. game .. ")|''" .. game .. "'']]"
text = text .. ", [[" .. linkAbb .. " (" .. game .. ")|''" .. game .. "'']]"
    end
end
    else
else
    break
break
    end
end
    end
end
   
    return text
return text
    end
end
    },
},
    ["principal"] = {
["principal"] = {
        warning  = false,
warning  = false,
        text    = function(args)
text    = function(args)
local link = args[1]
local link = args[1]
local display = args['t1'] or link
local display = args['t1'] or link
Ligne 136 : Ligne 136 :
return text
return text
        end
end
    },
},
    ["vide"] = {
["vide"] = {
        warning  = true,
warning  = true,
        category = 'Sections vides ou incomplètes',
category = 'Sections vides ou incomplètes',
        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. ['
        .. mw.title:getCurrentTitle():fullUrl('action=edit') .. ' Votre aide] est la bienvenue'
.. mw.title:getCurrentTitle():fullUrl('action=edit') .. ' Votre aide] est la bienvenue'
        local todo = args['à faire']
local todo = args['à faire']
        if todo then
if todo then
        text = text .. ' pour ' .. todo
text = text .. ' pour ' .. todo
        end
end
        return text .. '.'
return text .. '.'
        end
end
    },
},
}
}


Bureaucrate, commentadmin, emailconfirmed, Administrateurs d’interface, staff, Administrateur
62 734

modifications