« Module:Fix » : différence entre les versions
Contenu supprimé Contenu ajouté
retouche de la modification précédente |
mw.html.attr gère directement les guillemets, pas la peine de s'en préoccuper ; échappement du point |
||
Ligne 70 : | Ligne 70 : | ||
end |
end |
||
args.titre = ( args.infobulle or '' ) |
args.titre = ( args.infobulle or '' ):gsub( '%.$', '' ) .. messageDate .. '.' |
||
:gsub( '.$', '' ) |
|||
:gsub( '"', '"' ) |
|||
.. messageDate |
|||
.. '.' |
|||
if args[1]:match('\n[ \t]*\n') |
if args[1]:match('\n[ \t]*\n') |
Version du 29 avril 2018 à 06:54
[voir] [modifier] [historique] [purger]
Module utilisé par le métamodèle {{Fix}}, et indirectement par le modèle {{Référence nécessaire}} et dérivés.
La documentation de ce module est générée par le modèle {{Documentation module}}.
Elle est incluse depuis sa sous-page de documentation. Veuillez placer les catégories sur cette page-là.
Les éditeurs peuvent travailler dans le bac à sable (modifier).
Voir les statistiques d'appel depuis le wikicode sur l'outil wstat et les appels depuis d'autres modules.
local p = {}
function p.necessiteCadre(frame)
local source = frame.args[1]
if source:match('\n[ \t]*\n') or source:match('\n[*#:]') then
return '1'
else
return ''
end
end
function p.affichageBloc( args )
local background = args.background or ''
if background == '' then
background = 'white'
end
local html = mw.html.create( '' )
:wikitext( '\n' )
:tag( 'div' )
:cssText( 'position:relative; margin-top:0.8em;')
:tag( 'div' )
:addClass( 'need_ref' )
:cssText( 'cursor:help; overflow:hidden; padding-bottom:0;' )
:css{ background = background }
:attr{ title = args.titre }
:wikitext( args[1], '\n' )
:done()
:tag( 'div' )
:addClass( 'need_ref_tag' )
:cssText( 'position:absolute; top:-0.6em; left:1em; padding:0 0.5em; font-size:80%; line-height:1em;')
:css{ background = background }
:wikitext( args.message )
:allDone()
return tostring( html )
end
function p.affichageInline( args )
local html = mw.html.create( '' )
if args[1] and args[1] ~= '' then
html:tag( 'span' )
:addClass( 'need_ref' )
:cssText( 'cursor:help;' )
:attr{ title = args.titre }
:wikitext( args[1] )
:done()
end
html:tag( 'sup' )
:addClass( 'need_ref_tag' )
:cssText ( 'padding-left:2px;' )
:wikitext( args.message )
:allDone()
return tostring( html )
end
function p.affichageFix( frame )
local args = frame.getParent and frame:getParent().args or frame
if args[1] and args[1] ~= '' then
local messageDate = ''
if args.date and args.date ~= '' then
messageDate = ' (demandé le ' .. args.date .. ')'
end
args.titre = ( args.infobulle or '' ):gsub( '%.$', '' ) .. messageDate .. '.'
if args[1]:match('\n[ \t]*\n')
or args[1]:match('\n[*#:]')
or args.bloc and args.bloc ~= ''
then
return p.affichageBloc( args )
end
end
return p.affichageInline( args )
end
return p