« Module:Bandeau » : différence entre les versions
Aller à la navigation
Aller à la recherche
Modèle>Hlm Z. Aucun résumé des modifications |
Modèle>Hlm Z. Aucun résumé des modifications |
||
| Ligne 14 : | Ligne 14 : | ||
tab = TableBuilder.new() | tab = TableBuilder.new() | ||
structureHtml('div', p.classStructureBoite, p.styleStructureBoite) | structureHtml('div', p.classStructureBoite, p.styleStructureBoite, args.contenu) | ||
structureHtml('div', nil, p.styleStructureBoite, args.image) | |||
structureHtmlFin('div') | |||
structureHtml('p', nil, p.styleStructureTexte, args.texte) | |||
structureHtmlFin('p') | |||
structureHtmlFin('div') | |||
structureHtmlFin('div') | structureHtmlFin('div') | ||
| Ligne 20 : | Ligne 25 : | ||
end | end | ||
function structureHtml(balise, class, style) | function structureHtml(balise, class, style, contenu) | ||
tab.insert('<' .. balise .. ' ') | tab.insert('<' .. balise .. ' ') | ||
if class and style then | if class and style then | ||
| Ligne 28 : | Ligne 33 : | ||
else | else | ||
tab.insert(class or style) | tab.insert(class or style) | ||
.insert( | .insert(contenu or 'Lorem') | ||
end | end | ||
end | end | ||
Version du 9 février 2014 à 21:45
La documentation pour ce module peut être créée à Module:Bandeau/doc
--Ce module implémente 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, args.contenu)
structureHtml('div', nil, p.styleStructureBoite, args.image)
structureHtmlFin('div')
structureHtml('p', nil, p.styleStructureTexte, args.texte)
structureHtmlFin('p')
structureHtmlFin('div')
structureHtmlFin('div')
return tab.concat()
end
function structureHtml(balise, class, style, contenu)
tab.insert('<' .. balise .. ' ')
if class and style then
tab.insert(class)
.insert(' ')
.insert(style)
else
tab.insert(class or style)
.insert(contenu or 'Lorem')
end
end
function structureHtmlFin(balise)
tab.insert('>')
.insert('</' .. balise .. '>')
end
return p