Module:Bandeau

De Lagny-sur-Marne Wiki
Aller à la navigation Aller à la recherche

--Ce module implémente le modèle Modèle:Bandeau.

local p = {}

p.classStructureBoite = 'bandeau-simple plainlinks' p.styleStructureBoite = 'width:80%; margin:0 auto 1em; padding:0.5em; background:#f9f9f9; border-color:#aaa;' p.styleStructureImage = 'display:table-cell; vertical-align:middle; width:50px;' p.styleStructureTexte = 'display:table-cell; vertical-align:middle;'

local TableBuilder = require('Module:TableBuilder')

function p.bandeau(frame) args = frame:getParent().args tab = TableBuilder.new()

structureHtml('div', p.classStructureBoite, p.styleStructureBoite) structureHtml('div', nil, p.styleStructureImage, args.image) structureHtmlFin('div') structureHtml('p', nil, p.styleStructureTexte, args.texte) structureHtmlFin('p') structureHtmlFin('div')

   --Code HTML brut
   if args.raw then
   	res = frame:preprocess('' .. tab.concat() .. '') .. '\n:Éxecution : ' .. os.clock() .. 's'
       return res

else return tab.concat() end end

function structureHtml(balise, class, style, contenu) tab.insert('<') .insert(balise)

if class then tab.insert(' class="') .insert(class) .insert('"') end

if style then tab.insert(' style="') .insert(style) .insert('"') end

tab.insert('>') .insert(contenu) end

function structureHtmlFin(balise) tab.minsert('</', balise, '>') end

return p