« Module:Infobox/Configs/Mythe » : différence entre les versions
De Nefald
Autres actions
Page créée avec « local config = { titre = function(args) return args.nom or '{{PAGENAME}}' end, image = function(args) if args.image then return '300px' end return nil end, sections = { { titre = 'Informations générales', champs = { { cle = 'type', label = 'Type' }, { cle = 'territoire', label = "Territoire d'influenc... » |
Aucun résumé des modifications |
||
| (Une version intermédiaire par un autre utilisateur non affichée) | |||
| 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, | ||
icone = { | |||
type = 'fas', | |||
nom = 'hands-praying' | |||
}, | |||
image = function(args) | image = function(args) | ||
if args.image then | if args.image then | ||
| Ligne 10 : | 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 20 : | 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 29 : | 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 35 : | Ligne 114 : | ||
titre = 'Culte', | titre = 'Culte', | ||
champs = { | champs = { | ||
{ cle = 'veneration', label = 'Vénération' } | { cle = 'veneration', label = 'Vénération' } | ||
} | } | ||
} | } | ||