Module:Infobox/Tunnel
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 Tunnel.
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 building = require 'Module:Infobox/Fonctions/Bâtiment'
local general = require 'Module:Infobox/Fonctions'
local wd = require 'Module:Wikidata'
local localdata = require 'Module:Infobox/Localdata'
local linguistic = require 'Module:Linguistique'
local function DivisionsAdministratives()
if not localdata.item then
return nil
end
-- on cherche le pays pour être sûr de s'arrêter avant
local country = wd.stringTable{entity = localdata.item, property = 'P17', displayformat = 'raw'}
if table.getn(country) > 1 then
return nil
end
local countryid
if country then
countryid = country[1]
end
-- récupération des valeurs
local list = wd.transitiveVals(localdata.item, {property = 'P131', atdate = 'today'}, 3, 30, countryid)
if not list then
return nil
end
-- création des colonnes
local rows = {}
for i, div in pairs(list) do
if (div == countryid) then
break
end
local label = wd.formatStatements{
entity = div,
property = 'P31',
defaultlinkquery = {property = 'P2354'},-- si pas de lien, lier vers la page de liste e.g liste des Etats de Califorie
defaultlink = '-', -- si aucun lien Wikipédia, pas de lien Wikidata
labelformat = function(id)
local str = wd.getLabel(id)
if str then
return linguistic.removecomplement(str)
else
return ''
end
end
}
local val = wd.formatEntity(div)
table.insert(rows, 1, {type = 'row', label = label, value = function() return val end})
end
return rows
end
return
{
parts =
{
general.title('map'),
general.mainimage(),
{type = 'table', rows = {
{type = 'mixed', label = 'Nom officiel', plurallabel = 'Noms officiels', value = 'nom officiel', wikidata = {property = 'P1448', showlang = true, conjtype = 'new line'}},
{type = 'mixed', label = 'Type', value = 'type', wikidata = {property = 'P31', link = '-', targetvalue = {'Q2354973', 'Q1311958', 'Q5031071'}}},
{type = 'mixed', label = 'Véhicule admis', plurallabel = 'Véhicules admis', value = 'véhicule'},
}
},
{type = 'table', title = 'Géographie', rows = {
general.country(),
{type = 'multi', rows = DivisionsAdministratives() or {} },
{type = 'mixed', label = 'Itinéraire', value = 'itinéraire', wikidata = {property = {'P2505'}, conjtype = 'new line', showqualifiers = {'P17'}, excludespecial = true, labelformat = function(id) return wd.formatStatements{entity = id, property = 'P1824', numval = 1} or wd.getLabel(id) end} },
{type = 'mixed', label = 'Traversée', value = 'traversée', wikidata = {property = 'P177', conjtype = 'new line'} },
{type = 'mixed', label = 'Altitude', value = 'altitude', wikidata = {property = {'P2044'}, targetunit = 'm', rounding = '0', conjtype = 'new line', showqualifiers = {'P3005'} } },
general.coordinates({numval = '2'}),
}
},
{type = 'table', title = 'Caractéristiques', rows = {
{type = 'mixed', label = 'Gabarit', value = 'gabarit'},
{type = 'mixed', label = 'Diamètre', value = 'diamètre', wikidata = {property = 'P2386', targetunit = 'metre', conjtype = ' ou ', rounding = '1', numval = '2'}},
{type = 'mixed', label = 'Section', value = 'section'},
{type = 'mixed', label = 'Écartement', value = 'écartement'},
{type = 'mixed', label = 'Longueur', value = 'longueur', wikidata = {property = 'P2043', targetunit = 'metre', conjtype = ' ou ', showqualifiers = {'P560'}, rounding = '1', numval = '2'}},
{type = 'mixed', label = 'Nombre de tubes', value = 'nombre tube', wikidata = {property = 'P2670', targetvalue = 'Q1419626', showonlyqualifier = {'P1114', 'P560'}}
},
{type = 'mixed', label = 'Nombre de voies par tube', value = 'nombre de voie', wikidata = {property = 'P2670', targetvalue = 'Q3222002', showonlyqualifier = 'P1114', numval = 1}},
}
},
{type = 'table', title = 'Historique', rows = {
building.construction(),
building.opening(),
building.closure(),
}
},
{type = 'table', title = 'Exploitation', rows = {
{type = 'mixed', label = 'Exploitant', value = 'exploitant', wikidata = {property = {'P137', 'P126'}, conjtype = 'new line', form = 'short', atdate = 'today'}},
{type = 'mixed', label = 'Péage', value = 'péage', wikidata = {property = 'P2555', showqualifiers = {'P3005', 'P518'}, conjtype = 'new line', rounding = '2', atdate = 'today', showdate = true, precision = 'year'}},
{type = 'mixed', label = 'Fréquentation', value = 'trafic', wikidata = {property = 'P3872', showqualifiers = {'P1264'}, qualifiervalue = {'Q1092296', 'Q5151', 'Q23387', 'Q573'}, showdate = true, precision = 'year', sorttype = 'inverted', numval = '1'}},
}
},
general.geoloc({default_zoom=14}),
}
}