Aller au contenu

Module:Infobox/Gratte-ciel

Une page de Wikipédia, l'encyclopédie libre.
Ceci est une version archivée de cette page, en date du 11 juin 2017 à 09:35 et modifiée en dernier par Zolo (discuter | contributions) (adresse complète dans un seul champ (moins encombrant, et appelé 'localisation' plutôt que "géographie", utilisation de Wikidata (coûteuse mais utile)). 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. Pour les conseils sur l'usage de ce module, voyez Modèle:Infobox Gratte-ciel.


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

local function keydate(event, item)
	return  wikidata.getTheDate{property = 'P793', targetvalue = event, addcat = true, entity = item}
end


-- paramètres pour la fonction p.fullAddress
local country = localdata[country]
local divs = {}
for i, j in pairs { 'quartier', 'ville', 'subdivision3', 'subdivision2', 'subdivision'} do
	if localdata[j] then
		table.insert(divs, localdata[j])
	end
end

return {
	maincolor = '#E6E3CF',
	parts = {
		
		general.title(),
		general.logo(),
		building.mainimage(),
		{type = 'table', title = 'Histoire', rows = {
			{type = 'mixed', label = 'Ancien(s) nom(s)', value = 'anciens noms'},
			building.creator(),
			{type = 'mixed', label = 'Développeur', value = 'développeur'},
			{type = 'mixed', label = 'Conception', value = 'conception'},
			building.complex(),
			building.construction(),
			building.opening(),
			{type = 'mixed', label = 'Coût', value = 'coût'},
			{type = 'mixed', label = 'Rénovation', value = 'rénovation', wikidata = function ( item ) return keydate('Q2144402', item) end},
			{type = 'mixed', label = 'Restructuration', value = 'restructuration', }, -- 'Q1376796'?
			building.closure(),
			building.demolition(),
			{type = 'mixed', label = 'Statut', value = 'statut'}, --= en construction / construit
			building.usage(),
		}},
	
		{type = 'table', title = 'Architecture', rows = {
			{type = 'mixed', label = 'Type', value = 'type'}, --property = 'P31'},
			building.archistyle(),
			building.material(),
			building.protection(),
			{type = 'mixed', label = 'Hauteur de lʼantenne' , value = 'antenne flèche'},
			{type = 'mixed', label = 'Hauteur du toit', value = 'toit'},
			{type = 'mixed', label = 'Hauteur du dernier étage', value = 'dernier étage' },
			{type = 'mixed', label = 'Étages', value = 'étages', wikidata = 
				{
					property = 'P1101',
					showqualifiers = {'P518'}, --= partie concernée
					qualifdisplayformat = function(snak) return wikidata.formatSnak(snak) end, --pour éviter d'être formaté comme le mainsnak
					displayformat = 
						function(snak)
						if (snak.snaktype == 'value') then
							local v = snak.datavalue.value.amount - 1 -- on ne compte pas le rez-de-chaussée
							if v == 0 then
								return 'aucun'
							else
								return tostring(v)
							end
						end
						return wikidata.formatSnak(snak)
					end
				}
			},
			{type = 'mixed', label = 'Sous-sols', value = 'sous-sol', property = 'P1139'},
			{type = 'mixed', label = 'Chambres', value = 'chambres'},
			{type = 'mixed', label = 'Appartements', value = 'appartements'},
			{type = 'mixed', label = 'Superficie', value = 'superficie', wikidata = {property = 'P2046', targetunit = 'square metre', conjtype = ' ou ', rounding = '1', numval = '2',	displayformat = 
				function(snak)
					return wikidata.formatSnak(snak) --Utilisé pour afficher l'unité
				end
			}},
			{type = 'mixed', label = 'Volume', value = 'volume'},
			{type = 'mixed', label = 'Nombre dʼascenseurs', value = 'ascenseurs', property = 'P1301'},
			}
		},
		{type = 'table', title = 'Administration', rows = {
			{type = 'mixed', label = 'Contracteur' , value = 'contracteur', property = 'P193'},
			{type = 'mixed', label = 'Occupant', value = 'occupant', property = 'P466' },
			{type = 'mixed', label = 'Propriétaire', value = 'propriétaire', property = 'P127'},
			building.website()
		}},
	
		{type = 'table', title = 'Localisation', rows = {	
			{
			type = 'mixed',
			label = 'Adresse',
			value = function() return address.fullAddress(localdata['item'], country, divs, localdata['adresse']) end
			},
			building.coordinates(),
		}},
	
		building.geoloc({defaultmaps = "interactive"}),
	}
}