|
|
| (14 versions intermédiaires par 2 utilisateurs non affichées) |
| Ligne 1 : |
Ligne 1 : |
| local configs = { | | local configs = {} |
| localite = {
| |
| sections = {
| |
| {
| |
| titre = 'Informations Générales',
| |
| champs = {
| |
| { cle = 'type', label = 'Type' },
| |
| { cle = 'fondation', label = 'Fondation' },
| |
| { cle = 'destruction', label = 'Destruction' },
| |
| { cle = 'fondateur', label = 'Fondateur(s)' },
| |
| { cle = 'symbole', label = 'Symbole' },
| |
| { cle = 'statut', label = 'Statut' },
| |
| { cle = 'x', label = 'Coordonnée X' }, -- Sera automatiquement groupé
| |
| { cle = 'y', label = 'Coordonnée Y' },
| |
| { cle = 'z', label = 'Coordonnée Z' }
| |
| }
| |
| },
| |
| {
| |
| titre = 'Organisation Interne',
| |
| champs = {
| |
| { cle = 'dirigeant', label = 'Dirigeant' },
| |
| { cle = 'population', label = 'Population' },
| |
| { cle = 'culte', label = 'Culte' },
| |
| { cle = 'organisation_rattachee', label = 'Organisation rattachée' }
| |
| }
| |
| },
| |
| {
| |
| titre = 'Économie et Société',
| |
| champs = {
| |
| { cle = 'activite', label = 'Activité' },
| |
| { cle = 'ressources', label = 'Ressources' }
| |
| }
| |
| },
| |
| {
| |
| titre = 'Géographie',
| |
| champs = {
| |
| { cle = 'monde', label = 'Monde' }
| |
| }
| |
| }
| |
| }
| |
| },
| |
|
| |
|
| monde = {
| | -- Charge dynamiquement les configurations depuis les sous-pages |
| titre = function(args) return args.nom or '{{PAGENAME}}' end,
| | local function loadConfig(configName) |
| image = function(args)
| | local success, config = pcall(require, 'Module:Infobox/Configs/' .. configName) |
| if args.image then
| | if success then |
| return '[[Fichier:' .. args.image .. '|300px]]'
| | return config |
| end
| | else |
| return nil
| | -- Fallback en cas d'erreur |
| end,
| | mw.log('Erreur lors du chargement de la configuration: ' .. configName) |
| sections = {
| | return nil |
| {
| | end |
| titre = 'Spécificités',
| | end |
| champs = {
| | |
| { cle = 'seed', label = 'Seed' },
| | -- Charge toutes les configurations disponibles (manuellement) |
| { cle = 'monde', label = 'Type de monde' },
| | configs.localite = loadConfig('Localite') |
| { cle = 'x', label = 'Coordonnée X' }, -- Sera automatiquement groupé
| | configs.monde = loadConfig('Monde') |
| { cle = 'y', label = 'Coordonnée Y' }, -- Sera automatiquement groupé
| | configs.plugin = loadConfig('Plugin') |
| { cle = 'z', label = 'Coordonnée Z' } -- Sera automatiquement groupé
| | |
| }
| | -- Fonction pour ajouter dynamiquement d'autres configurations (automatiquement) |
| },
| | function configs.load(configName) |
| {
| | if not configs[configName:lower()] then |
| titre = 'Informations',
| | configs[configName:lower()] = loadConfig(configName) |
| champs = {
| | end |
| { cle = 'status', label = 'Status' },
| | return configs[configName:lower()] |
| { cle = 'difficulte', label = 'Difficulté' }
| | end |
| }
| |
| }
| |
| }
| |
| } | |
| }
| |
|
| |
|
| return configs | | return configs |