Module:Infobox/Biographie
Apparence
[voir] [modifier] [historique] [purger]
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', '', '#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
if l[1] == j then
return l --retourne une ligne de la table occupationformats, correspondant à l'une des occupations du sujet
end
end
end
return {'Q', {''}, '#EEEEFF', '#F6F6FF', '#000000', 'defaut'}
end
local function setcharte()
local charte = localdata['charte']
if charte then
for i, j in pairs(occupationformats) do
knownchartes = j[2]
for k,l in pairs(knownchartes) do
if l == charte then
return j
end
end
end
end
return setformat()
end
local personformat = setcharte()
local function formatreligion (entity) -- pour éviter d'afficher '-' quand le paramètre religion vaut 'no value'
if localdata["religion"] or wd.formatStatements{entity = entity, property = 'P140'} ~= '-' then
return person.religion()
end
end
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)
local chartesleft = left[2]
local chartesright = right[2]
return string.lower(chartesleft[1] or ''):gsub('é','e') < string.lower(chartesright[1] or ''):gsub('é','e')
end)
table.insert(occupationformats, 1, {nil, nil, nil, nil, nil, nil})
for i,j in pairs(occupationformats) do
local wd = j[1] or ''
local chartes = j[2] or {'par défaut'}
local charte = chartes[1] or ''
--for k,l in pairs(chartes) do
-- if(k > 1) then charte = charte .. '<br>' end
-- charte = charte .. l
--end tentative d'afficher aussi les alias
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
return {
maincolor = personformat[3],
secondcolor = personformat[4],
thirdcolor = personformat[5],
documentation = documentation,
parts = {
person.title(personformat[6]),
person.mainimage(),
person.officialposition(),
person.nobilitytitle(),
{type = 'table',title='Biographie',rows = {
person.birth(),
person.death(),
person.placeofburial(),
person.othernames(),
{type = 'row', label = 'Époque', value = 'époque', property = 'P2348'},
person.nationality(),
{type = 'row', label = 'Allégeance', plurallabel = 'Allégeances', value = 'allégeance', 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 = 'Organisation', plurallabel = 'Organisations', value = 'organisation', property = 'P1268'},
person.employer(),
{type = 'row', label = 'Chaire', plurallabel = 'Chaires', value = 'chaire', 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'}},
formatreligion(localdata["wikidata"]),
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', 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', property = 'P3091'},
{type = 'row', label = 'Genre artistique', plurallabel= 'Genres artistiques', value= 'genre artistique', 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(),
person.archivesat(),
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(),
}
}