Module:Fix

De PN Wiki
Aller à la navigation Aller à la recherche

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