Module:Infobox/Locomotive
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 (créer).
Voir les statistiques d'appel depuis le wikicode sur l'outil wstat et les appels depuis d'autres modules.
local localdata = require "Module:Infobox/Localdata"
local item = localdata.item
local general = require "Module:Infobox/Fonctions"
local wd = require "Module:Wikidata"
local tenders = wd.getIds(item, {property = 'P527', condition = function(claim) return wd.isInstance("Q749311", wd.getId(claim.mainsnak), 2) end, exludespecial = true})
local tender = '-' -- utilisé seulement s'il n'y en a qu'un seul type
if tenders and (#tenders == 1) then
tender = tenders[1]
end
return {
maincolor = '#DFDFDF',
parts = {
general.title(),
general.mainimage('Article à illustrer Locomotive'), --rajouter upright
-- rajouter image drapeau P41 et blason P94
{type = 'table', title = 'Caractéristiques', rows = {
{type = 'row', label = 'Type', value = 'type', property = 'P279'},
{type = 'row', label = 'Disposition des essieux', value = 'motorisation', property = 'P2978'}, -- disposition des essieux
{type = 'row', label = 'Masse', value = 'masse', property = 'P2067'},
{type = 'row', label = 'Longueur', value = 'longueur', property = 'P2043'},
{type = 'row', label = 'Écartement', pluriallabel = 'Écartements', value = 'écartement', property = 'P1064'}, -- écartement
{type = 'row', label = 'Motorisation', value = 'motorisation', property = 'P516'}, -- motorisation
{type = 'row', label = 'Nombre de cylindres', value = 'nombre de cylindres', property = 'P1100'},
{type = 'row', label = 'Puissance', value = 'puissance', property = 'P2109'}, -- Puissance
{type = 'row', label = 'Type de carburant', conjtype = ' ou ', value = 'type de carburant', property = 'P618'},
{type = 'row', label = 'Vitesse maximale', value = 'vitesse max', property = 'P3086'}, -- Vitesse maximale
}},
{type = 'table', title = 'Construction', rows = {
{
type = 'row',
label = 'Pays d’origine',
value = 'pays',
property = 'P495'
},
{
type = 'row',
label = 'Concepteur',
plurallabel = 'Concepteurs',
value = 'concepteur',
property = 'P287'
},
{
type = 'mixed',
label = 'Constructeur',
plurallabel = 'Constructeurs',
value = 'constructeur',
wikidata = {
property = 'P176', -- constructeur
conjtype = '<br />',
rank = valid,
showdate = true, --date de début, date de fin
statementformat = function(statement)
local constructeur = wd.formatSnak(statement.mainsnak)
local nbre = wd.getFormattedQualifiers(statement, 'P1092')
local str = constructeur
if nbre then
str = str .. " (" .. nbre ..")" -- nombre construit par constructeur
end
return str
end,
},
},
{
type = 'row',
label = 'Nombre produit',
value = 'quantité',
wikidata = {
property = 'P1092',
conjtype = '<br />',
rank = valid,
statementformat = function(statement)
local quantite = wd.formatSnak(statement.mainsnak)
local typem = wd.getFormattedQualifiers(statement, 'P518')
local str = quantite
if typem then
str = str .. " type ".. typem -- nombre d'unités produites, par type d'unité (A ou B pour l'Amérique du Nord)
end
return str
end,
},
},
{type = 'row', label = 'Date de mise en service', value = 'date de mise en service', property = 'P729'}, -- première mise en service, qu'importe l'exploitant
{type = 'row', label = 'Date de retrait du service', value = 'date de retrait du service', property = 'P730'}, -- dernier retrait du service, qu'importe l'exploitant
{type = 'row', label = 'Modèle précédent', plurallabel = 'Modèles précédents', value = 'précédent', property = 'P155'}, -- modèle précédent
{type = 'row', label = 'Modèle suivant', plurallabel = 'Modèles suivants', value = 'suivant', property = 'P156'}, -- modèle précédent
}},
{type = 'table', title = 'Tender', property = 'P527', rows = {
{type = 'row', label = 'Type', plurallabel = 'Types', value = 'tender', property = 'P527'}, -- types de tenders affectés à la machine
{type = 'row', label = 'Masse', plurallabel = 'Masses', value = 'masse', wikidata = {property = 'P2067', entity = tender}}, -- masse
{type = 'row', label = 'Carburant', plurallabel = 'Carburants', value = 'carburant', wikidata = {property = 'P3437', entity = tender}}, -- masse
}},
{type = 'table', title = 'Service', rows = {
{
type = 'mixed',
label = 'Exploitant',
plurallabel = 'Exploitants',
value = 'exploitant',
wikidata = {
property = 'P137', --P1813
conjtype = '<br />',
rank = 'valid',
statementformat = function(statement)
local operator = wd.formatSnak(statement.mainsnak)
local plate = wd.getFormattedQualifiers(statement, 'P794') -- identification au sein de la compagnie
local num = wd.getFormattedQualifiers(statement, 'P1114') -- nombre en service
if num then
num = tonumber(num)
end
local str = operator
if num and (num > 1) and not plate then
str = str .. " <small>(" .. tostring(num) .. " machines" .. ")</small>"
end
if plate and not num then
str = str .. " <small>(série " .. plate .. ")</small>"
end
if plate and num and (num > 1) then
str = str .. " <small>(" .. tostring(num) .. " machines, série " .. plate .. ")</small>"
end
return "• " .. str
end,
showdate = true, --date de début, date de fin
},
},
{type = 'row', label = 'Surnom', plurallabel = 'Surnoms', value = 'surnom', property = 'P1449'},
{type = 'row', label = 'Utilisation', value = 'utilisation', property = 'P336'}
}},
{type = 'table', title = 'Voir également', rows = {
{type = 'row',
label = 'Images et média',
value = 'commons',
wikidata = {
property = 'P373',
rank = valid,
conjtype = '<br />',
statementformat = function(statement)
local CommonsCat = wd.formatSnak(statement.mainsnak)
local str = CommonsCat
if CommonsCat then
str = "[[File:Commons-logo.svg|12px]] [[commons:Category:" .. CommonsCat .. "|Wikimedia Commons]]"
end
return str
end,
},
},
}},
}
}