Balises : Modification par mobile Modification par le web mobile |
|
(19 versions intermédiaires par 2 utilisateurs non affichées) |
Ligne 1 : |
Ligne 1 : |
| local configs = { | | local configs = {} |
| construction = {
| | |
| sections = {
| | -- Charge dynamiquement les configurations depuis les sous-pages |
| {
| | local function loadConfig(configName) |
| title = "Définition",
| | local success, config = pcall(require, 'Module:Infobox/Configs/' .. configName) |
| fields = {"auteur", "fonction"}
| | if success then |
| },
| | return config |
| {
| | else |
| title = "Géographie",
| | -- Fallback en cas d'erreur |
| fields = {"monde", "ville", "guilde", "coordonnees"}
| | mw.log('Erreur lors du chargement de la configuration: ' .. configName) |
| }
| | return nil |
| },
| | end |
| fields = {
| | end |
| {key = "auteur", label = "Auteur"},
| | |
| {key = "fonction", label = "Fonction"},
| | -- Charge toutes les configurations disponibles (manuellement) |
| {key = "monde", label = "Monde", link = true},
| | configs.localite = loadConfig('Localite') |
| {key = "ville", label = "Ville", link = true},
| | configs.monde = loadConfig('Monde') |
| {key = "guilde", label = "Guilde", link = true},
| | configs.plugin = loadConfig('Plugin') |
| {key = "coordonnees", label = "Coordonnées"}
| | |
| } | | -- Fonction pour ajouter dynamiquement d'autres configurations (automatiquement) |
| },
| | function configs.load(configName) |
|
| | if not configs[configName:lower()] then |
| monde = { | | configs[configName:lower()] = loadConfig(configName) |
| sections = {
| | end |
| {
| | return configs[configName:lower()] |
| title = "Informations techniques",
| | end |
| fields = {"seed", "type", "status", "difficulte"}
| |
| },
| |
| {
| |
| title = "Géographie",
| |
| fields = {"coordonnees"}
| |
| }
| |
| }, | |
| fields = { | |
| {key = "seed", label = "Seed"},
| |
| {key = "type", label = "Type"},
| |
| {key = "status", label = "Status"},
| |
| {key = "difficulte", label = "Difficulté"},
| |
| {key = "coordonnees", label = "Coordonnées"}
| |
| } | |
| }, | |
|
| |
| ville = {
| |
| sections = {
| |
| {
| |
| title = "Informations générales",
| |
| fields = {"fondation", "bourgmestre", "guilde", "spec", "projet"}
| |
| },
| |
| {
| |
| title = "Économie",
| |
| fields = {"production", "commerce"}
| |
| },
| |
| {
| |
| title = "Géographie",
| |
| fields = {"monde", "region", "coordonnees", "biome"}
| |
| }
| |
| },
| |
| fields = {
| |
| {key = "fondation", label = "Fondation"},
| |
| {key = "bourgmestre", label = "Bourgmestre"},
| |
| {key = "guilde", label = "Guilde(s)"},
| |
| {key = "spec", label = "Spécificité(s)"},
| |
| {key = "projet", label = "Projet"},
| |
| {key = "production", label = "Production"},
| |
| {key = "commerce", label = "Liens commerciaux"},
| |
| {key = "monde", label = "Monde", link = true},
| |
| {key = "region", label = "Région(s)"},
| |
| {key = "coordonnees", label = "Coordonnées"},
| |
| {key = "biome", label = "Biome(s)"}
| |
| }
| |
| }, | |
|
| |
| personnage = {
| |
| sections = { | |
| {
| |
| title = "Informations générales",
| |
| fields = {"surnom", "race", "classe", "niveau"}
| |
| },
| |
| {
| |
| title = "Affiliation",
| |
| fields = {"guilde", "origine"}
| |
| }
| |
| },
| |
| fields = {
| |
| {key = "surnom", label = "Surnom"},
| |
| {key = "race", label = "Race"},
| |
| {key = "classe", label = "Classe"},
| |
| {key = "niveau", label = "Niveau"},
| |
| {key = "guilde", label = "Guilde", link = true},
| |
| {key = "origine", label = "Origine"}
| |
| }
| |
| },
| |
| | |
| roleplay = { | |
| sections = {
| |
| {
| |
| title = "Informations",
| |
| fields = {"maitre_jeu", "participants", "duree", "statut"}
| |
| }
| |
| },
| |
| fields = {
| |
| {key = "maitre_jeu", label = "Maître du jeu"},
| |
| {key = "participants", label = "Participants"},
| |
| {key = "duree", label = "Durée"},
| |
| {key = "statut", label = "Statut"}
| |
| }
| |
| },
| |
|
| |
| plugin = {
| |
| sections = {
| |
| {
| |
| title = "Informations techniques",
| |
| fields = {"version", "auteur", "compatibilite", "dependances"}
| |
| }
| |
| },
| |
| fields = {
| |
| {key = "version", label = "Version"},
| |
| {key = "auteur", label = "Auteur"},
| |
| {key = "compatibilite", label = "Compatibilité"},
| |
| {key = "dependances", label = "Dépendances"}
| |
| }
| |
| }
| |
| }
| |
|
| |
|
| return configs | | return configs |
La documentation pour ce module peut être créée à Module:Infobox/Configs/doc
local configs = {}
-- Charge dynamiquement les configurations depuis les sous-pages
local function loadConfig(configName)
local success, config = pcall(require, 'Module:Infobox/Configs/' .. configName)
if success then
return config
else
-- Fallback en cas d'erreur
mw.log('Erreur lors du chargement de la configuration: ' .. configName)
return nil
end
end
-- Charge toutes les configurations disponibles (manuellement)
configs.localite = loadConfig('Localite')
configs.monde = loadConfig('Monde')
configs.plugin = loadConfig('Plugin')
-- Fonction pour ajouter dynamiquement d'autres configurations (automatiquement)
function configs.load(configName)
if not configs[configName:lower()] then
configs[configName:lower()] = loadConfig(configName)
end
return configs[configName:lower()]
end
return configs