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/Personnage » : différence entre les versions

De Nefald
Aucun résumé des modifications
Aucun résumé des modifications
 
(2 versions intermédiaires par le même utilisateur non affichées)
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 = 'person'
         nom = 'person'
     },
     },
   
 
     image = function(args)
     image = function(args)
         if args.image then
         if args.image then
Ligne 17 : Ligne 17 :
     end,
     end,


     -- Catégorisation automatique selon le type
     -- STATUT DU PERSONNAGE
    statutField = {
        required = false,
        allowedValues = {
            ['vivant'] = { display = 'Vivant', category = 'Personnage vivant' },
            ['décédé'] = { display = 'Décédé', category = 'Personnage décédé' },
            ['disparu'] = { display = 'Disparu', category = 'Personnage disparu' },
            ['immortel'] = { display = 'Immortel', category = 'Personnage immortel' }
        }
    },
 
    -- CATÉGORIES AUTOMATIQUES (STATUT UNIQUEMENT)
     categories = function(args, config, frame)
     categories = function(args, config, frame)
         local cats = {}
         local cats = {}
         local title = mw.title.getCurrentTitle()
         local title = mw.title.getCurrentTitle()


         -- On ajoute les catégories uniquement dans le namespace principal (0)
         -- catégories uniquement namespace principal
         if title.namespace ~= 0 then
         if title.namespace ~= 0 then
             return cats
             return cats
         end
         end


         -- Catégorie selon le type
         -- catégorie selon statut
         if args.type and config.typeField and config.typeField.allowedValues then
         if args.statut and config.statutField and config.statutField.allowedValues then
             local cleanType = mw.text.trim(mw.ustring.lower(args.type))
             local cleanStatut = mw.text.trim(mw.ustring.lower(args.statut))
             local typeDef = config.typeField.allowedValues[cleanType]
             local statutDef = config.statutField.allowedValues[cleanStatut]
             if typeDef and typeDef.category then
 
                 table.insert(cats, typeDef.category)
             if statutDef and statutDef.category then
                 table.insert(cats, statutDef.category)
             end
             end
         end
         end
Ligne 49 : Ligne 62 :
                 { cle = 'lieu_naissance', label = 'Lieu de naissance' },
                 { cle = 'lieu_naissance', label = 'Lieu de naissance' },
                 { cle = 'lieu_residence', label = 'Lieu de résidence' },
                 { cle = 'lieu_residence', label = 'Lieu de résidence' },
                 { cle = 'statut', label = 'Statut' },
                 { cle = 'statut', label = 'Statut' }
             }
             }
         },
         },
Ligne 58 : Ligne 71 :
                 { cle = 'organisation', label = 'Organisation' },
                 { cle = 'organisation', label = 'Organisation' },
                 { cle = 'role', label = 'Rôle' },
                 { cle = 'role', label = 'Rôle' },
                 { cle = 'croyances', label = 'Croyances' },
                 { cle = 'croyances', label = 'Croyances' }
             }
             }
         },
         },
Ligne 67 : Ligne 80 :
                 { cle = 'conjoint', label = 'Conjoint' },
                 { cle = 'conjoint', label = 'Conjoint' },
                 { cle = 'parents', label = 'Parents' },
                 { cle = 'parents', label = 'Parents' },
                 { cle = 'enfants', label = 'Enfants' },
                 { cle = 'enfants', label = 'Enfants' }
             }
             }
         },
         },
Ligne 76 : Ligne 89 :
                 { cle = 'taille', label = 'Taille' },
                 { cle = 'taille', label = 'Taille' },
                 { cle = 'poids', label = 'Poids' },
                 { cle = 'poids', label = 'Poids' },
                 { cle = 'traits', label = 'Traits' },
                 { cle = 'traits', label = 'Traits' }
             }
             }
         }
         }
Les témoins (''cookies'') nous aident à fournir nos services. En utilisant nos services, vous acceptez notre utilisation de témoins.