Aller au contenu

Module:Infobox/Astre

Une page de Wikipédia, l'encyclopédie libre.
Ceci est une version archivée de cette page, en date du 13 août 2017 à 01:39 et modifiée en dernier par J. N. Squire (discuter | contributions) (Création du module pour le projet Astronomie à partir de Module:Infobox/Géographie planétaire et de Modèle:Infobox Étoile). 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 Astre.

Module dérivé de {{Infobox Relief}} et de {{Modèle:Infobox Étoile}}. Version pré-alpha non-testée pour le moment.

Autres modèles à intégrer :

Ce module fait aussi appel aux modules suivants : Module:Infobox/Localdata, Module:Infobox/Fonctions, Module:Infobox/Fonctions/Géolocalisation, Module:Wikidata, Module:Wikidata/Globes et Module:Conversion.

Utilisation

Fonctions exportables :

  • fonction(frame) – description (courte description de fonction(frame) et autres informations pertinentes).
  • fonction2() – description2 (courte description de fonction2() et autres informations pertinentes).

Autres fonctions :

  • fonction() – description2 (courte description de fonction() et autres informations pertinentes).

Modules externes et autres éléments dont ce module a besoin pour fonctionner :

  • mw.title – description (courte description expliquant la dépendance de ce module externe).

Exemples

Pour des exemples, voir la page de test permettant de tester diverses modifications apportées.

local localdata = require "Module:Infobox/Localdata"
local general = require "Module:Infobox/Fonctions"
local geolocalisation = require "Module:Infobox/Fonctions/Géolocalisation"
local wd = require "Module:Interface Wikidata".fromLua
local wdGlobe = require "Module:Wikidata/Globes"

local function age()
	local s = wd.formatAndCat{entity = localdata.item, property = "P571", conjtype= "or"}
	if s then
		return "il y a " .. s
	end
end

local function globe()
	if localdata.globe then
		return localdata.globe
	end
	local p376 = wd.formatStatements{property = 'P376', entity = localdata.item, displayformat = "raw"}
	if p376 then
		return wdGlobe[ "http://www.wikidata.org/entity/" .. p376 ]
	end
end

return {
	maincolor = '#CEDAF2',
	parts = {
		general.title(),
		general.mainimage(), --rajouter upright
		{type = 'table', label = 'Époque', value = 'époque', property = 'P1448'},
		{type = 'table', label = 'Nature', value = 'nature', property = 'P31'},
		{type = 'table', title = 'Localisation', rows = {
			{type = 'row', label = 'Nom international', value = 'nom international', property = 'P1448'}, -- nom donné par l'UAI
			{type = 'row', label = 'Astre', value = {'astre', 'planète'}, property = 'P376'}, -- corps astronomique où se trouve le lieu dont il est question
			{type = 'row', label = 'Pays', plurallabel = 'Pays', value = {'pays', 'pays1', 'pays2', 'pays3'}, property = 'P17'}, -- le ou les pays où se trouve de facto l'astre, utile en Science-fiction
			{type = 'row', label = 'Région', plurallabel = 'Régions', value = 'région', property = 'P706'}, -- régions géographiques sans quadrangle
			geolocalisation.coordinates{ globe = globe()  },
			{type = 'row', label = '[[Ascension droite]]', value = {'ascension droite', 'ascension droite 2'}},
			{type = 'row', label = '[[Déclinaison (astronomie)|Déclinaison]]', value = {'déclinaison', 'déclinaison 2'}},
			{type = 'row', label = '[[Constellation]]', value = 'constellation', property = 'P59'},
			{type = 'row', label = '[[Magnitude apparente]]', value = 'activité', property = 'P1215'},
		}},
		{type = 'table', title = 'Spectrographie', rows = {
			{type = 'row', label = '[[Type spectral]]', value = {'type spectral', 'type spectral 2'}, property = 'P215'},
			{type = 'row', label = '[[Magnitude apparente]] (J)', value = 'magnitude apparente bande J'},
			{type = 'row', label = '[[Magnitude apparente]] (K)', value = 'magnitude apparente bande K'},
			{type = 'row', label = '[[Indice de couleur|Indice]] U-B', value = 'u-b'},
			{type = 'row', label = '[[Indice de couleur|Indice]] B-V', value = 'b-v'},
			{type = 'row', label = '[[Indice de couleur|Indice]] R-I', value = 'r-i'},
			{type = 'row', label = '[[Indice de couleur|Indice]] J-K', value = 'j-k'},
			{type = 'row', label = '[[Étoile variable|Variabilité]]', value = 'variabilité'},
		}},
		{type = 'table', title = 'Astrométrie', rows = {
			{type = 'row', label = '[[Vitesse radiale]]', value = 'vitesse radiale', property = 'P2216'}},
			{type = 'row', label = '[[Mouvement propre]]', value = {'mouvement propre', 'mouvement propre ad', 'mouvement propre déc'}, property = 'P2215'},
			{type = 'row', label = '[[Parallaxe]]', value = 'parallaxe', property = 'P2214'},
			{type = 'row', label = '[[Distance (mathématiques)|Distance]] à la Terre', value = 'distance', property = 'P2583'},
			{type = 'row', label = '[[Magnitude absolue]]', value = 'magnitude absolue', property = 'P1457'},
		}},
		{type = 'table', title = 'Caractéristiques physiques', rows = {
			{type = 'row', label = 'Masse', value = 'masse', property = 'P2067'},
			{type = 'row', label = 'Rayon', value = 'rayon', property = 'P2120'},
			{type = 'row', label = 'Diamètre', value = 'diamètre', property = 'P2386'},
			{type = 'row', label = 'Luminosité', value = 'luminosité', property = 'P2060'},
			{type = 'row', label = 'Température', value = 'température', property = 'P2076'},
			{type = 'row', label = '[[Métallicité]]', value = 'métallicité', property = 'P2227'},
			{type = 'row', label = 'Point culminant', value = 'pculminant', property = 'P2044'},
			{type = 'row', label = 'Longueur', value = 'longueur', property = 'P2043'},
			{type = 'row', label = 'Largeur', value = 'largeur', property = 'P2049'},
			{type = 'row', label = 'Superficie', value = 'surface', wikidata = {property = 'P2046', targetunit = 'square kilometer'}},
			{type = 'row', label = 'Hauteur', value = 'hauteur', wikidata = {property = 'P2048', targetunit = 'm'}},
			{type = 'row', label = 'Profondeur', value = 'profondeur', wikidata = {property = 'P2610', targetunit = 'm'}},
			{type = 'row', label = 'Âge', value = 'âge', wikidata = age()},
		}},
		{type = 'table', title = 'Composants', rows = {
			{type = 'row', label = '[[Étoile multiple|Composant stellaire]]', plurallabel = '[[Étoile multiple|Composants stellaires]]', value = 'composants stellaires', property = 'P361'},
		}},
		{type = 'table', title = 'Système planétaire', rows = {
			{type = 'row', label = '[[Exoplanète|Planète]]', plurallabel = '[[Exoplanète|Planètes]]', value = 'planètes', property = 'P361'},
		}},
		{type = 'table', title = 'Exploration', rows = {
			{type = 'row', label = 'Découvreur', plurallabel = 'Découvreurs', value = 'découvreur', property = 'P61'},
			{type = 'row', label = 'Date de découverte', value = 'date', property = 'P575'},
			{type = 'row', label = 'Éponyme', value = 'éponyme', property = 'P138'},
			{type = 'row', label = 'Autres désignations', value = 'désignations', property = 'P528'}
		}},
		geolocalisation.geoloc{ pointtype = getMapPoint(), globe = globe() },
	}