Module:Infobox/Biographie
Cette page définit un module d'infobox. Elle utilise des fonctions définies sur Module:Infobox/Fonctions/Personne. Pour les conseils sur l'usage de ce module, voyez Modèle:Infobox Biographie2.
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 (modifier).
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 person = require 'Module:Infobox/Fonctions/Personne'
local wd = require 'Module:Wikidata'
local linguistic = require 'Module:Linguistique'
local occupationformats = require 'Module:Infobox/Biographie/Chartes'
local function setformat() --retourne une table contenant la couleur principale de l'infobox et l'icône de titre
local occupations = wd.getIds(localdata.item, {property = 'P106'}) -- récupère les Qid des professions
if not occupations or (#occupations > 1) then -- si plusieurs occupations, on ne sait pas laquelle choisir
return {'Q', {'par défaut'}, '#EEEEFF', '#F6F6FF', '#000000', 'defaut'}
end
occupations = wd.addVals(occupations, {property = 'P279'}, 2) -- nombre d'étages de sous-classes à remonter
for i, j in pairs(occupations) do
for k, l in pairs(occupationformats) do
local chartIds = l[1]
if type(chartIds) == 'string' then chartIds = {chartIds} end
if wd.isHere(chartIds,j) then
return l --retourne une ligne de la table occupationformats, correspondant à l'occupation du sujet
end
end
end
return {'Q', {'par défaut'}, '#EEEEFF', '#F6F6FF', '#000000', 'defaut'}
end
local function setcharte()
local charte = localdata['charte']
if charte then
for i, j in pairs(occupationformats) do
local knowncharts = j[2]
if type(knowncharts) == 'table' then
if wd.isHere(knowncharts,charte) then
return j
end
end
end
end
return setformat()
end
local personformat = setcharte()
local function documentation()
local lines = {}
table.insert(lines , '{| class="wikitable sortable" style="width:100%"')
table.insert(lines , '|-')
table.insert(lines , '! style="width:10%" | Charte')
table.insert(lines , '! style="width:10%" | Élément Wikidata')
table.insert(lines , '! style="width:10%" | Valeur primaire<br />(fond titre)')
table.insert(lines , '! style="width:10%" | Valeur secondaire<br />(sous-titre)')
table.insert(lines , '! style="width:10%" | Valeur tertiaire<br />(texte titre)')
table.insert(lines , '! style="width:10%" | Icône<br />([[Projet:Infobox/Pictogramme|liste]])')
table.insert(lines , '! style="width:20%" | rendu titre')
table.insert(lines , '! style="width:20%" | rendu sous-titre')
table.sort(occupationformats, function (left, right)
return string.lower(left[2][1] or ''):gsub('é','e') < string.lower(right[2][1] or ''):gsub('é','e')
end)
table.insert(occupationformats, 1, {nil, nil, nil, nil, nil, nil})
for i, j in pairs(occupationformats) do
local wdsource = j[1] or {"Q"}
if type(wdsource) == 'string' then wdsource = {wdsource} end
local wd = table.concat(wdsource, ", ")
local chartesource = j[2] or {"par défaut"}
if type(chartesource) == 'string' then chartesource = {chartesource} end
local charte = table.concat(chartesource or {}, ", ")
local couleur1 = j[3] or '#CCCCAA'
local couleur2 = j[4] or '#D1CFAD'
local couleur3 = j[5] or '#000000'
local icone = j[6] or ''
local pict = ''
if icone ~= '' and icone ~= 'defaut' then
pict = mw.getCurrentFrame():extensionTag('templatestyles', '', {src = 'Infobox/Pictogramme/' .. mw.text.trim(icone) .. '.css'})
end
table.insert(lines , '|-')
table.insert(lines , '! style="text-align:left;" | ' .. charte)
table.insert(lines , '| style="text-align:center;" | ' .. wd)
table.insert(lines , '| style="text-align:center;" | ' .. couleur1)
table.insert(lines , '| style="text-align:center;" | ' .. couleur2)
table.insert(lines , '| style="text-align:center;" | ' .. couleur3)
table.insert(lines , '| style="text-align:center;" | ' .. icone)
table.insert(lines , '| class="entete ' .. icone .. '" style="background-color:' .. couleur1 .. '; height:45px; text-align:center; font-size:150%; font-weight:bolder; color:' .. couleur3 .. ';" | titre ' .. pict)
table.insert(lines , '| style="background-color:' .. couleur2 .. '; height:45px; text-align:center; font-size:150%; font-weight:bolder; color:#000000;" | sous-titre')
end
table.insert(lines , '|}')
return table.concat(lines, "\n" )
end
--catégorisation par charte utilisée (qu'elle soit déclarée manuellement ou déduite de Wikidata)
local chartcatlabel = (personformat[2] or {})[1] or "par défaut"
chartcatlabel = "Article utilisant l'infobox Biographie2 avec la charte " .. chartcatlabel
local categories
if not mw.title.makeTitle('Catégorie', chartcatlabel ).exists then chartcatlabel = "Article utilisant l'infobox Biographie2 avec une charte sans catégorie" end
return {
maincolor = personformat[3],
secondcolor = personformat[4],
thirdcolor = personformat[5],
categories = {chartcatlabel},
documentation = documentation,
parts = {
person.title(personformat[6]),
person.mainimage(),
person.officialposition(),
person.specialrole(),
person.nobilitytitle(),
{type = 'table',title='Biographie',rows = {
person.birth(),
person.death(),
person.placeofburial(),
person.othernames(),
{type = 'row', label = 'Époque', value = 'époque', wikidata = {property = 'P2348'}},
person.nationality(),
{type = 'row', label = 'Allégeance', plurallabel = 'Allégeances', value = 'allégeance', wikidata = {property = 'P945'}},
person.places(),
person.education(),
person.occupation(),
person.floruit(),
person.writinglanguage(),
person.haswrittenfor(),
{
type = 'row',
label = 'Appartenance ethno-culturelle',
plurallabel = 'Appartenances ethno-culturelles',
value= 'ethnicité',
wikidata = {
-- ethnicité veut dire appartenance à une ethnie d'après [[Ethnie]]
-- essai de expl=true qui est normalement fait pour données mises à jour
-- mais à utilité dans chaque article difficile à décider automatiquement
property = 'P172',
expl = true,
-- désactivé si la valeur est une instance de race humaine (Q3254959)
condition = function(claim)
local v = wd.getMainId(claim)
return (not wd.isInstance('Q3254959', v, 2))
end
}
},
person.family(),
person.gens(),
person.slavery(),
}},
{type = 'table',title='Autres informations',rows = {
{type = 'row', label = 'Événement clé', plurallabel = 'Événements clés', value = 'événement', wikidata = {property = 'P793' , expl = true , showdate = true}},
{type = 'row', label = 'Organisation', plurallabel = 'Organisations', value = 'organisation', wikidata = {property = 'P1268', showdate = true}},
person.employer(),
{type = 'row', label = 'Chaire', plurallabel = 'Chaires', value = 'chaire', wikidata = {property = 'P803'}},
{type = 'row', label = 'Domaine', plurallabel = 'Domaines', value = 'domaine'}, --l'appel à P101 doublonne généralement l'Activité
{type = 'row', label = 'Propriétaire de', value = 'propriétaire de', wikidata = {property = 'P1830', showdate = true, sorttype= 'chronological'}},
person.religion(),
person.politicalparty(),
{type = 'row', label = 'Idéologie', value = 'idéologie', wikidata = {property = 'P1142'}},
person.memberof(),
{
type = 'row',
label = '[[Huit Bannières|Bannière]]',
plurallabel = '[[Huit Bannières|Bannières]]',
value = "bannière d'appartenance",
wikidata = {
property = 'P470',
labelformat = function(id)
local label = wd.getLabel(id)
if label then
return mw.ustring.gsub(label, '[Bb]annière ', '')
end
end
}
},
person.military(),
person.movement(),
person.appearance(),
person.sport(),
{type = 'row', label = 'Grade', plurallabel = 'Grades', value= {'grade dan/kyu','grade'}, wikidata = {property = 'P468', numval = '1', sorttype = 'inverted', showdate = true, precision = 'year', removedupes = true}},
--{type = 'row',label = 'Commandement',plurallabel = 'Commandements',wikidata = {property = 'P598', sorttype= 'chronological', showdate = true, precision = 'year'},}, --propriété obsolète sur Wikidata
--{type = 'row', label = 'A participé à', value = 'participant à', property = 'P1344'}, --risque de générer de longue listes sans grande pertinence
person.torero(),
person.music(),
person.contacts(),
{type = 'row', label = 'Monture', plurallabel= 'Montures', value= 'monture', wikidata = {property = 'P3091', showdate = true}},
{type = 'row', label = 'Genre artistique', plurallabel= 'Genres artistiques', value= {'genre artistique','genre'}, wikidata = {property = 'P136'}},
person.influencedby(),
person.victims(),
person.penalties(),
{type = 'row', label = 'Adjectifs dérivés', value = 'adjectifs dérivés'},
person.website(),
{type = 'row', label = 'Blog officiel', value = 'blog officiel', wikidata={property = 'P1581' , conjtype = 'new line', showlang = true }},
person.awards(),
person.filmography(),
person.discography(),
{type = 'row', label = 'Abréviation en botanique', plurallabel = 'Abréviations en botanique', value = 'abréviation en botanique', wikidata={property = 'P428'}},
{type = 'row', label = 'Abréviation en zoologie', plurallabel = 'Abréviations en zoologie', value = 'abréviation en zoologie', wikidata={property = 'P835'}},
person.feast(),
}},
person.honorifictitle(),
person.voice(),
person.prononciation(),
person.blason(),
person.sceau(),
person.monogram(),
person.flag(),
person.logo(),
person.works{title = localdata['intitulé œuvres'] or localdata['intitulé oeuvres']},
person.signature(),
person.plaque(),
person.tombe(),
}
}
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.