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.

« Module:Infobox/Configs/Mythe » : différence entre les versions

De Nefald
Hiob (discussion | contributions)
m icon : hands-praying
Aucun résumé des modifications
 
Ligne 1 : Ligne 1 :
local config = {
local config = {
     titre = function(args)
     titre = function(args)
         return args.nom or '{{PAGENAME}}'
         return args.nom or '{{PAGENAME}}'
     end,
     end,
    
    
    -- Icône avec type et nom
     icone = {
     icone = {
         type = 'fas', -- ou 'fab', 'far', 'fal', 'fad'
         type = 'fas',
         nom = 'hands-praying'
         nom = 'hands-praying'
     },
     },
Ligne 16 : Ligne 16 :
         return nil
         return nil
     end,
     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 = {
     sections = {
Ligne 26 : Ligne 99 :
                 { cle = 'periode_fin', label = 'Période de fin' },
                 { cle = 'periode_fin', label = 'Période de fin' },
                 { cle = 'affiliation', label = 'Affiliation' },
                 { cle = 'affiliation', label = 'Affiliation' },
                 { cle = 'statut', label = 'Statut' },
                 { cle = 'statut', label = 'Statut' }
             }
             }
         },
         },
Ligne 35 : Ligne 108 :
                 { cle = 'domaine', label = 'Domaine' },
                 { cle = 'domaine', label = 'Domaine' },
                 { cle = 'apparence', label = 'Apparence' },
                 { cle = 'apparence', label = 'Apparence' },
                 { cle = 'edifice', label = 'Édifice' },
                 { cle = 'edifice', label = 'Édifice' }
             }
             }
         },
         },
Ligne 41 : Ligne 114 :
             titre = 'Culte',
             titre = 'Culte',
             champs = {
             champs = {
                 { cle = 'veneration', label = 'Vénération' },
                 { cle = 'veneration', label = 'Vénération' }
             }
             }
         }
         }

Dernière version du 20 février 2026 à 09:40

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.