Basculer le menu
Changer de menu des préférences
Basculer le menu personnel
Non connecté(e)
Votre adresse IP sera visible au public si vous faites des modifications.
Version datée du 20 février 2026 à 09:40 par Ayd (discussion | contributions)
(diff) ← Version précédente | Version actuelle (diff) | Version suivante → (diff)

La documentation pour ce module peut être créée à Module:Infobox/Configs/Mythe/doc

local config = {

    titre = function(args)
        return args.nom or '{{PAGENAME}}'
    end,
   
    icone = {
        type = 'fas',
        nom = 'hands-praying'
    },
    
    image = function(args)
        if args.image then
            return '[[Fichier:' .. args.image .. '|300px]]'
        end
        return nil
    end,

    -- ===============================
    -- TYPE DE MYTHE
    -- ===============================

    typeField = {
        required = false,
        allowedValues = {
            ['mythe'] = { display = 'Mythe', category = 'Mythes' },
            ['légende'] = { display = 'Légende', category = 'Légendes' },
            ['divinité'] = { display = 'Divinité', category = 'Divinités' },
            ['esprit'] = { display = 'Esprit', category = 'Esprits' },
            ['culte'] = { display = 'Culte', category = 'Cultes' },
            ['rite'] = { display = 'Rite', category = 'Rites' },
            ['prophétie'] = { display = 'Prophétie', category = 'Prophéties' }
        }
    },

    -- ===============================
    -- STATUT DU MYTHE
    -- ===============================

    statutField = {
        required = false,
        allowedValues = {
            ['actif'] = { display = 'Actif', category = 'Mythes actifs' },
            ['oublié'] = { display = 'Oublié', category = 'Mythes oubliés' },
            ['interdit'] = { display = 'Interdit', category = 'Mythes interdits' },
            ['disparu'] = { display = 'Disparu', category = 'Mythes disparus' },
            ['déformé'] = { display = 'Déformé', category = 'Mythes déformés' }
        }
    },

    -- ===============================
    -- CATÉGORISATION AUTOMATIQUE
    -- ===============================

    categories = function(args, config, frame)

        local cats = {}
        local title = mw.title.getCurrentTitle()

        -- uniquement namespace principal
        if title.namespace ~= 0 then
            return cats
        end

        -- catégorie TYPE
        if args.type and config.typeField and config.typeField.allowedValues then
            local cleanType = mw.text.trim(mw.ustring.lower(args.type))
            local typeDef = config.typeField.allowedValues[cleanType]

            if typeDef and typeDef.category then
                table.insert(cats, typeDef.category)
            end
        end

        -- catégorie STATUT
        if args.statut and config.statutField and config.statutField.allowedValues then
            local cleanStatut = mw.text.trim(mw.ustring.lower(args.statut))
            local statutDef = config.statutField.allowedValues[cleanStatut]

            if statutDef and statutDef.category then
                table.insert(cats, statutDef.category)
            end
        end

        return cats
    end,

    -- ===============================
    -- STRUCTURE INFOBOX
    -- ===============================

    sections = {
        {
            titre = 'Informations générales',
            champs = {
                { cle = 'type', label = 'Type' },
                { cle = 'territoire', label = "Territoire d'influence" },
                { cle = 'periode_debut', label = 'Période de début' },
                { cle = 'periode_fin', label = 'Période de fin' },
                { cle = 'affiliation', label = 'Affiliation' },
                { cle = 'statut', label = 'Statut' }
            }
        },
        {
            titre = 'Divinité',
            champs = {
                { cle = 'genealogie', label = 'Généalogie' },
                { cle = 'domaine', label = 'Domaine' },
                { cle = 'apparence', label = 'Apparence' },
                { cle = 'edifice', label = 'Édifice' }
            }
        },
        {
            titre = 'Culte',
            champs = {
                { cle = 'veneration', label = 'Vénération' }
            }
        }
    }
}

return config
Les témoins (''cookies'') nous aident à fournir nos services. En utilisant nos services, vous acceptez notre utilisation de témoins.