Documentation[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 Musée.


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 buildingitem = localdata.item -- assuming same item for building and organization, but should not be the case, so checks the following:
local buildingcandidates = wd.stringTable{entity = localdata.item, property = 'P276', displayformat = 'raw', excludespecial = true}
if buildingcandidates then
	if (#buildingcandidates == 1) and (buildingcandidates ~= buildingitem) and wd.isInstance('Q41176', buildingcandidates[1], 2) or wd.isInstance('Q1497364', buildingcandidates[1], 1) then
		buildingitem =  buildingcandidates[1]
	end
end

local function architects(item)
	local architects = wd.getClaims{entity = item, property = 'P84'}
	if (not architects) then
		return nil
	end
	if #architects > 3 then
		return wd.formatAndCat{property = 'P84', entity = item, value = 'Divers'}, 2
	end
	return wd.formatAndCat{entity = item, property = 'P84', claims = architects, conjtype = 'comma'}, #architects
end


return 
	{
	maincolor = 'C8D8FF',
	parts =
    	{
			general.title('musee'),
			general.logo(),
			building.mainimage('Article à illustrer Musée'),
			{type = 'table', title = 'Informations générales', rows = {
				{type = "row", label = "Nom local", plurallabel = "Noms locaux", value = "nom local", wikidata = {property = "P1705", showlang = true} },
				{type = 'row', label = 'Type', value = 'type', wikidata = {property = 'P31', excludevalues = {'Q33506', 'Q24699794', 'Q18411786', 'Q35989030', 'Q45400320'}}},
				building.opening(),
				building.closure(),
				building.operator(),
				{type = 'row', label = 'Dirigeant', plurallabel = 'Dirigeants', value = {'conservateur', 'dirigeant'}, wikidata = {property = 'P1037', showqualifiers = {'P794'}, showdate = true, precision = 'year', stilltrue = true, expl = true}}, -- TODO : forme féminine
				{type = 'row', label = 'Président', plurallabel = 'Présidents', blockers = {'dirigeant', 'conservateur'}, value = 'président', wikidata = {property = 'P488', showdate = true, precision = 'year', stilltrue = true}},-- TODO : forme féminine
				{type = 'row', label = 'Surface', value = 'superficie', wikidata = {property = 'P2046', targetunit = 'square meter'}},
				{type = 'row', label = 'Visiteurs par an', value = 'visiteurs', wikidata = {property = 'P1174', sorttype = 'inverted', numval = 1, showdate = true}},
				building.website('site'),
				}
			 },
			{type = 'table', title = 'Collections', rows = {
				{type = 'row', label = 'Collections', value = 'collections'}, --  liste des grandes collections du musée ;
				{type = 'row', label = 'Genre', value = 'genre collections'},
				{type = 'row', label = 'Provenance', value = 'provenance collections'},
				{type = 'row', label = 'Époque', value = 'époque collections'},
				{type = 'row', label = localdata['libellé nombre objets'] or "Nombre d'objets", value = {"nombre d'objets", "œuvres"}},
				{type = 'row', label = localdata['libellé objets exposés'] or "Objets exposés", value = "objets exposés"},
				{type = 'row', label = 'Label', value = 'label'}
				}
			 },			 				 
			{type = 'table', title = 'Bâtiment', rows = {

				-- pourrait utiliser les fonction de Module:Infobox/Fonctions/Bâtiment si elles étaient adaptées pour utiliser un autre item que l'item principal de l'infobox
				{type = 'row', label = 'Article dédié', value = {'monument', 'article bâtiment'}, wikidata =
						function()
						if buildingitem and (buildingitem.id ~= localdata.item.id) and wd.siteLink(buildingitem) then
							str = wd.formatEntity(buildingitem)
							return wd.addLinkBack(str, item, 'P276')
						end
						end
				},
				{type = 'row', label = 'Construction', value = 'construction', wikidata = function() return wd.keyDate('Q385378', buildingitem) end},
				{type = 'row', label = 'Architecte', plurallabel = 'Architectes', value = 'architecte', wikidata = function() return architects(buildingitem) end},
				{type = 'row', label = 'Protection', value = 'protection', wikidata = function() return require('Module:Classement').formattedList(buildingitem) end}, 
				}
			 },
			{type = 'table', title = 'Sites', rows = {
				{type = 'row', value = 'Site'} -- alternative à "site" pour les institutions multi-implantations
				}
			},
			{type = 'table', title = 'Localisation', rows = {
				building.adminlocation(),
				building.mountainrange(),
				building.protectedarea(),
				building.coordinates(),
				}
			 },
			general.geoloc({marker = 'museum', default_zoom=13, markercolor = '#7CA2FF'}),
	}
}