« Module:Infobox/Configs/Plugin » : différence entre les versions
De Nefald
Autres actions
Aucun résumé des modifications |
m Lien (processed) |
||
Ligne 53 : | Ligne 53 : | ||
champs = { | champs = { | ||
{ cle = 'bukkit', label = 'Bukkit', | { cle = 'bukkit', label = 'Bukkit', | ||
process = function(value) | process = function(value, args, frame) | ||
if value and value ~= '' then | |||
return frame:preprocess('[https://dev.bukkit.org/projects/' .. value .. ' Bukkit]') | |||
end | |||
return nil | |||
end | end | ||
}, | }, | ||
{ cle = 'hangar', label = 'Hangar (PaperMC)', | { cle = 'hangar', label = 'Hangar (PaperMC)', | ||
process = function(value) | process = function(value, args, frame) | ||
if value and value ~= '' then | |||
return frame:preprocess('[https://hangar.papermc.io/' .. value .. ' Hangar]') | |||
end | |||
return nil | |||
end | end | ||
}, | }, | ||
{ cle = 'modrinth', label = 'Modrinth', | { cle = 'modrinth', label = 'Modrinth', | ||
process = function(value) | process = function(value, args, frame) | ||
if value and value ~= '' then | |||
return frame:preprocess('[https://modrinth.com/plugin/' .. value .. ' Modrinth]') | |||
end | |||
return nil | |||
end | end | ||
}, | }, | ||
{ cle = 'builtbybit', label = 'BuiltByBit', | { cle = 'builtbybit', label = 'BuiltByBit', | ||
process = function(value) | process = function(value, args, frame) | ||
if value and value ~= '' then | |||
return frame:preprocess('[https://builtbybit.com/resources/' .. value .. ' BuiltByBit]') | |||
end | |||
return nil | |||
end | end | ||
}, | }, | ||
{ cle = 'spigot', label = 'Spigot', | { cle = 'spigot', label = 'Spigot', | ||
process = function(value) | process = function(value, args, frame) | ||
if value and value ~= '' then | |||
return frame:preprocess('[https://www.spigotmc.org/resources/' .. value .. ' Spigot]') | |||
end | |||
return nil | |||
end | end | ||
}, | }, | ||
{ cle = 'sources', label = 'Code source' } | { cle = 'sources', label = 'Code source', | ||
process = function(value, args, frame) | |||
if value and value ~= '' then | |||
-- Si c'est déjà un lien complet, le garder tel quel | |||
if value:match('^%[.+%]$') then | |||
return frame:preprocess(value) | |||
-- Sinon, créer un lien automatique | |||
elseif value:match('^https?://') then | |||
local domain = value:match('://([^/]+)') | |||
local siteName = 'Source' | |||
if domain:match('github%.com') then | |||
siteName = 'GitHub' | |||
elseif domain:match('gitlab%.com') then | |||
siteName = 'GitLab' | |||
elseif domain:match('bitbucket%.org') then | |||
siteName = 'Bitbucket' | |||
end | |||
return frame:preprocess('[' .. value .. ' ' .. siteName .. ']') | |||
else | |||
return value | |||
end | |||
end | |||
return nil | |||
end | |||
} | |||
} | } | ||
}, | }, | ||
Ligne 89 : | Ligne 128 : | ||
}, | }, | ||
categories = function(args, config, frame) | categories = function(args, config, frame) | ||
local cats = {} | local cats = {} | ||
table.insert(cats, 'Plugins Minecraft') | table.insert(cats, 'Plugins Minecraft') | ||
if args.type then | if args.type then | ||
local typeCategories = { | local typeCategories = { |
Version du 1 octobre 2025 à 13:01
La documentation pour ce module peut être créée à Module:Infobox/Configs/Plugin/doc
local config = {
titre = function(args)
return args.nom or '{{PAGENAME}}'
end,
icone = {
type = 'fas',
nom = 'puzzle-piece'
},
image = function(args)
if args.image then
return {
nom = args.image,
taille = args.tailleimage or "280x200px",
legende = args.legende or args.nom or '{{PAGENAME}}'
}
end
return nil
end,
sections = {
{
champs = {
{ cle = 'type', label = 'Type',
process = function(value, args)
local types = {
['économie'] = 'Économie',
['pvp'] = 'PvP',
['roleplay'] = 'Roleplay',
['administration'] = 'Administration',
['protection'] = 'Protection',
['cosmétique'] = 'Cosmétique',
['communication'] = 'Communication',
['utilitaire'] = 'Utilitaire',
['mini-jeu'] = 'Mini-jeu',
['monde'] = 'Monde',
['inventaire'] = 'Inventaire',
['transport'] = 'Transport',
['magie'] = 'Magie',
['mob'] = 'Mob'
}
return types[value] or value
end
},
{ cle = 'dev', label = 'Développeur' },
{ cle = 'status', label = 'Statut' },
{ cle = 'grade', label = 'Grade requis' }
}
},
{
titre = 'Téléchargements',
champs = {
{ cle = 'bukkit', label = 'Bukkit',
process = function(value, args, frame)
if value and value ~= '' then
return frame:preprocess('[https://dev.bukkit.org/projects/' .. value .. ' Bukkit]')
end
return nil
end
},
{ cle = 'hangar', label = 'Hangar (PaperMC)',
process = function(value, args, frame)
if value and value ~= '' then
return frame:preprocess('[https://hangar.papermc.io/' .. value .. ' Hangar]')
end
return nil
end
},
{ cle = 'modrinth', label = 'Modrinth',
process = function(value, args, frame)
if value and value ~= '' then
return frame:preprocess('[https://modrinth.com/plugin/' .. value .. ' Modrinth]')
end
return nil
end
},
{ cle = 'builtbybit', label = 'BuiltByBit',
process = function(value, args, frame)
if value and value ~= '' then
return frame:preprocess('[https://builtbybit.com/resources/' .. value .. ' BuiltByBit]')
end
return nil
end
},
{ cle = 'spigot', label = 'Spigot',
process = function(value, args, frame)
if value and value ~= '' then
return frame:preprocess('[https://www.spigotmc.org/resources/' .. value .. ' Spigot]')
end
return nil
end
},
{ cle = 'sources', label = 'Code source',
process = function(value, args, frame)
if value and value ~= '' then
-- Si c'est déjà un lien complet, le garder tel quel
if value:match('^%[.+%]$') then
return frame:preprocess(value)
-- Sinon, créer un lien automatique
elseif value:match('^https?://') then
local domain = value:match('://([^/]+)')
local siteName = 'Source'
if domain:match('github%.com') then
siteName = 'GitHub'
elseif domain:match('gitlab%.com') then
siteName = 'GitLab'
elseif domain:match('bitbucket%.org') then
siteName = 'Bitbucket'
end
return frame:preprocess('[' .. value .. ' ' .. siteName .. ']')
else
return value
end
end
return nil
end
}
}
},
{
titre = 'Compatibilité',
champs = {
{ cle = 'dépendance', label = 'Dépendances' },
{ cle = 'compatibilité', label = 'Compatible avec' }
}
}
},
categories = function(args, config, frame)
local cats = {}
table.insert(cats, 'Plugins Minecraft')
if args.type then
local typeCategories = {
['économie'] = 'Plugins d\'économie',
['pvp'] = 'Plugins de PvP',
['roleplay'] = 'Plugins de roleplay',
['administration'] = 'Plugins d\'administration',
['protection'] = 'Plugins de protection',
['cosmétique'] = 'Plugins cosmétiques',
['communication'] = 'Plugins de communication',
['utilitaire'] = 'Plugins utilitaires',
['mini-jeu'] = 'Plugins de mini-jeux',
['monde'] = 'Plugins de monde',
['inventaire'] = 'Plugins d\'inventaire',
['transport'] = 'Plugins de transport',
['magie'] = 'Plugins de magie',
['mob'] = 'Plugins de mobs'
}
if typeCategories[args.type] then
table.insert(cats, typeCategories[args.type])
end
end
return cats
end
}
return config