Module:Infobox/Relief terrestre

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.


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 = {
	--(couleur de fond, couleur du texte, icône pointeur, couleur pointeur, niveau de zoom)
	-- ne mettre que des icônes répertoriés sur https://www.mediawiki.org/wiki/Help:Extension:Kartographer/Icons
	Q29025902 = {'#996633', 'white', 'triangle-stroked', '#8B0000', '10'}, -- formation volcanique
	Q1061151 = {'#996633', 'white', 'triangle', '#996633', '6'}, -- massif
	Q46831 = {'#996633', 'white', 'triangle', '#996633', '6'}, -- chaîne de montagnes
	Q150784 = {'#DFAF2C', 'black', 'circle-stroked', '#DFAF2C', '10'}, -- gorge
	Q39816 = {'#BFFFBF', 'black', 'circle-stroked', '#BFFFBF', '7'}, -- vallée
	Q160091 = {'#ACD0A5', 'black', 'circle-stroked', '#ACD0A5', '7'}, -- plaine
	Q37901 = {'#80B0E0', 'white', 'circle-stroked', '#80B0E0', '6'}, -- détroit
	Q23442 = {'#7793E0', 'white', 'circle-stroked', '#80B0E0', '6'}, -- île
	Q23442 = {'#7793E0', 'white', 'circle-stroked', '#80B0E0', '6'}, -- archipel
	Q42523 = {'#7793E0', 'white', 'circle-stroked', '#80B0E0', '6'}, -- atoll
	default = {'#996633', 'white', 'circle-stroked', '#996633', '10'}
}
local namedformats = {
	-- appelables par le paramètre charte
	["formation volcanique"] = "Q29025902",
	["volcan"] = "Q29025902",
	["massif"] = "Q1061151",
	["chaîne de montagnes"] = "Q46831",
	["montagne"] = "Q46831",
	["gorge"] = "Q150784",
	["vallée"] = "Q39816",
	["plaine"] = "Q160091",
	["détroit"] = "Q37901",
	["default"] = "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(namedformats) do
			if i == charte then
				return formats[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 = 'Astre', value = 'astre', wikidata = {property = 'P376', showsource = true}},
			general.country(),
			{type = 'row', label = 'Localisation', value = 'localisation', property = 'P131'},
			building.island(),
			building.watershed(),
			building.protectedarea(),
			location.coordinates(),
			{type = 'row', label = '[[Point culminant]]', value = 'point culminant', wikidata = {property = 'P610', showsource = true}},
			{type = 'row', label = '[[Altitude]]', value = 'altitude', wikidata = {property = 'P2044', targetunit = 'metre', conjtype = ' ou ', rounding = '0', numval ='1', showsource = true} },
			{type = 'row', label = '[[Proéminence]]', value = 'proéminence', wikidata = {property = 'P2660', targetunit = 'm', rounding = '0', showsource = true}},
			{type = 'row', label = '[[Col-clé]]', value = 'col-clé', wikidata = {property = 'P7479', showsource = true}},
			{type = 'row', label = '[[Isolement topographique|Isolement]]', value = 'isolement', wikidata = {property = 'P2659', targetunit = 'km', rounding = '1', showsource = true}},
			{type = 'row', label = 'Sommet parent', value = 'parent', wikidata = {property = 'P3137', showsource = true}},
			{type = 'row', label = 'Baigné par', value = 'baigné par', wikidata = {property = 'P206'}},
			{type = 'row', label = 'Longueur', value = 'longueur', wikidata = {property = 'P2043', targetunit = 'km', rounding = '0', showsource = true}},
			{type = 'row', label = 'Largeur', value = 'largeur', wikidata = {property = 'P2049', targetunit = 'km', rounding = '1', showsource = true}},
			{type = 'row', label = 'Diamètre', value = 'diamètre', wikidata = {property = 'P2386', targetunit = 'km', rounding = '1', showsource = true}},
			{type = 'row', label = 'Superficie', value = 'superficie', wikidata = {property = 'P2046', targetunit = 'sqkm', rounding = '0', showsource = true}},
			{type = 'row', label = 'Volume', value = 'volume', wikidata = {property = 'P2234', targetunit = 'km3', rounding = '0', showsource = true}},
		}
		},
		{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', wikidata = {property = 'P30', showsource = true}},
			{type = 'row', label = 'Unité géomorphologique', value = 'unité géomorphologique', wikidata = {property = 'P4688', showsource = true}},
			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', showsource = true}},
			{type = 'row', label = '[[Roche]]s', value = 'roches', wikidata = {property = 'P186', showsource = true}},
			{type = 'row', label = 'Âge', value = 'âge', wikidata = {property = 'P2348', showsource = true}},
			{type = 'row', label = 'Dernière [[Éruption volcanique|éruption]]', value = 'éruption', wikidata = {property = 'P793', targetvalue = 'Q29575458', showonlyqualifier = {'P585', 'P580', 'P582'}, conjtype = ' - '}, showsource = true},
			{type = 'row', label = '[[Observatoire volcanologique|Observatoire]]', value = 'observatoire', wikidata = {property = 'P3815'}, showsource = true},
			{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', wikidata = {property = 'P575', showsource = true}},
			{type = 'row', label = 'Découvreur', plurallabel = 'Découvreurs', value = 'découvreur', wikidata = {property = 'P61', showsource = true}},
			{type = 'row', label = 'Nom local', value = 'nom local', wikidata = {property = 'P1705', showlang = true, showsource = true}},
			{type = 'row', label = 'Nommé selon', value = 'nommé selon', wikidata = {showonlyqualifier = 'P138', property = 'P1705', showsource = true}},
			{type = 'row', label = 'Nommé par', value = 'nommé par', wikidata = {showonlyqualifier = 'P3938', property = 'P1705', showsource = true}},
			{type = 'row', label = 'Surnom', plurallabel ='Surnoms', value = 'surnom', wikidata = {property = 'P1449', lang = 'fr', showsource = true}},
			{type = 'row', label = 'Vénéré par', value = 'vénéré par', wikidata = {property = 'P1049', showsource = true}},
			{type = 'row', label = '[[Première ascension|Conquête]]', value = {'première ascension', 'conquête'}, wikidata = {showonlyqualifier = {'P710', 'P585'}, property = 'P793', targetvalue = 'Q1194369', showsource = true}},
			{type = 'row', label = 'Voie', value = 'voie', wikidata = {property = 'P7309', showsource = true}},
			{type = 'row', label = '[[Voie normale (alpinisme)|Voie normale]]', value = 'voie normale', wikidata = {property = 'P2795', qualifier = 'P518', qualifiervalue = 'Q34976110', showqualifiers = 'P1427', showsource = true}},
			{type = 'row', label = 'Danger', plurallabel = 'Dangers', value = 'danger', wikidata = {property = 'P3335', numval = '3', showsource = true}},
			{type = 'row', label = '[[Record d\'ascension|Record]]', value = 'record', wikidata = {showonlyqualifier = {'P3279', 'P2047', 'P585'}, property = 'P793', targetvalue = 'Q38072305', showsource = true}},
			{type = 'row', label = '[[Panorama|Vue sur]]', value = 'vue sur', wikidata = {property = 'P3173', showqualifiers = 'P654', numval = '4', showsource = true}},
			building.visitors(),
			building.protection(),
		}},
		location.geoloc({marker=displayformat[3], default_zoom=displayformat[5], markercolor=displayformat[4], maptype = 'relief'}) 
	}
}