Aller au contenu

Module:Infobox/Monument

Cette page fait l’objet d’une mesure de semi-protection étendue.
Une page de Wikipédia, l'encyclopédie libre.
Ceci est une version archivée de cette page, en date du 17 février 2022 à 12:00 et modifiée en dernier par Jérémy-Günther-Heinz Jähnick (discuter | contributions) (Mise en place de la fonction pour les records détenus par un monument). Elle peut contenir des erreurs, des inexactitudes ou des contenus vandalisés non présents dans la version actuelle.

 Documentation[voir] [modifier] [historique] [purger]

Cette page définit un module d'infobox. Elle utilise des fonctions définies sur Module:Infobox/Fonctions/Bâtiment. Pour les conseils sur l'usage de ce module, voyez Modèle:Infobox Monument.


local building = require "Module:Infobox/Fonctions/Bâtiment"
local general = require "Module:Infobox/Fonctions"
local localdata = require "Module:Infobox/Localdata"
local wd = require "Module:Wikidata"

local formats = {
	--{icône carte, icône entete, couleur titre, couleur sous-titre, couleur texte)
	Q1144661 = {'amusement-park', nil, '#B0C4DE', '#E1E1E1', '#000000', 'defaut'}, -- attraction
	Q18761864 = {'bank', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- bâtiment bancaire
	Q655686 = {'shop', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- bâtiment commercial
	Q856584 = {'library', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- bibliothèque
	Q622425 = {'music', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- boîte de nuit
	Q274393 = {'bakery', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- boulangerie
	Q3649129 = {'ranger-station', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- cabane
	Q876852 = {'playground', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- centre de vacances ou de loisirs
	Q751876 = {'castle', 'chateau', '#00507f', '#ffffff', '#ffffff', 'defaut'}, --château
	Q23413 = {'castle', 'chateau', '#00507f', '#ffffff', '#ffffff', 'defaut'}, --castle
	Q105731 = {'dam', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- écluse
	Q3914 = {'library', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- école
	Q16970 = {'religious-christian', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- église
	Q67166646 = {'circle-stroked', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- entrée de grotte
	Q1777951 = {'ferry', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- hangar à bateaux
	Q1021645 = {'building', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- immeuble de bureaux
	Q3947 = {'commercial', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- maison
	Q37654 = {'shop', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- marché
	Q32815 = {'religious-muslim', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- minaret
	Q4989906 = {'monument', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- monument
	Q32815 = {'religious-muslim', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, --mosquée
	Q170980 = {'monument', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- obélisque
	Q3689421 = {'information', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- office de commercialisation touristique
	Q1137809 = {'museum', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- palais de justice
	Q509028 = {'circle-stroked', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- ranch
	Q41253 = {'cinema', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- salle de cinéma
	Q839954 = {'circle-stroked', 'map', '#CCCCAA', '#CCCCAA', '#000000', 'defaut'}, -- site archéologique
	Q96102071 = {'zoo', 'map', '#CCCCAA', '#CCCCAA', '#000000', 'defaut'}, -- site d'observation des animaux
	Q36728566 = {'ranger-station', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- station de rangers
	Q205495 = {'fuel', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- station-service
	Q34627 = {'religious-jewish', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- synagogue
	Q267596 = {'museum', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- temple grec
	Q849706 = {'airport', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- terminal aéroportuaire
	Q27108230 = {'campsite', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- terrain de camping
	Q813966 = {'toilet', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- toilettes publiques
	Q748998 = {'fire-station', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- tour de guet contre les incendies
	Q870 = {'rail', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- train
	Q83405 = {'industry', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- usine
	Q208502 = {'rail', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- véhicule ferroviaire remorqué
	Q3024331 = {'religious-christian', 'chateau', '#E00000', '#E00000', '#FFFFFF', 'defaut'}, -- commanderie templière
	Q174981 = {'religious-christian', 'chateau', '#000000', '#000000', '#FFFFFF', 'defaut'}, -- commanderie hospitalière
	default = {'monument', nil, '#E1E1E1', '#E1E1E1', '#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()
	local charte = localdata['charte']
	if charte then
		for i, j in pairs(formats) do
			if j[2] == charte then
				return j
			end
		end
	end
	return wdformat()
end
local function closure() -- évite les doublons, building.demolition() et building.closure() prennent en compte la propriété P576
	if not wd.formatStatements{property = 'P576'} or localdata['fermeture'] or localdata['date de fermeture'] then
		return building.closure()
	end
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 = 'Présentation', rows = {
				{type = 'row', label = 'Type', value = 'type', blockers = {'destination initiale', 'destination finale'}, wikidata = {property = 'P31', defaultlinkquery = 'P279', excludevalues = {'Q41176', 'Q811979' }, showqualifiers = "P580"}},
				{type = 'row', label = 'Partie de', value = 'partie de', wikidata = {property = 'P361', defaultlinkquery = 'P279', excludevalues = {}, showqualifiers = "P580"}},
				{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 = 'Culte', value = 'culte'},
				{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 = 'Fondation', value = 'fondation'},
				{type = 'row', label = 'Diocèse', value = 'diocèse', property = 'P708'},
				{type = 'row', label = 'Paroisse', value = 'paroisse', property = 'P5607'},
				{type = 'row', label = 'Dédicataire', plurallabel = 'Dédicataires', value = 'dédicataire', property = 'P825'},
				{type = 'row', label = 'Commémore', value = 'commémore', property = 'P547'},
				building.orientation(),
				building.archistyle(),
				building.creator(),
				building.material(),
				building.cornerstonelaying(),
				building.construction(),
				building.opening(),
				building.reconstruction(),
				building.relocation(),
				building.renovation(),
				closure(),
				building.demolition(),
				{type = 'row', label = 'Commanditaire', value = 'commanditaire', property = 'P88'},
				building.dimensions(),
				building.recordheld(),
				building.religion(),
				{type = 'row', label = 'Ordre religieux', plurallabel = 'Ordres religieux', value = 'ordre religieux', property = 'P611'},
				{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(),
				{type = "row", label = "Direction des fouilles", value = "fouilles", property = "P4345"},
				building.protection(),
				{type = 'row', label = '[[Trinomial Smithsonian|Smithsonian]]', value = 'Smithsonian', property = 'P3518'},
				{type = 'row', label = "[[Office de tourisme|Informations]]", value = "informations", wikidata = {property = 'P2872', numval = '3'}},
				building.visitors(),
				{type = 'row', label = 'État de conservation', value = 'état de conservation', property = 'P5816'},
				building.website('site'),
				}
			},
				building.unesco(),
			{type = 'table', title = 'Localisation', rows = {
				building.adminlocation(),
				{type = 'row', label = 'Région historique', value = 'région historique', wikidata = {property = 'P6885', numval = '1'}},
				{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 = 'Accès et transport', rows = {
				building.transport(),
				},
			},
			{type = 'table', rows = {
				building.coordinates(),
				}
			},
			general.geoloc({marker=displayformat[1], default_zoom=13}),
	}
}