« Module:Infobox ferroviaire » : différence entre les versions

De WikiPerche
Aucun résumé des modifications
Aucun résumé des modifications
 
(2 versions intermédiaires par le même utilisateur non affichées)
Ligne 10 : Ligne 10 :
else
else
headerStyle = 'background-color:green;'
headerStyle = 'background-color:green;'
end
    local titleStyle
    if args.titleStyle and args.titleStyle ~= '' then
titleStyle = string.format('background-color:%s;', args.titleStyle)
else
titleStyle= 'background-color:green;'
end
end
local retval = capiunto.create( {
local retval = capiunto.create( {
title = args.title,
title = args.title,
        titleStyle = titleStyle,
headerStyle = headerStyle,  
headerStyle = headerStyle,  
} )
} )

Dernière version du 13 août 2025 à 16:44

La documentation pour ce module peut être créée à Module:Infobox ferroviaire/doc

local capiunto = require 'capiunto'

local p = {}

function p.main(frame)
	local args = frame:getParent().args
	local headerStyle
	if args.headerstyle and args.headerstyle ~= '' then
		headerStyle = string.format('background-color:%s;', args.headerstyle)
	else
		headerStyle = 'background-color:green;'
	end
    local titleStyle
    if args.titleStyle and args.titleStyle ~= '' then
		titleStyle = string.format('background-color:%s;', args.titleStyle)
	else
		titleStyle= 'background-color:green;'
	end
	local retval = capiunto.create( {
		title = args.title,
        titleStyle = titleStyle,
		headerStyle = headerStyle, 
	} )
    :addRow( 'Numéro officiel', args.numeroofficiel )
    :addRow( 'Propriétaire', args.proprietaire )
    :addHeader( 'Historique' )
	:addRow( 'Mise en service', args.miseenservice )
	:addRow( 'Fermeture', args.fermeture )
    :addRow( 'Déclassement', args.declassement)
	:addRow( 'Concessionnaire original', args.concessionnaireoriginal )
	:addHeader( 'Caractéristiques techniques' )
    :addRow( 'Longueur', args.longueur )
    :addRow( 'Ecartement', args.ecartement)
    :addRow( 'Electrification', args.electrification)
    :addRow( 'Nombre de voies', args.nbvoies)
    :addRow( 'Pente maximale', args.pentemax)
	return retval
end

return p