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 item = localdata.item
local general = require "Module:Infobox/Fonctions"
local geolocalisation = require "Module:Infobox/Fonctions/Géolocalisation"
local wd = require "Module:Wikidata"
local wdGlobe = require "Module:Wikidata/Globes"
local convert = require "Module:Conversion"
local frame = mw.getCurrentFrame() --pour l'expansion des modèles non Lua

local spectralLinks = {
	['G0V'] = 'Naine jaune',
	['G1V'] = 'Naine jaune',
	['G2V'] = 'Naine jaune',
	['G3V'] = 'Naine jaune',
	['G4V'] = 'Naine jaune',
	['G5V'] = 'Naine jaune',
	['G6V'] = 'Naine jaune',
	['G7V'] = 'Naine jaune',
	['G8V'] = 'Naine jaune',
	['G9V'] = 'Naine jaune', -- à compléter
}


local function coords() -- à convertir en Lua 
	if localdata['coord titre'] == 'non' then
		return nil
	end
	return frame:expandTemplate{ title = 'Coord univers/avec séparateur', args = {localdata['ascension droite'], localdata['déclinaison']} }
end


local function rascension()
	local asc, ascnotes = localdata['ascension droite'], localdata['ascension droite notes']
	local asc2, asc2notes = localdata['ascension droite 2'], localdata['ascension droite notes 2']
	local str
	if asc then
		str = frame:expandTemplate{ title = 'Ascension droite/avec séparateur', args = {asc, ascnotes} }
		if asc2 then
			str = str .. frame:expandTemplate{ title = 'Ascension droite/avec séparateur', args = {asc2, asc2notes} }
		end
	end
	return str
end

local function declination() -- à faire sur le modèle de rascension

end

return {
	maincolor = '#CEDAF2',
	parts = {
		{type = 'external text', value = function() return coords() end},
		general.title(),
		general.mainimage('Article à illustrer Astronomie'), --rajouter upright
		{type = 'images', value = 'vidéo', property = 'P10'},
		{type = 'text', label = 'Nature', value = 'nature', plurallabel = "natures" , wikidata = {property = 'P31' , conjtype = 'new line', showsource = true}},
		{type = 'table', title = 'Localisation', rows = {
			{type = 'row', label = 'Nom international', value = 'nom international', wikidata = {property = 'P1448', showsource = true}}, -- nom donné par l'UAI
			{type = 'row', label = 'Symbole', value = 'notation', wikidata = {property = 'P913', showsource = true}}, -- symbole astronomique de l'astre
			{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'}, -- SYNTAXE A REVOIR 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 de l'univers où se trouve l'astre
			-- coordonnées : réutiliser  Modèle:Coord univers
			{type = 'row', label = '[[Ascension droite]]', value =function() return rascension() end, property = 'P6257'}, --à revoir pour convertir en h min sec plutôt que des valeurs décimales
			{type = 'row', label = '[[Déclinaison (astronomie)|Déclinaison]]', value = function() return declination() end, property = 'P6258'}, --idem pour avoir des ° min sec plutôt que des valeurs décimales
			{type = 'row', label = '[[Coordonnées galactiques|Latitude galactique]]', value = 'lat galactique', property = 'P6261'},
			{type = 'row', label = '[[Coordonnées galactiques|Longitude galactique]]', value = 'long galactique', property = 'P6260'},
			{type = 'row', label = '[[Époque (astronomie)|Époque]]', value = 'époque', wikidata = {property = 'P6259', showsource = true}},
			{type = 'row', label = '[[Constellation]]', plurallabel = "Constellations" , value = 'constellation', wikidata = {property = 'P59', showsource = true}},
			{type = 'row', label = 'Activité', value = 'activité'},
		}},
		{type = 'table', title = 'Spectrographie', rows = {
			{type = 'row', label = '[[Type spectral]]', value = {'type spectral', 'type spectral 2'}, wikidata = {
				property = 'P215',
				statementformat = function(statement)
					local str = wd.formatStatement(statement)
					local link = spectralLinks[str]
					if link then
						str = "[[" .. link .. '|' .. str .. "]]"
					end
					return str
					end
				}
			},
			{type = 'row', label = 'Classe spectrale', value = {'classification spectrale','spectre'}, wikidata = {property='P720', showsource = true}}, -- pour les planètes mineures/astéroïdes
			{type = 'row', label = "Famille d'astéroïdes", value = "famille d'astéroïdes", wikidata = {property = 'P744', showsource = true}}, -- pour les astéroïdes
			{type = 'row', label = '[[Magnitude apparente]] (U)', value = 'magnitude apparente bande U'}, -- obsolète, rétrocompatibilité Infobox Étoile
			{type = 'row', label = '[[Magnitude apparente]] (B)', value = 'magnitude apparente bande B'}, -- obsolète, rétrocompatibilité Infobox Étoile
			{type = 'row', label = '[[Magnitude apparente]] (R)', value = 'magnitude apparente bande R'}, -- obsolète, rétrocompatibilité Infobox Étoile
			{type = 'row', label = '[[Magnitude apparente]] (J)', value = 'magnitude apparente bande J'}, -- obsolète, rétrocompatibilité Infobox Étoile
			{type = 'row', label = '[[Magnitude apparente]] (H)', value = 'magnitude apparente bande H'}, -- obsolète, rétrocompatibilité Infobox Étoile
			{type = 'row', label = '[[Magnitude apparente]] (K)', value = 'magnitude apparente bande K'}, -- obsolète, rétrocompatibilité Infobox Étoile
			{type = 'row', label = '[[Magnitude apparente]]', plurallabel = '[[Magnitude apparente|Magnitudes apparentes]]', value = 'magnitude apparente', wikidata = {property = 'P1215', conjtype = 'new line', showqualifiers = 'P1227', showsource = true}},
			{type = 'row', label = '[[Indice de couleur|Indice]] U-B', value = {'u-b','u-b 2'}}, -- obsolète, rétrocompatibilité Infobox Étoile
			{type = 'row', label = '[[Indice de couleur|Indice]] B-V', value = {'b-v','b-v 2'}}, -- obsolète, rétrocompatibilité Infobox Étoile
			{type = 'row', label = '[[Indice de couleur|Indice]] V-R', value = {'v-r','v-r 2'}}, -- obsolète, rétrocompatibilité Infobox Étoile
			{type = 'row', label = '[[Indice de couleur|Indice]] R-I', value = {'r-i','r-i 2'}}, -- obsolète, rétrocompatibilité Infobox Étoile
			{type = 'row', label = '[[Indice de couleur|Indice]] J-K', value = {'j-k','j-k 2'}}, -- obsolète, rétrocompatibilité Infobox Étoile
			{type = 'row', label = '[[Indice de couleur|Indice]] J-H', value = {'j-h','j-h 2'}}, -- obsolète, rétrocompatibilité Infobox Étoile
			{type = 'row', label = '[[Indice de couleur]]', plurallabel = '[[Indice de couleur|Indices de couleur]]', value = 'indice', wikidata = {property = 'P1458', conjtype = 'new line', showqualifiers = 'P1227', showsource = true}},
			{type = 'row', label = '[[Étoile variable|Variabilité]]', value = 'variabilité', wikidata = {property = 'P881', showsource = true}},
			{type = 'row', label = '[[Albédo]]', value = 'albédo', wikidata = {property = 'P4501', showsource = true}}, -- ratio moyen pour corps solides
		}},
		{type = 'table', title = 'Astrométrie', rows = {
			{type = 'row', label = '[[Vitesse radiale]]', value = 'vitesse radiale', wikidata = {property = 'P2216', targetunit = 'kilometer per second', showsource = true}},
			{type = 'row', label = '[[Mouvement propre]]', value = {'mouvement propre', 'mouvement propre ad', 'mouvement propre déc'}, wikidata = {property = 'P2215', showlink = true, showsource = true}}, -- obsolète, maintenant dans 2 propriétés différentes pour ad et déc
			{type = 'row', label = '[[Parallaxe]]', value = 'parallaxe', wikidata = {property = 'P2214', showsource = true}},
			{type = 'row', label = '[[Distance (mathématiques)|Distance]] au Soleil', value = 'distance', wikidata = {property = 'P2583' , conjtype= ' ou ' , targetunit = 'light year', showsource = true}},
			{type = 'row', label = '[[Magnitude absolue]]', value = 'magnitude absolue', wikidata = {property = 'P1457', showsource = true}},
		}},
		{type = 'table', title = 'Orbite', rows = {
			{type = 'row', label = 'Parent orbital', value = 'orbite', wikidata = {property = 'P397', showsource = true}},
			{type = 'row', label = '[[Grand axe|Demi-grand axe]]', value = 'demi-grand axe', wikidata = {property = 'P2233', targetunit = 'astronomical unit' , rounding = 5, showsource = true}},
			{type = 'row', label = '[[Apoapside]]', value = {'aphélie', 'apoapside', 'apogée'}, wikidata = {property = 'P2243', showsource = true}},
			{type = 'row', label = '[[Périapside]]', value = {'périhélie', 'périapside', 'périgée'}, wikidata = {property = 'P2244', showsource = true}},
			{type = 'row', label = 'Circonférence orbitale', value = 'circonférence orbitale'},
			{type = 'row', label = '[[Excentricité orbitale|Excentricité]]', value = 'excentricité', wikidata={property = 'P1096', rounding=6, showsource = true}},
			{type = 'row', label = '[[Période de révolution]]', value = 'période de révolution', wikidata = {property = 'P2146', showsource = true}},
			{type = 'row', label = '[[Période synodique]]', value = 'période synodique', wikidata = {property = 'P4341', showsource = true}},
			{type = 'row', label = '[[Vitesse orbitale|vitesse orbitale]] moyenne', value = 'vitesse orbitale moyenne'},
			{type = 'row', label = 'Vitesse orbitale maximale', value = 'vitesse orbitale maximale'},
			{type = 'row', label = 'Vitesse orbitale minimale', value = 'vitesse orbitale minimale'},
			{type = 'row', label = '[[Inclinaison orbitale|Inclinaison]]', value = 'inclinaison', wikidata = {property = 'P2045', showsource = true}},
			{type = 'row', label = '[[Nœud (astronomie)|Nœud ascendant]]', value = 'nœud ascendant', wikidata = {property = 'P2213', showsource = true}},
			{type = 'row', label = '[[Argument du périastre]]', value = {'argument du périhélie', 'argument du périastre'}, wikidata = {property = 'P2248', showsource = true}},
		}},
		{type = 'table', title = 'Caractéristiques physiques', rows = {
			{type = 'row', label = 'Masse', value = 'masse', wikidata = {property = 'P2067', showlink = true, showsource = true}},
			{type = 'row', label = 'Rayon', value = 'rayon', wikidata = {property = 'P2120', showlink = true, showsource = true}}, --à développer entre rayons équatorial, polaire et moyen volumétrique
			{type = 'row', label = 'Diamètre', value = {'diamètre','diamètre noyau'}, wikidata = {property = 'P2386', showlink = true, showqualifiers = 'P1480,P5447,P5448' , qualifconjtype = ' à ' , showsource = true}},
			{type = 'row', label = '[[Aplatissement]]', value = 'aplatissement', wikidata = {property = 'P1102', showlink = true, showsource = true}}, --vérifier l'intégration de la marge d'erreur
			{type = 'row', label = 'Luminosité', value = 'luminosité',  wikidata = {property = 'P2060', showlink = true, showsource = true}},
			{type = 'row', label = 'Température', value = 'température', wikidata = {property = 'P2076', showlink = true, showsource = true}},
			{type = 'row', label = 'Température', value = 'température effective', wikidata = {property = 'P6879', showlink = true, showsource = true}},
			{type = 'row', label = '[[Métallicité]]', value = 'métallicité', wikidata = {property = 'P2227', showsource = true}},
			{type = 'row', label = '[[Rotation stellaire|Vitesse de rotation]]', value = 'vitesse rotation étoile', wikidata = {property = 'P4296', showsource = true}},
			{type = 'row', label = '[[Période de rotation]]', value = 'période rotation', wikidata = {property = 'P2147', showsource = true}},
			{type = 'row', label = 'Point culminant', value = 'pculminant', wikidata = {property = 'P2044', showsource = true}},
			{type = 'row', label = 'Longueur', value = 'longueur', wikidata = {property = 'P2043', showsource = true}},
			{type = 'row', label = 'Largeur', value = 'largeur', wikidata = {property = 'P2049', showsource = true}},
			{type = 'row', label = 'Superficie', value = 'surface', wikidata = {property = 'P2046', targetunit = 'square kilometer', showsource = true}},
			{type = 'row', label = 'Hauteur', value = 'hauteur', wikidata = {property = 'P2048', targetunit = 'm', showsource = true}}, --vérifier la pertinence
			{type = 'row', label = 'Profondeur', value = 'profondeur', wikidata = {property = 'P2610', targetunit = 'm', showsource = true}}, --vérifier la pertinence
			{type = 'row', label = 'Âge', value = 'âge', wikidata = { property = "P7584", conjtype= "or", showsource = true}},
		}},
		{type = 'table', title = 'Atmosphère', rows = {
			{type = 'row', label = 'Masse volumique à 100 kPa', value = 'masse volumique', wikidata = {property = 'P2054', showsource = true}}, --n'utilise pas encore la pression indiquée dans les qualificatifs
			{type = 'row', label = 'Hauteur d’échelle', value = "hauteur d'échelle"}, --demander la création de la propriété sur Wikidata
			{type = 'row', label = 'Masse molaire moyenne', value = 'masse molaire'}, --demander la création de la propriété sur Wikidata
		}},
		{type = 'table', title = 'Composantes', rows = {
			{type = 'row', label = 'Étoile', plurallabel = 'Étoiles', value = 'composants stellaires', wikidata =  {
				property =  'P527',
				excludespecial = true,
				condition = function (statement)
					local id = wd.getMainId(statement)
					return wd.isInstance('Q523', id, 2)
					end
				}
			}
		}},
		{type = 'table', title = 'Système', rows = {
			{type = 'row', label = '[[Exoplanète|Planète]]', plurallabel = '[[Exoplanète|Planètes]]', value = 'planètes', wikidata = {
				property = 'P398',
				condition = function(statement) 
					local v = wd.getMainId(statement)
					return wd.isInstance('Q634', v, 3)
					end
				}
			}
		}},
		{type = 'table', title = 'Exploration', rows = {
			{type = 'row', label = 'Découvreur', plurallabel = 'Découvreurs', value = 'découvreur', wikidata = {property = 'P61', showsource = true}},
			{type = 'row', label = 'Lieu de découverte', plurallabel = 'Lieux de découverte', value = 'lieu de découverte', wikidata = {property = 'P65', showsource = true}}, --à arranger à la suite de Découvreur
			{type = 'row', label = 'Date de découverte', value = 'date', wikidata = {property = 'P575', showsource = true}},--à arranger à la suite du lieu au sein d'une même parenthèse
			{type = 'row', label = 'Éponyme', value = 'éponyme', wikidata = {property = 'P138', showsource = true}},
		}},
		{type = 'table', title = 'Identifiants', rows = {
			function()
				-- cas particulier : utilisation du paramètre local 'catalogue'

				if localdata['catalogues'] then
					return 	{type = 'row', label = 'Catalogues', value = 'catalogue'}
				end
				
				local rows = {}
				
				-- catalogues stockés dans la propriété P528
				local query = {entity = item, property = 'P528', qualifier = 'P972', qualifiervalue = {'Q105616', 'Q222662', 'Q111116', 'Q4502205', 'Q1454942', 'Q845735', 'Q392437', 'Q2937249', 'Q27891498', 'Q51905050', 'Q66061041', 'Q1045111', 'Q2941617', 'Q499138', 'Q111130', 'Q537199', 'Q27891782', 'Q4042165', 'Q28915419', 'Q28915499', 'Q28915747', 'Q28916763', 'Q123557842', 'Q1563455', 'Q932275', 'Q693552'}} -- Bayer, Flamsteed, Gould, GCVS, 2MASS, Bonner Durchmusterung, Córdoba Durchmusterung, Cape Photographic Durchmusterung, CoRoT, Gaia DR2 et DR3, Gliese, HR, BSC, HD, Hipparcos, Kepler, KIC, LFT, LHS, LTT, NLTT, Tycho, TOI, WDS, WISE
				local catalogues = wd.getClaims(query)
				for i, j in ipairs(catalogues or {}) do
					local catnum = wd.formatStatement(j)
					local cat = wd.getFormattedQualifiers(j, 'P972', {ucfirst = '-'})
					cat = mw.ustring.gsub(cat, "\|désignation de ", "\|") -- Raccourcissement des textes
					cat = mw.ustring.gsub(cat, "\|Désignation de ", "\|") -- Raccourcissement des textes
					cat = mw.ustring.gsub(cat, "\|catalogue de ", "\|") -- Raccourcissement des textes
					cat = mw.ustring.gsub(cat, "\|Catalogue ", "\|") -- Raccourcissement des textes
					cat = mw.ustring.gsub(cat, "\|catalogue ", "\|") -- Raccourcissement des textes
					cat = mw.ustring.gsub(cat, "\|General Catalogue of Variable Stars", "\|GCVS") -- Raccourcissement des textes
					cat = mw.ustring.gsub(cat, "\|d'étoiles doubles de Washington", "\|WDS") -- Raccourcissement des textes
					table.insert(rows, {type = 'row', label = cat, wikidata = function() return catnum end} )
				end
				
				-- catalogues stockées en identifiants externes
				-- SIMBAD
				local simbad = wd.formatStatements{property = 'P3083', entity = item, urlpattern = 'http://simbad.u-strasbg.fr/simbad/sim-id?Ident=$1'}
				if simbad then
					table.insert(rows, {type = 'row', label = '[[Simbad]]', wikidata = function() return simbad end})
				end
				
				-- identifiant JPL Small-Body (P716)
				local jplsb = wd.formatStatements{property = 'P716', entity = item, urlpattern = 'https://ssd.jpl.nasa.gov/sbdb.cgi?sstr=$1'}
				if jplsb then
					table.insert(rows, {type = 'row', label = '[[JPL Small-Body Database|SBDB]]', wikidata = function() return jplsb end})
				end
				
				-- identifiant Centre des planètes mineures d'un objet céleste (P5736)
				local mpc_id = wd.formatStatements{property = 'P5736', entity = item, urlpattern = 'https://www.minorplanetcenter.net/db_search/show_object?object_id=$1'}
				if mpc_id then
					table.insert(rows, {type = 'row', label = '[[Centre des planètes mineures|CPM]]', wikidata = function() return mpc_id end})
				end
				
				-- identifiant NASA Exoplanet Archive (P5667)
				local nasa_ea = wd.formatStatements{property = 'P5667', entity = item, urlpattern = 'https://exoplanetarchive.ipac.caltech.edu/overview/$1'}
				if nasa_ea then
					table.insert(rows, {type = 'row', label = '[[Centre des planètes mineures|CPM]]', wikidata = function() return nasa_ea end})
				end
				
				-- identifiant identifiant Encyclopédie des planètes extrasolaires (P5653)
				local epe = wd.formatStatements{property = 'P5663', entity = item, urlpattern = 'https://exoplanet.eu/catalog/$1/'}
				if epe then
					table.insert(rows, {type = 'row', label = "[[L'Encyclopédie des planètes extrasolaires|EPE]]", wikidata = function() return epe end})
				end
				
				-- identifiant ARICNS (P999)
				local aricns = wd.formatStatements{property = 'P999', entity = item, urlpattern = 'https://wwwadd.zah.uni-heidelberg.de/datenbanken/aricns/cnspages/4c$1.htm'}
				if aricns then
					table.insert(rows, {type = 'row', label = '[[Institut de calcul astronomique|ARICNS]]', wikidata = function() return aricns end})
				end

				-- ajouter l'identifiant Exoplanet Data Explorer (P5650)
				-- ajouter l'identifiant NAIF (P2956)
				-- ajouter l'identifiant Open Exoplanet Catalogue (P5738)
				
				return {type = 'multi', rows = rows}
				end
		}},
	}
}