« Module:Infobox/Configs/Plugin » : différence entre les versions
De Nefald
Autres actions
m Retrait catégorie:Plugin Minecraft |
statut > autocatégorisation |
||
| Ligne 19 : | Ligne 19 : | ||
return nil | return nil | ||
end, | end, | ||
-- Configuration des valeurs validées | |||
statusField = { | |||
allowedValues = { | |||
['installé'] = { | |||
display = '[[Plugin installé|Installé]]', | |||
category = 'Plugins installés' | |||
}, | |||
['non-installé'] = { | |||
display = '[[Plugin non-installé|Non-installé]]', | |||
category = 'Plugins non-installés' | |||
} | |||
} | |||
}, | |||
typeField = { | |||
allowedValues = { | |||
['économie'] = { | |||
display = 'Économie', | |||
category = 'Plugins d\'économie' | |||
}, | |||
['pvp'] = { | |||
display = 'PvP', | |||
category = 'Plugins de PvP' | |||
}, | |||
['roleplay'] = { | |||
display = 'Roleplay', | |||
category = 'Plugins de roleplay' | |||
}, | |||
['administration'] = { | |||
display = 'Administration', | |||
category = 'Plugins d\'administration' | |||
}, | |||
['protection'] = { | |||
display = 'Protection', | |||
category = 'Plugins de protection' | |||
}, | |||
['cosmétique'] = { | |||
display = 'Cosmétique', | |||
category = 'Plugins cosmétiques' | |||
}, | |||
['communication'] = { | |||
display = 'Communication', | |||
category = 'Plugins de communication' | |||
}, | |||
['utilitaire'] = { | |||
display = 'Utilitaire', | |||
category = 'Plugins utilitaires' | |||
}, | |||
['mini-jeu'] = { | |||
display = 'Mini-jeu', | |||
category = 'Plugins de mini-jeux' | |||
}, | |||
['monde'] = { | |||
display = 'Monde', | |||
category = 'Plugins de monde' | |||
}, | |||
['inventaire'] = { | |||
display = 'Inventaire', | |||
category = 'Plugins d\'inventaire' | |||
}, | |||
['transport'] = { | |||
display = 'Transport', | |||
category = 'Plugins de transport' | |||
}, | |||
['magie'] = { | |||
display = 'Magie', | |||
category = 'Plugins de magie' | |||
}, | |||
['mob'] = { | |||
display = 'Mob', | |||
category = 'Plugins de mobs' | |||
} | |||
} | |||
}, | |||
sections = { | sections = { | ||
{ | { | ||
champs = { | champs = { | ||
{ cle = 'type', label = 'Type', | { | ||
cle = 'type', | |||
label = 'Type', | |||
process = function(value, args) | |||
if not value or value == '' then | |||
return nil | |||
end | |||
[ | |||
local cleanValue = mw.text.trim(mw.ustring.lower(value)) | |||
local typeConfig = config.typeField.allowedValues[cleanValue] | |||
if typeConfig then | |||
return typeConfig.display | |||
else | |||
return '<span style="color: red; font-weight: bold;">Type invalide: "' .. value .. '"</span>[[Catégorie:Pages avec erreurs]]' | |||
end | |||
end | |||
}, | }, | ||
{ cle = 'dev', label = 'Développeur' }, | { cle = 'dev', label = 'Développeur' }, | ||
{ cle = 'status', label = 'Statut' }, | { | ||
cle = 'status', | |||
label = 'Statut', | |||
process = function(value, args) | |||
if not value or value == '' then | |||
return nil | |||
end | |||
local cleanValue = mw.text.trim(mw.ustring.lower(value)) | |||
local statusConfig = config.statusField.allowedValues[cleanValue] | |||
if statusConfig then | |||
return statusConfig.display | |||
else | |||
return '<span style="color: red; font-weight: bold;">Statut invalide: "' .. value .. '"</span>[[Catégorie:Pages avec erreurs]]' | |||
end | |||
end | |||
}, | |||
{ cle = 'grade', label = 'Grade requis' } | { cle = 'grade', label = 'Grade requis' } | ||
} | } | ||
| Ligne 95 : | Ligne 184 : | ||
process = function(value, args, frame) | process = function(value, args, frame) | ||
if value and value ~= '' then | if value and value ~= '' then | ||
if value:match('^%[.+%]$') then | if value:match('^%[.+%]$') then | ||
return frame:preprocess(value) | return frame:preprocess(value) | ||
elseif value:match('^https?://') then | elseif value:match('^https?://') then | ||
local domain = value:match('://([^/]+)') | local domain = value:match('://([^/]+)') | ||
| Ligne 131 : | Ligne 218 : | ||
local cats = {} | local cats = {} | ||
-- Catégorie basée sur le type | |||
if args.type then | if args.type then | ||
local | local cleanType = mw.text.trim(mw.ustring.lower(args.type)) | ||
local typeConfig = config.typeField.allowedValues[cleanType] | |||
if typeConfig then | |||
table.insert(cats, typeConfig.category) | |||
end | |||
end | |||
-- Catégorie basée sur le statut | |||
if args.status then | |||
local cleanStatus = mw.text.trim(mw.ustring.lower(args.status)) | |||
local statusConfig = config.statusField.allowedValues[cleanStatus] | |||
if statusConfig then | |||
table.insert(cats, statusConfig.category) | |||
if | |||
table.insert(cats, | |||
end | end | ||
end | end | ||