« Module:Infobox/Configs/Plugin » : différence entre les versions
De Nefald
Autres actions
mAucun résumé des modifications |
m terraforming |
||
| (14 versions intermédiaires par le même utilisateur non affichées) | |||
| Ligne 33 : | Ligne 33 : | ||
-- Configuration locale des types | -- Configuration locale des types | ||
local typeValues = { | local typeValues = { | ||
['api'] = 'API', | |||
['économie'] = 'Économie', | ['économie'] = 'Économie', | ||
['pvp'] = 'PvP', | ['pvp'] = 'PvP', | ||
| Ligne 38 : | Ligne 39 : | ||
['administration'] = 'Administration', | ['administration'] = 'Administration', | ||
['protection'] = 'Protection', | ['protection'] = 'Protection', | ||
['premium'] = 'Premium', | |||
['cosmétique'] = 'Cosmétique', | ['cosmétique'] = 'Cosmétique', | ||
['communication'] = 'Communication', | ['communication'] = 'Communication', | ||
['construction'] = 'Construction', | |||
['utilitaire'] = 'Utilitaire', | ['utilitaire'] = 'Utilitaire', | ||
['mini-jeu'] = 'Mini-jeu', | ['mini-jeu'] = 'Mini-jeu', | ||
['modération'] = 'Modération', | |||
['monde'] = 'Monde', | ['monde'] = 'Monde', | ||
['inventaire'] = 'Inventaire', | ['inventaire'] = 'Inventaire', | ||
['terraforming'] = 'Terraforming', | |||
['transport'] = 'Transport', | ['transport'] = 'Transport', | ||
['magie'] = 'Magie', | ['magie'] = 'Magie', | ||
| Ligne 49 : | Ligne 54 : | ||
} | } | ||
local cleanValue = mw.text.trim(mw.ustring.lower( | -- Séparer par virgule et traiter chaque type | ||
local types = mw.text.split(value, ',') | |||
local displayTypes = {} | |||
local hasError = false | |||
local errorMsg = '' | |||
for _, typeItem in ipairs(types) do | |||
local cleanValue = mw.text.trim(mw.ustring.lower(typeItem)) | |||
if typeValues[cleanValue] then | |||
table.insert(displayTypes, typeValues[cleanValue]) | |||
else | |||
hasError = true | |||
errorMsg = errorMsg .. '<span style="color: red; font-weight: bold;">Type invalide: "' .. typeItem .. '"</span> ' | |||
end | |||
end | |||
if | if hasError then | ||
return | return errorMsg .. '[[Catégorie:Pages avec erreurs]]' | ||
end | end | ||
-- Joindre les types avec ", " pour l'affichage | |||
return table.concat(displayTypes, ', ') | |||
end | end | ||
}, | }, | ||
| Ligne 69 : | Ligne 90 : | ||
-- Configuration locale des statuts | -- Configuration locale des statuts | ||
local statusValues = { | local statusValues = { | ||
['installé'] = '[[Plugin installé|Installé]]', | ['installé'] = '[[:Catégorie:Plugin installé|Installé]]', | ||
['non-installé'] = '[[Plugin non-installé|Non-installé]]' | ['non-installé'] = '[[:Catégorie:Plugin non-installé|Non-installé]]' | ||
} | } | ||
| Ligne 86 : | Ligne 107 : | ||
}, | }, | ||
{ | { | ||
titre = ' | titre = 'Ressources', | ||
champs = { | champs = { | ||
{ cle = 'docs', label = 'Documentation', | |||
process = function(value, args, frame) | |||
if value and value ~= '' then | |||
if value:match('^%[.+%]$') then | |||
return frame:preprocess(value) | |||
elseif value:match('^https?://') then | |||
return frame:preprocess('[' .. value .. ' Documentation]') | |||
else | |||
return '[[' .. value .. ']]' | |||
end | |||
end | |||
return nil | |||
end | |||
}, | |||
{ cle = 'website', label = 'Site web', | |||
process = function(value, args, frame) | |||
if value and value ~= '' then | |||
if value:match('^%[.+%]$') then | |||
return frame:preprocess(value) | |||
elseif value:match('^https?://') then | |||
return frame:preprocess('[' .. value .. ' Site web]') | |||
else | |||
return '[[' .. value .. ']]' | |||
end | |||
end | |||
return nil | |||
end | |||
}, | |||
{ cle = 'bukkit', label = 'Bukkit', | { cle = 'bukkit', label = 'Bukkit', | ||
process = function(value, args, frame) | process = function(value, args, frame) | ||
| Ligne 96 : | Ligne 145 : | ||
end | end | ||
}, | }, | ||
{ cle = 'hangar', label = 'Hangar | { cle = 'hangar', label = 'Hangar', | ||
process = function(value, args, frame) | process = function(value, args, frame) | ||
if value and value ~= '' then | if value and value ~= '' then | ||
| Ligne 116 : | Ligne 165 : | ||
if value and value ~= '' then | if value and value ~= '' then | ||
return frame:preprocess('[https://builtbybit.com/resources/' .. value .. ' BuiltByBit]') | return frame:preprocess('[https://builtbybit.com/resources/' .. value .. ' BuiltByBit]') | ||
end | |||
return nil | |||
end | |||
}, | |||
{ cle = 'polymart', label = 'Polymart', | |||
process = function(value, args, frame) | |||
if value and value ~= '' then | |||
return frame:preprocess('[https://polymart.org/product/' .. value .. ' Polymart]') | |||
end | end | ||
return nil | return nil | ||
| Ligne 156 : | Ligne 213 : | ||
titre = 'Compatibilité', | titre = 'Compatibilité', | ||
champs = { | champs = { | ||
{ cle = 'dépendance', label = ' | { cle = 'dépendance', label = 'Dépendance(s)' }, | ||
{ cle = 'compatibilité', label = 'Compatible avec' } | { cle = 'compatibilité', label = 'Compatible avec' } | ||
} | } | ||
| Ligne 167 : | Ligne 224 : | ||
-- Configuration des catégories par type | -- Configuration des catégories par type | ||
local typeCategories = { | local typeCategories = { | ||
['économie'] = ' | ['api'] = 'Plugin d\'API', | ||
['pvp'] = ' | ['économie'] = 'Plugin d\'économie', | ||
['roleplay'] = ' | ['pvp'] = 'Plugin de PvP', | ||
['administration'] = ' | ['roleplay'] = 'Plugin de roleplay', | ||
['protection'] = ' | ['administration'] = 'Plugin d\'administration', | ||
['cosmétique'] = ' | ['protection'] = 'Plugin de protection', | ||
['communication'] = ' | ['cosmétique'] = 'Plugin cosmétique', | ||
['utilitaire'] = ' | ['communication'] = 'Plugin de communication', | ||
['mini-jeu'] = ' | ['construction'] = 'Plugin de construction', | ||
['monde'] = ' | ['utilitaire'] = 'Plugin utilitaire', | ||
['inventaire'] = ' | ['mini-jeu'] = 'Plugin de mini-jeux', | ||
['transport'] = ' | ['modération'] = 'Plugin de modération', | ||
['magie'] = ' | ['premium'] = 'Plugin premium', | ||
['mob'] = ' | ['monde'] = 'Plugin de monde', | ||
['inventaire'] = 'Plugin d\'inventaire', | |||
['terraforming'] = 'Plugin de terraforming', | |||
['transport'] = 'Plugin de transport', | |||
['magie'] = 'Plugin de magie', | |||
['mob'] = 'Plugin de mobs' | |||
} | } | ||
-- Configuration des catégories par statut | -- Configuration des catégories par statut | ||
local statusCategories = { | local statusCategories = { | ||
['installé'] = ' | ['installé'] = 'Plugin installé', | ||
['non-installé'] = ' | ['non-installé'] = 'Plugin non-installé' | ||
} | } | ||
-- | -- Catégories basées sur le(s) type(s) | ||
if args.type then | if args.type then | ||
local cleanType = mw.text.trim(mw.ustring.lower( | -- Séparer par virgule et traiter chaque type | ||
local types = mw.text.split(args.type, ',') | |||
for _, typeItem in ipairs(types) do | |||
local cleanType = mw.text.trim(mw.ustring.lower(typeItem)) | |||
if typeCategories[cleanType] then | |||
table.insert(cats, typeCategories[cleanType]) | |||
end | |||
end | end | ||
end | end | ||