Module:Infobox/Relief terrestre/Bac à sable

Une page de Wikipédia, l'encyclopédie libre.

 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 Relief terrestre/Bac à sable.


local location = require "Module:Infobox/Fonctions/Géolocalisation"
local general = require "Module:Infobox/Fonctions"
local wd = require "Module:Wikidata"
local building = require "Module:Infobox/Fonctions/Bâtiment" -- à passer vers /Géolocalisation
local localdata = require "Module:Infobox/Localdata"
local unit = require "Module:Unité"

local formats = {
	--{couleur, icône pointeur, couleur pointeur, niveau de zoom)
	Q29025902 = {'#996633', 'white', 'triangle-stroked', '#8B0000', '10', 'volcan'}, -- formation volcanique
	Q1061151 = {'#996633', 'white', 'triangle-stroked', '#996633', '6', 'montagne'}, -- massif
	Q46831 = {'#996633', 'white', 'triangle-stroked', '#996633', '6', 'montagne'}, -- chaîne de montagnes
	Q150784 = {'#DFAF2C', 'black', 'circle-stroked', '#DFAF2C', '10', default}, -- gorge
	Q39816 = {'#BFFFBF', 'black', 'circle-stroked', '#BFFFBF', '7', default}, -- vallée
	default = {'#996633', 'white', 'triangle-stroked', '#996633', '10', default}
}

local function wdformat() --retourne une table
	local wtypes = wd.stringTable{
		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-classes
	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 displayformat = setcharte()

return 
	{
	maincolor = displayformat[1],
	thirdcolor = displayformat[2],
	parts = {
		
		general.title('map', {color = displayformat[2]}),
		general.mainimage('Article à illustrer Montagne', 'Defaut.svg'),
		{type = 'table', title = 'Géographie', rows = {
			{type = 'row', label = '[[Continent]]', plurallabel = 'Continents', value = 'continent', property = 'P30'},
			{type = 'row', label = 'Unité géomorphologique', value = 'unité géomorphologique', property = 'P4688'},
			building.mountainrange(),
			{type = 'row', label = '[[Point culminant]]', value = 'point culminant', property = 'P610'},
			{type = 'row', label = 'Astre', value = 'astre', property = 'P376'},
			building.island(),
			building.watershed(),
			building.protectedarea(),
			{
				type = 'row', 
				label = '[[Altitude]]', 
				value = function ( localdata )
					if localdata[ 'altitude' ] then  
						return unit._unite{localdata[ 'altitude' ],'m'}
					end
				end,
				wikidata = {property = 'P2044', targetunit = 'metre', conjtype = ' ou ', rounding = '0', numval ='1'} 
			},
			{type = 'row', label = '[[Proéminence]]', value = 'proéminence', wikidata = {property = 'P2660', targetunit = 'm', rounding = '0'}},
			{type = 'row', label = '[[Col-clé]]', value = 'col-clé', property = 'P7479'},
			{type = 'row', label = '[[Isolement topographique|Isolement]]', value = 'isolement', wikidata = {property = 'P2659', targetunit = 'km', rounding = '1'}},
			{type = 'row', label = 'Sommet parent', value = 'parent', property = 'P3137'},
			{
				type = 'row', 
				label = 'Longueur', 
				value = function ( localdata )
					if localdata[ 'longueur' ] then  
						return unit._unite{localdata[ 'longueur' ],'km'}
					end
				end,
				wikidata = {property = 'P2043', targetunit = 'km', rounding = '0'}
			},
			{
				type = 'row',
				label = 'Largeur',
				value = function ( localdata )
					if localdata[ 'largeur' ] then  
						return unit._unite{localdata[ 'largeur' ],'km'}
					end
				end,
				wikidata = {property = 'P2049', targetunit = 'km', rounding = '1'}
			},
			{
				type = 'row',
				label = 'Diamètre',
				value = function ( localdata )
					if localdata[ 'diamètre' ] then  
						return unit._unite{localdata[ 'diamètre' ],'km'}
					end
				end,
				wikidata = {property = 'P2386', targetunit = 'km', rounding = '1'}
			},
			{
				type = 'row', 
				label = 'Superficie', 
				value = function ( localdata )
					if localdata[ 'superficie' ] then  
						return unit._unite{localdata[ 'superficie' ],'km2'}
					end
				end,
				wikidata = {property = 'P2046', targetunit = 'sqkm', rounding = '0'}
			},
			{
				type = 'row',
				label = 'Volume',
				value = function ( localdata )
					if localdata[ 'volume' ] then  
						return unit._unite{localdata[ 'volume' ],'km3'}
					end
				end,
				wikidata = {property = 'P2234', targetunit = 'km3', rounding = '0'}
			},
		location.coordinates(),
		{type = 'row', label = 'Comprend', value = 'comprend', wikidata = {property = 'P527', numval = '7'}},
		}},
		{type = 'table', title = 'Administration', rows = {
			general.country(),
			{type = 'row', label = 'Localisation', value = 'localisation', property = 'P131'},
		}},
		{type = 'table', title = 'Astre', rows = {
			{
				type = 'row',
				value = function ( localdata )
					local val = localdata['astre']
					if val and (mw.ustring.lower(val) ~= 'terre') then
						return val
					end
				end
			}
		}},
		{type = 'table', title = 'Ascension', rows = {
			{type = 'row', label = '[[Première ascension|Conquête]]', value = {'première ascension', 'conquête'}, wikidata = {showonlyqualifier = {'P710', 'P585'}, property = 'P793', targetvalue = 'Q1194369'}},
			{type = 'row', label = 'Voie', value = 'voie', property = 'P7309'},
			{type = 'row', label = '[[Voie normale (alpinisme)|Voie normale]]', value = 'voie normale', wikidata = {property = 'P2795', qualifier = 'P518', qualifiervalue = 'Q34976110', showqualifiers = 'P1427'}},
			{type = 'row', label = 'Danger', plurallabel = 'Dangers', value = 'danger', wikidata = {property = 'P3335', numval = '3'}},
			{type = 'row', label = '[[Record d\'ascension|Record]]', value = 'record', wikidata = {showonlyqualifier = {'P3279', 'P2047', 'P585'}, property = 'P793', targetvalue = 'Q38072305'}},
			{type = 'row', label = '[[Panorama|Vue sur]]', value = 'vue sur', wikidata = {property = 'P3173', showqualifiers = 'P654', numval = '4'}},
		}},
		{type = 'table', title = 'Géologie', rows = {
			{type = 'row', label = '[[Roche]]s', value = 'roches', property = 'P186'},
			{type = 'row', label = 'Type', value = 'type', wikidata = {property = 'P31', excludevalues = {'Q8502', 'Q1595289', 'Q34987520'}}},
			{type = 'row', label = '[[Activité d\'un volcan|Activité]]', value = 'activité'},
			{type = 'row', label = 'Âge', value = 'âge', property = 'P2348'},
			{type = 'row', label = 'Dernière [[Éruption volcanique|éruption]]', value = 'éruption', wikidata = {property = 'P793', targetvalue = 'Q29575458', showonlyqualifier = {'P585', 'P580', 'P582'}, conjtype = ' - '}},
			{type = 'row', label = '[[Observatoire volcanologique|Observatoire]]', value = 'observatoire', property = 'P3815'},
			{type = 'row', label = 'Code [[Global Volcanism Program|GVP]]', value = {'GVP', 'identifiant'}, wikidata = {property = "P1886", urlpattern="http://www.volcano.si.edu/volcano.cfm?vn=$1"}},
			{type = 'row', label = 'Code [[Volcano Global Risk Identification and Analysis Project|VOGRIPA]]', value = 'VOGRIPA', wikidata = {property = "P4708", urlpattern="http://www.bgs.ac.uk/vogripa/searchVOGRIPA.cfc?method=detail&id=$1"}},
		}},
		{type = 'table', title = 'Histoire et culture', rows = {
			{type = 'row', label = 'Découverte', value = 'découverte', property = 'P575'},
			{type = 'row', label = 'Découvreur', plurallabel = 'Découvreurs', value = 'découvreur', property = 'P61'},
			{type = 'row', label = 'Nom local', value = 'nom local', wikidata = {property = 'P1705', showlang = true}},
			{type = 'row', label = 'Nommé selon', value = 'nommé selon', wikidata = {showonlyqualifier = 'P138', property = 'P1705'}},
			{type = 'row', label = 'Nommé par', value = 'nommé par', wikidata = {showonlyqualifier = 'P3938', property = 'P1705'}},
			{type = 'row', label = 'Surnom', plurallabel ='Surnoms', value = 'surnom', wikidata = {property = 'P1449', lang = 'fr'}},
			{type = 'row', label = 'Vénéré par', value = 'vénéré par', property = 'P1049'},
			building.visitors(),
			building.protection(),
		}},
		location.geoloc({marker=displayformat[3], default_zoom=displayformat[5], markercolor=displayformat[4], maptype = 'relief', pointtype=displayformat[6]}) 
	}
}