Module:Infobox/Gare
Apparence
[voir] [modifier] [historique] [purger]
Cette page définit un module d'infobox. Pour les conseils sur l'usage de ce module, voyez Modèle:Infobox Gare.
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 building = require "Module:Infobox/Fonctions/Bâtiment"
local general = require "Module:Infobox/Fonctions"
local wikidata = require "Module:Wikidata"
local function getLines(item)
return wikidata.getClaims({item = item, property = 'P81'})
end
return
{
maincolor = '#E0E0E0',
parts = {
general.title(),
building.mainimage('Article à illustrer Gare', 'Defaut.svg'),
{type = 'table', title = 'Localisation', rows = {
building.country(),
building.adminlocation(),
building.coordinates(),
}
},
{type = 'table', title = ' Gestion et exploitation', rows = {
building.owner(),
{type = 'row', label = 'Exploitant', value = 'exploitant', property = 'P137'},
{type = 'row', label = function(localdata, item) return localdata['titre services'] or 'Services' end, value = 'services'},
}
},
{type = 'table', title = 'Caractéristiques', rows = {
{
type = 'row',
label = function(localdata, item)
if localdata['lignes'] then -- si données locales on ne sait pas si c'est singulier ou pluriel
return 'Ligne(s)'
else
local raillines = getLines(item)
end
if raillines and raillines > 1 then
return 'Lignes'
end
return 'Ligne'
end,
value = 'lignes',
wikidata = function(item)
local raillines = getLines(item)
if not raillines then
return nil
end
local str = ''
for key, val in pairs(raillines) do
val = wikidata.formatStatement(val)
val = val:gsub('ligne de ', '')
val = val:gsub('ligne ' , '')
end
return table.concat(claims, ', ')
end
},
{type = 'row', label = 'Voie', value = 'voies', property = 'P1103'}, -- P1103: nombre de quais
{type = 'row', label = 'Transit annuel', value = 'transit'},
{type = 'row', label = 'Zone', value = function(localdata, item)
local rawstring = localdata[zone]
if not rawstring then
return nil
end
-- format du paramètre : "nom de la région/numméro de zone"
local splitted = mw.text.split( rawstring, '/', true )
if not splitted or #splitted < 1 then
return rawstring
end
--Île de-France
if split[1] == 'IDF' then
local zone = tonumber(split[2] or '')
if not zone or (zone > 8) then
return '[[Tarification des transports en commun d’Île-de-France|Tarification Île-de-France]] non applicable[[Catégorie:Hors zone des transports en commun d\'Île-de-France]]'
end
return tostring(zone) .. ' ([[tarification des transports en commun d\'Île-de-France|tarification Île-de-France]])'
end
return rawstring
end
},
{type = 'row', label = 'Altitude', value = 'altitude'},
}
},
{type = 'table', title = 'Historique', rows = {
{type = 'row', label = 'Mise en service', value = 'mise en service', wikidata =
function(item)
return wikidata.getTheDate{property = 'P793', targetvalue = 'Q18123869'}
end
},
{type = 'row', label = 'Ouverture', value = 'ouverture'}, -- à supprimer ?
{type = 'row', label = 'Fermeture', value = 'fermeture'},
building.creator(),
building.protection(),
}
},
{type = 'table', title = 'Correspondances', rows = {
{type = 'row', label = function(localdata, item) return localdata['titre corresp 1'] or 'Correspondance' end, value = 'corresp 1'},
{type = 'row', label = function(localdata, item) return localdata['titre corresp 2'] or 'Correspondance' end, value = 'corresp 2'},
{type = 'row', label = function(localdata, item) return localdata['titre corresp 3'] or 'Correspondance' end, value = 'corresp 3'},
{type = 'row', label = function(localdata, item) return localdata['titre corresp 4'] or 'Correspondance' end, value = 'corresp 4'},
{type = 'row', label = function(localdata, item) return localdata['titre corresp 5'] or 'Correspondance' end, value = 'corresp 5'},
{type = 'row', label = function(localdata, item) return localdata['titre corresp 6'] or 'Correspondance' end, value = 'corresp 6'},
{type = 'row', label = function(localdata, item) return localdata['titre corresp 7'] or 'Correspondance' end, value = 'corresp 7'},
}
},
{type = 'table', title = 'Schéma de ligne', rows = {
{
type = 'row',
-- class = 'collapsible collapsed tablelignesferroviaires',
value =
function(localdata, item)
local val = localdata['schéma']
if val then
return '{|' .. val .. '\n|}'
end
end,
}
}
},
building.geoloc(),
}
}