Aller au contenu

Module:Infobox/Relief terrestre

Une page de Wikipédia, l'encyclopédie libre.
Ceci est une version archivée de cette page, en date du 26 janvier 2018 à 12:51 et modifiée en dernier par Thierry Caro (discuter | contributions). 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 Relief terrestre.


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 formats = {
	--{icône pointeur, couleur pointeur, niveau de zoom)
	Q29025902 = {'triangle-stroked', '#8B0000', '10'}, -- formation volcanique
	Q1061151 = {'triangle-stroked', '#996633', '6'}, -- massif
	Q46831 = {'triangle-stroked', '#996633', '6'}, -- chaîne de montagnes
	default = {'triangle-stroked', '#996633', '10'}
}

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()
	if localdata['charte'] then
		charte = localdata['charte']
		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 = '#996633',
	thirdcolor = 'white',
	parts = {
		
		general.title('map', {color = 'white'}),
		general.mainimage('Article à illustrer Montagne', 'Defaut.svg'),
		{type = 'table', title = 'Géographie', rows = {
			{type = 'row', label = 'Astre', value = 'astre', property = 'P376'},
			general.country(),
			{type = 'row', label = 'Localisation', value = 'localisation', property = 'P131'},
			building.watershed(),
			building.protectedarea(),
			location.coordinates(),
			{type = 'row', label = '[[Point culminant]]', value = 'point culminant', property = 'P610'},
			{type = 'row', label = '[[Altitude]]', value = 'altitude', wikidata = {property = 'P2044', targetunit = 'metre', conjtype = ' ou ', rounding = '0', numval ='1'} },
			{type = 'row', label = '[[Hauteur de culminance|Culminance]]', value = 'culminance', wikidata = {property = 'P2660', targetunit = 'm', rounding = '0'}},
			{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 = 'longueur', wikidata = {property = 'P2043', targetunit = 'km', rounding = '0'}},
			{type = 'row', label = 'Largeur', value = 'largeur', wikidata = {property = 'P2049', targetunit = 'km', rounding = '1'}},
			{type = 'row', label = 'Diamètre', value = 'diamètre', wikidata = {property = 'P2386', targetunit = 'km', rounding = '1'} },
			{type = 'row', label = 'Superficie', value = 'superficie', wikidata = {property = 'P2046', targetunit = 'sqkm', rounding = '0'} },
			{type = 'row', label = 'Volume', value = 'volume', wikidata = {property = 'P2234', targetunit = 'km3', rounding = '0'} },
		}
		},
		{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 = 'Géologie', 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 = 'Type', value = 'type', wikidata = {property = 'P31', excludevalues = {'Q8502', 'Q1595289', 'Q34987520'}}},
			{type = 'row', label = 'Comprend', value = 'comprend', wikidata = {property = 'P527', numval = '7'}},
			{type = 'row', label = '[[Roche]]s', value = 'roches', property = 'P186'},
			{type = 'row', label = 'Âge', value = 'âge'},
			{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'},
			{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 normale (alpinisme)|Voie normale]]', value = 'voie', 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'}},
			building.visitors(),
		}},
		location.geoloc({marker=displayformat[1], default_zoom=displayformat[3], markercolor=displayformat[2], maptype = 'relief'}) 
	}
}