Communauté • Livre d'or
Actualités, astuces, interview... Venez lire la gazette de ce printemps de Vikidia !
Actualités, astuces, interview... Venez lire la gazette de ce printemps de Vikidia !
Module:Système planétaire
Aller à la navigation
Aller à la recherche
Le module : Système planétaire sert à faire fonctionner le modèle : Système planétaire, voir sa documentation.
La documentation de ce module est incluse depuis sa sous-page de documentation (modifier | historique).
Veuillez placer les catégories dans la sous-page /Documentation.
Les éditeurs peuvent travailler dans le bac à sable (créer).
local p = {}
function p.Systeme( frame )
local args = frame:getParent().args
-- élaboration du titre du tableau
local titre = 'Système '
.. mw.text.trim( args['système'] ~= '' and args['système'] or mw.title.getCurrentTitle().text )
local source = args['source']
if source and source ~= '' then
titre = titre .. '<span style="font-weight:normal;">'
.. source
.. '</span>'
end
-- création du tableau
local retour = mw.html.create( 'table' )
retour = retour:addClass( 'wikitable' )
:css( 'margin', 'auto' )
:tag( 'caption' ):wikitext( titre ):done()
:tag( 'tr' ):tag( 'th' ):attr( 'scope', 'col' ):wikitext( 'Planète' ):done()
:tag( 'th' ):attr( 'scope', 'col' ):wikitext( 'Masse à l’échelle de [[Jupiter (planète)|Jupiter]]' ):done()
:tag( 'th' ):attr( 'scope', 'col' ):wikitext( '[[Période orbitale]] en [[jour]]s' ):done()
:tag( 'th' ):attr( 'scope', 'col' ):wikitext( 'Découverte' ):done()
:done()
local i = 1
while args[i] do
local ligne = mw.html.create( 'tr' )
ligne:tag( 'td' ):wikitext( args[i] ):done()
:tag( 'td' ):wikitext( args['masse' .. tostring( i )] or '' ):done()
:tag( 'td' ):wikitext( args['période' .. tostring( i )] or '' ):done()
:tag( 'td' ):wikitext( args['découverte' .. tostring( i )] or '' ):done()
retour = retour:node( ligne )
i = i + 1
end
return tostring( retour )
end
return p