« Module:Bandeau » : différence entre les versions

De Lagny-sur-Marne Wiki
Aller à la navigation Aller à la recherche
0x010D (discussion | contributions)
Aucun résumé des modifications
0x010D (discussion | contributions)
Aucun résumé des modifications
Ligne 12 : Ligne 12 :
function p.bandeau(frame)
function p.bandeau(frame)
args = frame:getParent().args
args = frame:getParent().args
local tab = TableBuilder.new()
tab = TableBuilder.new()
 
tab.insert(structureHtml('div', p.classStructureBoite, p.styleStructureBoite))
structureHtml('div', p.classStructureBoite, p.styleStructureBoite)
structureHtmlFin('div')
 
return tab.concat()
return tab.concat()
end
end


function structureHtml(balise, class, style)
function structureHtml(balise, class, style)
local tab = TableBuilder.new()
tab.insert('<' .. balise .. ' ')
tab.insert('<' .. balise .. ' ')
if class and style then
if class and style then
Ligne 29 : Ligne 28 :
else
else
tab.insert(class or style)
tab.insert(class or style)
  .insert(args.contenu or 'Lorem')
end
end
end
function structureHtmlFin(balise)
tab.insert('>')
tab.insert('>')
  .insert(args.contenu or 'Lorem')
  .insert('</' .. balise .. '>')
  .insert('</' .. balise .. '>')
return tab.concat()
end
end


return p
return p

Version du 9 février 2014 à 21:39

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

local p = {}

p.classStructureBoite = 'class="bandeau-simple"' p.styleStructureBoite = 'style="width:80%; margin:0 auto 1em; padding:0.5em; background:#f9f9f9; border-color:#aaa;"' p.styleStructureImage = 'style="display:table-cell; vertical-align:middle; width:50px;"' p.styleStructureTexte = 'style="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) structureHtmlFin('div')

return tab.concat() end

function structureHtml(balise, class, style) tab.insert('<' .. balise .. ' ') if class and style then tab.insert(class) .insert(' ') .insert(style) else tab.insert(class or style) .insert(args.contenu or 'Lorem') end end

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

return p