Aller au contenu

Module:Infobox Bibliothèque/Bac à sable

Une page de Wikipédia, l'encyclopédie libre.
Ceci est une version archivée de cette page, en date du 19 mars 2021 à 00:58 et modifiée en dernier par Dongusim (discuter | contributions) (Il s'agit d'un test, qui n'est pas encore terminé, qui n'est pas encore utilisé activement.). Elle peut contenir des erreurs, des inexactitudes ou des contenus vandalisés non présents dans la version actuelle.
(diff) ← Version précédente | Voir la version actuelle (diff) | Version suivante → (diff)

 Documentation[créer] [purger]
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 = 'F59F9F',
	parts =
    	{
			general.title('Bibliothèque'),
			general.logo(),
			building.mainimage('Article à illustrer de la bibliothèque'),
			{type = 'table', title = 'Informations générales', rows = {
				{type = 'row', label = 'Type', value = 'type', wikidata = {property = 'P31', excludevalues = {'Q18411786','Q856584','Q19844914'}}},
				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 = 'Organisation mère', value = 'Organisation mère', wikidata = {porperty = 'P749'}},
				{type = 'row', label = 'Forme juridique', value = 'Forme juridique', wikidata = {property = 'P1454'}},
				building.website('site'),
				}
			 },
			{type = 'table', title = 'Collections', rows = {
				{type = 'row', label = 'Collections', value = 'collections'}, --  liste des grandes collections de la bibliothèque ;
				{type = 'row', label = 'Genre', value = 'genre collections'},
				{type = 'row', label = 'Provenance', value = 'provenance collections'},
				{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 = 'town-hall', default_zoom=13, markercolor = '#7CA2FF'}),
	}
}