62 734
modifications
Création du module Icône qui remplacera le contenu du modèle Icône |
mAucun résumé des modifications |
||
(4 versions intermédiaires par le même utilisateur non affichées) | |||
Ligne 4 : | Ligne 4 : | ||
local DEFAULT_ICON_NAME = '_DEFAULT' | local DEFAULT_ICON_NAME = '_DEFAULT' | ||
local DEFAULT_SIZE = 'normal' | |||
local STANDARD_SIZE = { | local STANDARD_SIZE = { | ||
normal = '14', | normal = '14', | ||
Ligne 18 : | Ligne 19 : | ||
local tooltip = args['infobulle'] or args['tooltip'] or icon.tooltip | local tooltip = args['infobulle'] or args['tooltip'] or icon.tooltip | ||
local size = args[2] or | local size = args[2] or DEFAULT_SIZE | ||
size = STANDARD_SIZE[size] or string.gsub(size, 'px', '') | size = STANDARD_SIZE[size] or string.gsub(size, '[px]', '') | ||
return tostring(mw.html.create('span') | return tostring(mw.html.create('span') | ||
:css('cursor', 'help') | :css('cursor', 'help') | ||
:attr('title', tooltip) | :attr('title', tooltip) | ||
:wikitext('[[Fichier:'..filename..'|x'..size..'px|link='..link..']]') | :wikitext('[[Fichier:'..filename..'|'..size..'x'..size..'px|link='..link..']]') | ||
:allDone()) | :allDone()) | ||
end | |||
--[[ | |||
Fonction utilisée dans la doc du modèle pour présenter | |||
les cônes disponibles aux contributeurs | |||
]] | |||
function p.doc() | |||
local tabDefinition = '{| class="va-table va-table-center-col2" style="float:left;margin-right:4px;width:250px;"\n!style="width:70%;"|mot-clé!!style="width:30%;"|icône\n' | |||
local doc = tabDefinition | |||
keywords = {} | |||
for k in pairs(icons) do | |||
table.insert(keywords, k) | |||
end | |||
table.sort(keywords) | |||
local split = math.ceil(#keywords / 3) | |||
local n = 0 | |||
for k, v in ipairs(keywords) do | |||
if n > split then | |||
doc = doc..'\n|}' | |||
doc = doc..'\n'..tabDefinition | |||
n = 0 | |||
end | |||
n = n + 1 | |||
local icon = icons[v] | |||
doc = doc..'|-\n|<code>'..v..'</code>||[[Fichier:'..icon.filename..'|20x20px|link=]]\n' | |||
end | |||
doc = doc..'|}' | |||
return doc | |||
end | end | ||
modifications