Module:Infobox/Test
Apparence
[voir] [modifier] [historique] [purger]
Cette page définit un module d'infobox.
La documentation de ce module est générée par le modèle {{Documentation module}}.
Elle est incluse depuis la page Modèle:Documentation module d'infobox. Veuillez placer les catégories sur cette page-là.
Les éditeurs peuvent travailler dans le bac à sable (modifier).
Voir les statistiques d'appel depuis le wikicode sur l'outil wstat et les appels depuis d'autres modules.
local Infobox = {}
local externaltext = '' -- maintenance category, coordinates outside infobox etc. that appear outside the infobox
local i18n = {
['see doc'] = 'Documentation du modèle',
['edit infobox'] = 'Modifier l\'infobox',
['errorcat'] = 'Page avec un modèle d\'infobox incorrect',
}
function makecat(cat, sortkey)
return '[[Category:' .. args.cat .. '|' .. args.sortkey .. ']]'
end
local infobox = mw.html.create('div')
function Infobox:addTitle( args )
local class = args.class or 'entete'
local text = args.text or mw.title.getCurrentTitle().text
local style = args.style or ''
infobox:tag('p')
:addClass(class)
:cssText(style)
:wikitext(text)
:done()
end
function Infobox:addText( args )
local class = args.class
local text = args.text
local style = args.style or ''
infobox:tag('p')
:addClass(class)
:cssText(style)
:wikitext(text)
:done()
end
function Infobox:addMixedRow( args )
local value = args.value
if not value and args.cat then
externaltext = externaltext .. makecat(args.cat, args.sortkey)
end
local label = args.label
if not label then
label = '<td class="error">Le paramètre label n\'est pas renseigné.</td></tr>'
externaltext = externaltext .. makecat(i18n['errorcat'])
end
if not value then
return
end
if args.hidden then
value = tostring(mw.html.create('div')
:addClass("NavFrame")
:cssText('title="[Afficher]/[Masquer]" style="border: none; padding: 0;"><div class="NavContent" style="display: none; text-align: left;">' .. args.value ..'</div></div></td></tr>')
)
end
if args.weblink then
value = '<span class="reflink plainlinksneverexpand">[' .. args.weblink .. args.value .. ' ' .. args.value .. ']</span></td></tr>'
end
infobox:tag('tr')
:tag('th')
-- :style('styleHeader')
:css('scope', 'row')
:wikitext(label)
:done()
:tag('th')
:wikitext(value)
:done()
:done()
end