Module:Icône de titre
Révision datée du 16 juillet 2014 à 22:48 par Modèle>Hlm Z. (Nouvelle page : local p = {} function p.main(frame) local args = {} local argsParent = frame:getParent().args --Paramètres vides interprétés par Lua for cle, val in pairs(argsParent) do...)
La documentation pour ce module peut être créée à Module:Icône de titre/doc
local p = {}
function p.main(frame)
local args = {}
local argsParent = frame:getParent().args
--Paramètres vides interprétés par Lua
for cle, val in pairs(argsParent) do
if val ~= '' then
--args[cle] = mw.text.trim(val)
args[mw.ustring.lower(cle)] = mw.text.trim(val)
end
end
return p._main(args)
end
function p._main(args)
local res = mw.html.create('div')
local fichierWiki = '[[Fichier:%s|%spx|link=%s|%s|alt=%s]]'
res
:addClass('icone_de_titre')
:css('display', 'none')
:css('float', 'right')
:css('margin-top', '1em')
:tag('span')
:attr('title', args.texte or 'Exemple de texte')
:wikitext(mw.ustring.format(fichierWiki,
args.image or 'Fairytale bookmark.png',
args.taille or 20,
args.lien or 'Modèle:Icône de titre',
args['paramètre'] or '',
args.texte or 'Exemple de texte'))
return tostring(res)
end
return p