« Module:Bandeau » : différence entre les versions
Aller à la navigation
Aller à la recherche
Modèle>Tejgad m (Fonction ébauche : annulation, test non fonctionnel) |
Modèle>Hlm Z. (Nouvelle page : --Ce module implémente le modèle {{Bandeau}}. local p = {} p.classStructureBoite = 'class="bandeau-simple"' p.styleStructureBoite = 'style="width:80%; margin:0 auto 1em; padd...) |
||
| Ligne 1 : | Ligne 1 : | ||
-- | --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.structure(frame) | |||
function | args = frame:getParent().args | ||
local tab = TableBuilder.new() | |||
tab.insert(structureHtml('div', p.classStructureBoite, p.styleStructureBoite, 'Lorem')) | |||
return tab.concat() | |||
end | end | ||
function | function structureHtml(balise, class, style, contenu) | ||
local tab = TableBuilder.new() | |||
tab.insert('<' + balise + ' ') | |||
if class and style then | |||
tab.insert(class) | |||
.insert(' ') | |||
.insert(style) | |||
else | |||
tab.insert(class or style) | |||
end | end | ||
tab.insert('>') | |||
.insert(contenu) | |||
.insert('</' + balise + '>') | |||
return tab.concat() | |||
return | |||
end | end | ||
return | return p | ||
Version du 9 février 2014 à 15:01
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.structure(frame)
args = frame:getParent().args
local tab = TableBuilder.new()
tab.insert(structureHtml('div', p.classStructureBoite, p.styleStructureBoite, 'Lorem'))
return tab.concat()
end
function structureHtml(balise, class, style, contenu)
local tab = TableBuilder.new()
tab.insert('<' + balise + ' ')
if class and style then
tab.insert(class)
.insert(' ')
.insert(style)
else
tab.insert(class or style)
end
tab.insert('>')
.insert(contenu)
.insert('</' + balise + '>')
return tab.concat()
end
return p