Module:Infobox/Espace public
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 Espace public.
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 general = require "Module:Infobox/Fonctions"
local building = require "Module:Infobox/Fonctions/Bâtiment"
local wikidata = require "Module:Wikidata"
local linguistic = require "Module:Linguistique"
local convert = require "Module:Conversion"
local country = wikidata.stringTable{entity = localdata.item, property = "P17", displayformat = "raw"}
local countryid
if country then
countryid = country[1]
end
local defaultlinks = { -- version de Wikipédia à utiliser pour les liens en l'absence d'article français
Q17 = 'jawiki', -- Japon
Q182 = 'dewiki', -- Allemagne
Q40 = 'dewiki', -- Autriche
Q38 = 'itwiki', -- Italie
Q29 = 'eswiki', -- Espagne
Q96 = 'eswiki', -- Mexique
}
local defaultlink = {'enwiki'}
if defaultlinks[countryid] then
table.insert(defaultlink, defaultlinks[countryid])
end
local function getVal(addargs) -- pour une propriété donnée, retourne la meilleure valeur, ainsi que sa date, sa référence, et si ça vient ou non de Wikidata
local args = {numval = 1, entity = localdata.item, showunit = '-', displayformat = 'raw', precision = 'year'}
for i, j in pairs(addargs or {}) do
args[i] = j
end
local statements = wikidata.getClaims(args)
if not statements then
return nil
end
local val = statements[1]
local v = wikidata.formatStatement(val, args)
local period = wikidata.getFormattedDate(val, args)
local ref = nil -- TODO : fonction dans Module:Wikidata pour récupérer les refs
return v, period, ref, args.property
end
local formats = {
--{icône carte, icône entete, couleur titre, couleur sous-titre, couleur texte)
default = {nil, nil, '#ECE5CA', '#ECE5CA', '#000000', 'defaut'}
}
local function wdformat() --retourne une table contenant la couleur principale de l'infobox et l'icône de titre
local wtypes = wd.stringTable{ -- récupère les Qid des professions
entity = localdata.item,
property = 'P31',
displayformat = 'raw',
excludespecial = true
}
local default = formats.default
wtypes = wd.addVals(wtypes or {}, {property = 'P279'}, 1) -- on utilise en plus les sous-classe
for i, item in pairs(wtypes or {}) do
if formats[item] then
return formats[item]
end
end
return default
end
local function setcharte()
if localdata['charte'] then
charte = localdata['charte']
for i, j in pairs(formats) do
if j[2] == charte then
return j
end
end
end
return wdformat()
end
local displayformat = setcharte()
return
{
maincolor = displayformat[3],
secondcolor = displayformat[4],
thirdcolor = displayformat[5],
parts =
{
general.title(displayformat[2], nil, 'nom local', nil),
general.logo(),
building.mainimage('Article à illustrer Monument'),
{type = 'table', title = 'Situation', rows = {
--{type = 'row', label = 'Civilisation', plurallabel = 'Civilisations', value = 'civilisation', property = 'P2596'},
--{type = 'row', label = 'Destination initiale', value = 'destination initiale'},
--{type = 'row', label = 'Destination actuelle', value = 'destination actuelle'},
--{type = 'row', label = 'Rattachement', value = 'rattachement'},
--{type = 'row', label = 'Dédicataire', plurallabel = 'Dédicataires', value = 'dédicataire', property = 'P825'},
--{type = 'row', label = 'Commémore', value = 'commémore', property = 'P547'},
{type = 'row', label = 'Début', value = {'début', 'tenant'}},
{type = 'row', label = 'Fin', value = {'fin', 'aboutissant'}},
--building.archistyle(),
--building.creator(),
--building.material(),
--{type = 'row', label = 'Commanditaire', value = 'commanditaire', property = 'P88'},
--building.religion(),
--{type = 'row', label = 'Occupant', plurallabel = 'Occupants', value = 'occupant', wikidata = {property = 'P466', showdate = true}},
--building.owner(),
building.usage(),
--{type = 'row', label = 'Franchit', property = 'P177'},
--{type = 'row', label = 'Précédent franchissement en amont', property = 'P2673'},
--{type = 'row', label = 'Prochain franchissement en aval', property = 'P2674'},
--{type = 'row', label = 'Permet de faire passer', property = 'P2505'},
--building.operator(),
building.protection(),
{type = 'row', label = "[[Office de tourisme|Informations]]", value = "informations", wikidata = {property = 'P2872', numval = '3'}},
--building.visitors(),
building.website('site', 'site web'),
}
},
building.unesco(),
{type = 'table', title = 'Morphologie', rows = {
building.adminlocation(),
{type = 'row', label = 'Type', value = 'type', blockers = {'destination initiale', 'destination finale'}, wikidata = {property = 'P31', excludevalues = {'Q41176', 'Q811979' }}},
{type = 'row', label = 'Forme', value = 'forme'},
building.dimensions(),
{type = 'row', label = 'Longueur', value = 'longueur'},
{type = 'row', label = 'Largeur', value = 'largeur'},
{type = 'row', label = 'Superficie', value = 'superficie'},
{type = 'row', label = 'Altitude', value = 'altitude', wikidata = {property = 'P2044', targetunit = 'metre', conjtype = ' ou ', rounding = '0'} },
--{type = 'row', label = 'Emplacement', value = 'emplacement', wikidata = {property = 'P706', numval = '1'}},
--building.mountainrange(),
--building.onshoreof(),
--building.watershed(),
building.protectedarea(),
}
},
{type = 'table', title = 'Histoire', rows = {
{type = 'row', label = 'Création', value = 'dates'},
--building.construction(),
--building.opening(),
--building.reconstruction(),
--building.relocation(),
--building.renovation(),
--building.demolition(),
{type = 'row', label = 'Noms précédents', value = 'noms précédents'},
{type = 'row', label = 'Surnom(s)', value = 'surnom'},
{type = 'row', label = 'Nom complet', value = 'nom complet'},
{type = 'row', label = 'Lieux', value = 'dates'},
{type = 'row', label = 'Monuments', value = 'monuments'},
--building.transport(),
},
},
{type = 'table', rows = {
--building.coordinates(),
}
},
general.geoloc({marker=displayformat[1], default_zoom=13}),
}
}