« Module:IconUtils » : différence entre les versions
De Eco - Wiki Français
| [version vérifiée] | [version vérifiée] |
Aucun résumé des modifications |
Aucun résumé des modifications |
||
| Ligne 2 : | Ligne 2 : | ||
function p.main(param) | function p.main(param) | ||
local Utils = require( | local Utils = require('Module:Utils') | ||
local args = Utils.normalise(param) | local args = Utils.normalise(param) | ||
if | if args.id == nil or args.id == '' then | ||
return | return 'Module:IconUtils \'id\' must be specified.' | ||
end | end | ||
local | -- Récupérer le nom via l'ID | ||
local itemName = args.name or Utils.ItemSearch(args.id) | |||
if not itemName or itemName == 'None' then | |||
itemName = args.id | |||
end | |||
local Icon = args.id .. '_Icon.png' | |||
local | local IconSize = (args.size == nil or args.size == '') and 28 or args.size | ||
local IconStyle = (args.style == nil or args.style == '') and '1' or args.style | |||
local IconLink = '' | |||
if args.link == '1' then | |||
IconLink = '[[' .. itemName .. ']]' | |||
elseif args.link and args.link ~= '' then | |||
IconLink = '[[' .. args.link .. ']]' | IconLink = '[[' .. args.link .. ']]' | ||
end | end | ||
local | local IconTextLine = IconLink ~= '' and ' ' .. IconLink or ' ' .. itemName | ||
local IconTextBr = IconLink ~= '' and '<br>' .. IconLink or '<br>' .. itemName | |||
local IconTextBr = | |||
if IconStyle == '1' then | if IconStyle == '1' then return '[[file:'.. Icon ..'|'.. IconSize ..'px|link='.. IconLink ..']]' end | ||
if IconStyle == '2' then return '[[file:'.. Icon ..'|'.. IconSize ..'px|link='.. IconLink ..']]' .. IconTextLine end | |||
if IconStyle == '3' then return '[[file:'.. Icon ..'|'.. IconSize ..'px|link='.. IconLink ..']]' .. IconTextBr end | |||
if IconStyle == '2' then | if IconStyle == '4' then return '<div class="IconFrame">[[file:'.. Icon ..'|'.. IconSize ..'px|link='.. IconLink ..']]' .. IconTextBr .. '</div>' end | ||
if IconStyle == '3' then | |||
if IconStyle == '4' then | |||
end | end | ||
return p | return p | ||
Version du 16 novembre 2025 à 10:48
La documentation pour ce module peut être créée à Module:IconUtils/doc
local p = {}
function p.main(param)
local Utils = require('Module:Utils')
local args = Utils.normalise(param)
if args.id == nil or args.id == '' then
return 'Module:IconUtils \'id\' must be specified.'
end
-- Récupérer le nom via l'ID
local itemName = args.name or Utils.ItemSearch(args.id)
if not itemName or itemName == 'None' then
itemName = args.id
end
local Icon = args.id .. '_Icon.png'
local IconSize = (args.size == nil or args.size == '') and 28 or args.size
local IconStyle = (args.style == nil or args.style == '') and '1' or args.style
local IconLink = ''
if args.link == '1' then
IconLink = '[[' .. itemName .. ']]'
elseif args.link and args.link ~= '' then
IconLink = '[[' .. args.link .. ']]'
end
local IconTextLine = IconLink ~= '' and ' ' .. IconLink or ' ' .. itemName
local IconTextBr = IconLink ~= '' and '<br>' .. IconLink or '<br>' .. itemName
if IconStyle == '1' then return '[[file:'.. Icon ..'|'.. IconSize ..'px|link='.. IconLink ..']]' end
if IconStyle == '2' then return '[[file:'.. Icon ..'|'.. IconSize ..'px|link='.. IconLink ..']]' .. IconTextLine end
if IconStyle == '3' then return '[[file:'.. Icon ..'|'.. IconSize ..'px|link='.. IconLink ..']]' .. IconTextBr end
if IconStyle == '4' then return '<div class="IconFrame">[[file:'.. Icon ..'|'.. IconSize ..'px|link='.. IconLink ..']]' .. IconTextBr .. '</div>' end
end
return p