Module:Infobox/Titre
Aller à la navigation
Aller à la recherche
La documentation pour ce module peut être créée à Module:Infobox/Titre/doc
local p = {} local trim = require( 'Module:Outils' ).trim local yesno = require( 'Module:Yesno' ) function p.templatestyles( pictogramme ) pictogramme = trim( pictogramme ) if not pictogramme then return '' end pictogramme = pictogramme :gsub( '^entete +', '' ) :gsub( '^entete$', '' ) :gsub( ' +entete$', '' ) :gsub( ' +entete +', ' ' ) if pictogramme ~= '' and pictogramme ~= 'defaut' then if pictogramme:match( '%s' ) then return '[[Catégorie:Infobox avec plusieurs class]]' else return mw.getCurrentFrame():extensionTag( 'templatestyles', '', { src = 'Infobox/Pictogramme/' .. pictogramme .. '.css' } ) end end return '' end function p.couleurs( background, color ) local couleur = require( 'Module:Dièse couleur web' ).couleur background = trim( background ) or '#E1E1E1' color = trim( color ) or 'black' return 'background-color:' .. couleur( background ) .. ';' .. 'color:' .. couleur( color ) .. ';' end function p.V2( frame ) local args = frame.getParent and frame:getParent().args or frame local colspan = trim( args[ 5 ] ) or '2' local texte = trim( args[ 1 ] ) or mw.title.getCurrentTitle().text local classes = trim( args[ 3 ] ) or 'defaut' local lang = args[ 'lang' ] or '' local italic = args[ 'italic' ] or '' local setDisplayTitle = args[ 'setdisplaytitle' ] or '' if lang ~= '' then local langueFunction = require( 'Module:Langue' ).langue texte = langueFunction( { lang, texte } ) end if italic ~= '' and yesno( italic ) then classes = classes .. ' italique' end local displayTitleEval = '' if setDisplayTitle ~= '' and yesno( setDisplayTitle ) then local setDisplayTitleFunction = require( 'Module:Formatage du titre' ).setDisplayTitle displayTitleEval = setDisplayTitleFunction( { args = { lang = lang, italic = italic, options = 'noreplace' } } ) end return 'colspan="' .. colspan .. '" ' .. 'class="entete ' .. classes .. '" ' .. 'style="' .. p.couleurs( args[ 2 ], args[ 4 ] ) .. '" ' .. ' | ' .. texte .. p.templatestyles( args[ 3 ] ) .. displayTitleEval end return p