« Module:Infobulle » : différence entre les versions
Page créée avec « local p = {} function p._build(args) local text = args['texte'] or args[1] or 'Texte ?' local title = args['titre'] or args[2] or 'Infobulle ?' local link = args['lien… » |
mAucun résumé des modifications |
||
Ligne 13 : | Ligne 13 : | ||
:wikitext(text) | :wikitext(text) | ||
:allDone() | :allDone() | ||
tooltip = tostring(tooltip) | |||
if link then | if link then | ||
tooltip = '[[' .. link .. '|' .. | tooltip = '[[' .. link .. '|' .. tooltip .. ']]' | ||
end | end | ||
Dernière version du 1 août 2021 à 13:21
La documentation pour ce module peut être créée à Module:Infobulle/doc
local p = {}
function p._build(args)
local text = args['texte'] or args[1] or 'Texte ?'
local title = args['titre'] or args[2] or 'Infobulle ?'
local link = args['lien'] or args[3]
local style = args['style'] or ''
local tooltip = mw.html.create( 'span' )
:addClass( 'avt-tooltip' )
:attr('style', style)
:attr('title', title)
:wikitext(text)
:allDone()
tooltip = tostring(tooltip)
if link then
tooltip = '[[' .. link .. '|' .. tooltip .. ']]'
end
return tooltip
end
function p.build(frame)
local args = {}
local argsParent = frame:getParent().args
for cle, val in pairs(argsParent) do
if val then
args[cle] = mw.text.trim(val)
end
end
return p._build(args)
end
return p