Module:Infobox/Astre
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 :
- {{Infobox Planète}}
- {{Infobox Exoplanète}}
- {{Infobox Pulsar}}
- {{Infobox Planète mineure}}
- {{Infobox Comète}}
- {{Infobox Satellite naturel}}
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 defonction(frame)
et autres informations pertinentes).fonction2()
– description2 (courte description defonction2()
et autres informations pertinentes).
Autres fonctions :
fonction()
– description2 (courte description defonction()
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.
La documentation de ce module est générée par le modèle {{Documentation module}}.
Elle est incluse depuis sa sous-page de documentation. Veuillez placer les catégories sur cette page-là.
Les éditeurs peuvent travailler dans le bac à sable (créer).
Voir les statistiques d'appel depuis le wikicode sur l'outil wstat et les appels depuis d'autres modules.
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'}},
{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}},
{type = 'row', label = 'Rayon', value = 'rayon', wikidata = {property = 'P2120', showlink = 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}},
{type = 'row', label = 'Température', value = 'température effective', wikidata = {property = 'P6879', showlink = true}},
{type = 'row', label = '[[Métallicité]]', value = 'métallicité', property = 'P2227'},
{type = 'row', label = '[[Rotation stellaire|Vitesse de rotation]]', value = 'vitesse rotation étoile', property = 'P4296'},
{type = 'row', label = '[[Période de rotation]]', value = 'période rotation', property = 'P2147'},
{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 = { property = "P7584", conjtype= "or"}},
}},
{type = 'table', title = 'Atmosphère', rows = {
{type = 'row', label = 'Masse volumique à 100 kPa', value = 'masse volumique', property = 'P2054'}, --n'utilise pas encore la pression indiquée dans les qualificatifs
{type = 'row', label = 'Hauteur d’échelle', value = "hauteur d'échelle"},
{type = 'row', label = 'Masse molaire moyenne', value = 'masse molaire'},
}},
{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', property = 'P61'},
{type = 'row', label = 'Lieu de découverte', plurallabel = 'Lieux de découverte', value = 'lieu de découverte', property = 'P65'}, --à arranger à la suite de Découvreur
{type = 'row', label = 'Date de découverte', value = 'date', property = 'P575'},--à arranger à la suite du lieu au sein d'une même parenthèse
{type = 'row', label = 'Éponyme', value = 'éponyme', property = 'P138'},
}},
{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', 'Q37859523', 'Q51905050', 'Q1045111', 'Q2941617', 'Q499138', 'Q111130', 'Q537199', 'Q27891782', 'Q4042165', 'Q123557842', 'Q1563455', 'Q693552'}} -- Bayer, Flamsteed, Gould, GCVS, 2MASS, Bonner Durchmusterung, Córdoba Durchmusterung, Cape Photographic Durchmusterung, CoRoT, Gaia DR1 et DR2, Gliese, HR, BSC, HD, Hipparcos, Kepler, KIC, Tycho, TOI, 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
table.insert(rows, {type = 'row', label = cat, wikidata = function() return catnum end} )
end
-- catalogues stockées en identifiants externes
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
-- ajouter l'identifiant JPL Small-Body (P716)
-- ajouter l'identifiant ARICNS (P999)
-- ajouter l'identifiant NASA Exoplanet Archive (P5667)
-- ajouter l'identifiant Encyclopédie des planètes extrasolaires (P5653)
-- ajouter l'identifiant Exoplanet Data Explorer (P5650)
-- ajouter l'identifiant NAIF (P2956)
-- ajouter l'identifiant Centre des planètes mineures d'un objet céleste (P5736)
-- ajouter l'identifiant Open Exoplanet Catalogue (P5738)
return {type = 'multi', rows = rows}
end
}},
}
}