Aller au contenu

Module:Infobox/Art

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 25 mars 2015 à 11:42 et modifiée en dernier par Zolo (discuter | contributions) (Nouvelle page : local geoloc = require 'Module:Infobox/Fonctions/Géolocalisation' local general = require 'Module:Infobox/Fonctions' local owner = require 'Module:Propriétaire' local material =...). 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[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 Art.


local geoloc = require 'Module:Infobox/Fonctions/Géolocalisation'
local general = require 'Module:Infobox/Fonctions'
local owner = require 'Module:Propriétaire'
local material = require 'Module:Matériau'
local linguistic = require 'Module:Linguistique'

return {
	maincolor = '#F9F9F9',
	parts = {
		general.mainimage(),
		{type = 'table', rows = {
		{
			type = 'row',
			label = 'Artiste',
			value = 'artiste',
			property = 'P170'
		},
		{
			type = 'row',
			label = 'Date',
			value = 'année',
			property = 'P571'
		},
		{
			type = 'row',
			label = 'Type',
			value = 'type',
			wikidata = function(item)
				if localdata['type'] or localdata['technique'] then -- le matériau peut-être stocké soit dans type, soit dans technique
					return nil
				end
				return material.formatFromItem(item)
			end
		},
		{
			type = 'row',
			label = 'Technique',
			value = 'technique',
		},
		{
			type = 'row',
			label = 'Style',
			value = 'style',
			property = 'P135',
		},
		{
			type = 'row', 
			label = function(localdata, item)
				local label = 'Dimensions'
				local height, depth, width
				if localdata['hauteur'] then
					height = 'H'
				end
				if localdata['largeur'] then
					width = 'L'
				end
				if localdata['profondeur'] then
					depth = 'l'
				end
				if height or width or depth then
					label = label .. '<br />' .. linguistic.conj({height, width, depth}, ' × ')
				end
				return label
				end,
			value = function(localdata, item)
				local unit = localdata['unit'] or 'cm'
				local height, width, depth = localdata['hauteur'], localdata['largeur'], localdata['profondeur']
				if not(height or depth or width or diameter) then
					return nil
				end
				local standarddims = linguistic.conj({height, width, depth}, ' × ' )
				if standarddims then
					standarddims = standarddims .. ' ' .. unit
				end
				if diameter then diameter =
					diameter .. ' ' .. unit .. ' de diamètre'
				end
				return linguistic.conj({standarddims, diameter})
			end
		},
		{
			type = 'row',
			label = 'Format',
			value = 'format'
		},
		{
			type = 'row',
			label = 'Localisation',
			value = function(localdata, item)
				local museum, city, location, country = localdata['musée'], localdata['ville'], localdata['localisation'], localdata['pays']
				location = linguistic.conj({museum, location, city}, 'comma')
				country = linguistic.inparentheses(country)
				if location or country then
					return (location or '') .. ' ' .. (country or '')
				end
				return nil
			end
		},
		{
			type = 'row',
			label = 'Propriétaire',
			value = 'propriétaire',
			wikidata = function(item) return owner.formatFromItem(item) end
		},
		{
			type = 'row',
			label = 'Numéro d’inventaire',
			property = 'P217'
		},
		{	type = 'row',
			label = 'Commentaire',
			value = 'commentaire',
		},
		geoloc.coordinates('Œuvre d\'art géolocalisable sans coordonnées paramétrées'),
		}
		},
		geoloc.geoloc(),
	}
}