Module:Infobox/Fonctions/Personne : Différence entre versions

De Lagny-sur-Marne Wiki
Aller à : navigation, rechercher
m (Révocation des modifications de Hercule (retour à la dernière version de Simon Villeneuve))
 
(270 révisions intermédiaires par 15 utilisateurs non affichées)
Ligne 1 : Ligne 1 :
 
-- Functions utilisées par les infobox personnes
 
-- Functions utilisées par les infobox personnes
 
local p = {}
 
local p = {}
local wikidata = require "Module:Interface Wikidata".fromLua
+
local localdata = require( 'Module:Infobox/Localdata' )
 +
local item = localdata.item
 +
local wikidata = require( "Module:Interface Wikidata" ).fromLua
 
local general = require "Module:Infobox/Fonctions"
 
local general = require "Module:Infobox/Fonctions"
 
local datemodule = require "Module:Date"
 
local datemodule = require "Module:Date"
 +
local complexdate = require "Module:Date complexe"
 
local linguistic = require "Module:Linguistique"
 
local linguistic = require "Module:Linguistique"
 +
local militaryranks = require "Module:Dictionnaire Wikidata/Grades militaires"
  
-- libellés spéciaux lorsque ceux de Wikconidata ne conviennent pas
+
--=== Accord en genre
local occupations = require "Module:Dictionnaire Wikidata/Métiers"
 
  
local function setgender() -- établit la valeur de la variable "gender" qui sert à adapter la grammaire au sexe de la personne
+
-- établit la variable gender pour l'élément
 +
local function getgender(id)
 
local vals = {
 
local vals = {
 
['Q6581072'] = 'f',
 
['Q6581072'] = 'f',
Ligne 15 : Ligne 19 :
 
default      = '?'
 
default      = '?'
 
}
 
}
local gender = wikidata.formatStatements{entity = item, property = 'P21', displayformat = 'raw'}
+
local gender = wikidata.formatStatements{entity = id, property = 'P21', displayformat = 'raw'}
 
return vals[gender] or vals.default
 
return vals[gender] or vals.default
 
end
 
end
local gender = gender or setgender()
 
  
local function setgenderedlabels()
+
local gender = getgender(item)
if gender == 'f' then
+
 
return occupations.female
+
-- récupération des libellés spéciaux codés en dur sur Wikipédia (attention : contient à la fois le libellé et le lien)
elseif gender == 'm' then
+
local occupationlabels = require "Module:Dictionnaire Wikidata/Métiers"[gender]
return occupations.male
+
 
 +
-- récupération des libellés genrés de Wikidata
 +
local function genderedlabel(id, labelgender)
 +
local label
 +
if not labelgender then
 +
labelgender = gender -- si le genre n'est pas indiqué, c'est celui de la personne dont c'est l'infobox
 +
end
 +
if labelgender == 'f' then -- femme : chercher le libellé dans P2521 (libellé féminin)
 +
label = wikidata.formatStatements{entity = id, property = 'P2521', isinlang = 'fr', numval = 1, ucfirst = '-'}
 +
elseif labelgender == 'm' then -- homme : chercher le libellé dans P3321 (libellé masculin)
 +
label = wikidata.formatStatements{entity = id, property = 'P3321', isinlang = 'fr', numval = 1, ucfirst = '-'}
 
end
 
end
end
+
if not label then
local genderedlabels = genderedlabels or setgenderedlabels()
+
label = wikidata.getLabel(id)
 +
end
 +
return label
 +
end
  
 +
-- === Gestion des dates
 +
 +
-- Liens thématiques vers les dates
 
local datelinks = { -- lien vers le domaine d'activité approprié
 
local datelinks = { -- lien vers le domaine d'activité approprié
 
Q483501 = 'en arts plastiques', -- artiste
 
Q483501 = 'en arts plastiques', -- artiste
Ligne 35 : Ligne 54 :
 
Q2309784 = 'en cyclisme', -- cycliste
 
Q2309784 = 'en cyclisme', -- cycliste
 
Q16947657 = 'en arts plastiques', -- lithographe
 
Q16947657 = 'en arts plastiques', -- lithographe
 +
Q11569986 = 'en arts plastiques', -- graveur
 +
Q13365770 = 'en arts plastiques', -- graveur sur cuivre
 +
Q21925567 = 'en arts plastiques', -- sérigraphe
 +
Q10862983 = 'en arts plastiques', -- aquafortiste
 
}
 
}
  
-- ========== Fonctions d'aide ====================================
 
 
local function getdatetopic() -- obtient le lien le plus approprié pour une date en fonction de la profession
 
local function getdatetopic() -- obtient le lien le plus approprié pour une date en fonction de la profession
local claims = wikidata.getClaims{entity = item, property = 'P106', excludespecial = true}
+
local claims = wikidata.stringTable{entity = item, property = 'P106', excludespecial = true, displayformat = "raw"}
 
if not claims then
 
if not claims then
 
return nil
 
return nil
 
end
 
end
 
for i, j in pairs(claims) do
 
for i, j in pairs(claims) do
local v = wikidata.getmainid(j)
+
if datelinks[j] then
if datelinks[v] then
+
return datelinks[j]
return datelinks[v]
 
 
end
 
end
 
end
 
end
Ligne 53 : Ligne 74 :
 
local linktopic = getdatetopic()
 
local linktopic = getdatetopic()
  
local function timeline(statements, prop) -- affiche date : événement (suppose les événements déjà triés)
+
--=====
if not statements then
+
local function wikidatadate(prop, args) -- fonction à vocation généraliste, à externaliser
 +
if not args then
 +
args = {}
 +
end
 +
args.linktopic = args.linktopic or linktopic
 +
return wikidata.wikidataDate(prop, item, args)
 +
end
 +
local unknowndatelabel = "date inconnue"
 +
local birthdate = localdata['naissance'] or localdata['date de naissance'] or wikidatadate('P569', {unknownlabel = unknowndatelabel})
 +
local deathdate = localdata['décès'] or localdata['date de décès'] or wikidatadate('P570', {unknownlabel =unknowndatelabel })
 +
 
 +
 
 +
local function format1(event, period, predecessor, successor, displayformat)
 +
local mainstr = event
 +
if predecessor then
 +
local s = 'précédé par ' .. predecessor
 +
if gender == 'f' then
 +
s = 'précédée par ' .. predecessor
 +
end
 +
mainstr = mainstr .. '<small><br />&nbsp;' .. s .. '</small>'
 +
end
 +
if successor then
 +
local s = 'suivi par ' .. successor
 +
if gender == 'f' then
 +
s = 'suivie par ' .. successor
 +
end
 +
mainstr = mainstr .. '<small><br />&nbsp;' .. s .. '</small>'
 +
end
 +
return {type = 'row', label = period or '', value = function() return mainstr end}
 +
end
 +
 
 +
-----------------
 +
 
 +
local function format2(event, period, predecessor, successor, displayformat)
 +
if (not event) then
 
return nil
 
return nil
 
end
 
end
 +
 
local rows = {}
 
local rows = {}
  
local speciallabels = genderedlabels
+
local eventrow = {type = 'row1col', color = 'secondcolor', value = event }
local dateformat = {precision = 'year', linktopic = '-'}
+
table.insert(rows, eventrow)
-- qualificatifs à afficher "de", circonscription, diocèse, assemblée délibérante, parti, employeur
+
 
local qualifs = {'P642', 'P768', 'P708', 'P194', 'P102', 'P108'}
+
if period then
 +
period = '<span style="font-weight:normal">' .. period .. '</span>'
 +
local periodrow = {type = 'row1col', color = '#F9F9F9', value = period }
 +
table.insert(rows, periodrow)
 +
end
 +
 
 +
if predecessor then
 +
local prederow = {type = 'row', label = 'Prédécesseur', value = function() return predecessor end}
 +
table.insert(rows, prederow)
 +
end
 +
 
 +
if successor then
 +
local succrow = {type = 'row', label = 'Successeur', value = function() return successor end}
 +
table.insert(rows, succrow)
 +
end
 +
return {type = 'multi', rows = rows}
 +
end
 +
 
 +
 
 +
local function format3(event, period, predecessor, successor, displayformat, details)
 +
if details then
 +
details = '<span style="font-weight:normal">' .. details .. '</span>'
 +
event = linguistic.conj({event, details}, "new line")
 +
end
 +
local mainrow =  {type = 'row1col', color = 'secondcolor', value = event }
 +
if period then
 +
period = '<span style="font-weight:normal">' .. period .. '</span>'
 +
end
 +
local periodrow = {type = 'row1col', color = '#F9F9F9', value = period }
 +
local successionrow = {
 +
style = {['background-color'] = '#E1E1E1', ['padding-bottom'] = '2%'},
 +
type = 'navbox',
 +
inner = true,
 +
previousval = function() return predecessor end,
 +
nextval = function() return successor end,
 +
}
 +
 
 +
return {type = 'multi', rows = {mainrow, periodrow, successionrow}}
 +
end
 +
 
  
 +
local function timeline(localparam, wdconf, timelineformat, title, singtitle, details) -- affiche date : événement (suppose les événements déjà triés)
 +
local rows = {}
 +
local function returnTable()
 +
return {
 +
type = "table",
 +
title = title,
 +
rows = rows
 +
}
 +
end
 +
 +
-- avec données locales
 +
local val = localdata[localparam]
 +
if val == '-' then
 +
return nil
 +
elseif val then
 +
table.insert(rows, {type = 'row1col', color = 'secondcolor', value = val})
 +
return returnTable()
 +
end
 +
-- avec données wikidata
 +
if not wdconf then
 +
return nil
 +
end
 +
 +
wdconf.entity = wdconf.entity or item
 +
wdconf.sorttype = wdconf.sorttype or "chronological"
 +
wdconf.labelformat = wdconf.labelformat  or function(id) return genderedlabel(id) end
 +
wdconf.linktopic = wdconf.linktopic or "-"
 +
wdconf.stilltrue = not(deathdate) -- si la personne est vivante, on emploie "depuis" plutôt que "à partir de" (mais lorsque c'est fini mais que la date de fin manque, ça devient faux)
  
 +
local statements = wikidata.getClaims(wdconf)
 +
if not statements then
 +
return nil
 +
end
 +
if #statements == 1 then
 +
title = singtitle
 +
end
 +
local displayformats = {
 +
A = format1,
 +
B = format2,
 +
C = format3,
 +
}
 +
local applyformat = displayformats[timelineformat] or displayformats['A']
 +
 +
rows = {}
 
for i, statement in pairs(statements) do
 
for i, statement in pairs(statements) do
local mainstr = wikidata.formatStatement(statement, {speciallabels = speciallabels, showqualifiers = qualifs})
+
local event = linguistic.ucfirst(wikidata.formatStatement(statement, wdconf))
local period = wikidata.statementDate(statement, dateformat )
 
 
-- rétrolien à activer si on veut inciter les gens à aller sur Wikidata
 
--if (not period) and item then
 
-- period = '[[:d:' .. item.id .. '#' .. (prop or '') .. '|<i>date à ajouter</i>]
 
--end
 
 
 
-- prédecesseur et successeur
 
 
local predecessor = wikidata.getFormattedQualifiers(statement, {'P155', 'P1365'})
 
local predecessor = wikidata.getFormattedQualifiers(statement, {'P155', 'P1365'})
 
local successor = wikidata.getFormattedQualifiers(statement, {'P156', 'P1366'})
 
local successor = wikidata.getFormattedQualifiers(statement, {'P156', 'P1366'})
if predecessor then
+
local period = wikidata.statementDate(statement, wdconf )
local s = 'précédé par ' .. predecessor
+
local detailstr
if gender == 'f' then
+
if type(details) == "function" then
s = 'précédée par ' .. predecessor
+
detailstr = details(statement)
end
 
mainstr = mainstr .. '<small><br />&nbsp;' .. s .. '</small>'
 
 
end
 
end
if successor then
+
local row = applyformat(event, period, predecessor, successor, wdconf, detailstr)
local s = 'suivi par ' .. successor
+
if row then
if gender == 'f' then
+
table.insert(rows, row)
s = 'suivie par ' .. successor
 
end
 
mainstr = mainstr .. '<small><br />&nbsp;' .. s .. '</small>'
 
 
end
 
end
 
-- à la dernière ligne : ajout rétrolien et catégorie de maintenance
 
 
if (i == #statements) and prop then
 
mainstr = wikidata.formatAndCat{value = mainstr, property = prop, entity = entity}
 
end
 
 
local row = {type = 'row', label = period or '', value = function() return mainstr end}
 
table.insert(rows, row)
 
 
end
 
end
-- ajout de rétrolien, cat
+
table.insert(rows, {type = "external text", value = function() return wikidata.addtrackingcat(wdconf.property) end})
return rows
+
return returnTable()
 
end
 
end
 +
  
 
local function dateandplace(thedate, theplace)
 
local function dateandplace(thedate, theplace)
if thedate and theplace then
+
if thedate and theplace and mw.ustring.find(thedate, "inconnu") and mw.ustring.find(theplace, "inconnu") then
return thedate .. '<br />' .. theplace
+
theplace = nil
else
+
thedate =  mw.ustring.gsub(thedate, unknowndatelabel, "Date et lieu inconnus")
return thedate or theplace --retourne tout ce qu'il trouve
 
 
end
 
end
 +
return linguistic.conj({thedate, theplace}, "new line")
 
end
 
end
  
Ligne 122 : Ligne 239 :
 
function p.mainimage()
 
function p.mainimage()
 
 
-- demande d'illustration que si la personne est née après 1900, sinon c'est souvent impossible à trouver
+
-- demande d'illustration que si la personne est née ou morte après 1900, sinon c'est souvent impossible à trouver
 
local defaultimage = 'Defaut 2.svg'
 
local defaultimage = 'Defaut 2.svg'
local age = wikidata.stringTable{property = 'P569', entity = item, displayformat = 'raw', excludespecial = true}
+
local age = wikidata.stringTable{property = 'P569,P570', entity = item, displayformat = 'raw', excludespecial = true}
  
 
if age then
 
if age then
Ligne 138 : Ligne 255 :
 
-- Noms
 
-- Noms
 
function p.othernames()
 
function p.othernames()
+
 
-- si "autres noms" existe, le renvoie, sinon, fait plusieurs lignes en utilisant diverses propriétés ed Wikidata
 
if localdata['autres noms'] or localdata['nom de naissance'] then
 
return {type = 'multi', rows = {
 
{type = 'row', label = 'Autres noms', value = 'autres noms'},
 
{type = 'row', label ='Nom de naissance', value = 'nom de naissance'},
 
}
 
}
 
end
 
 
local names = {
 
local names = {
 
{'P1477', 'Nom de naissance', 'Noms de naissance', 'nom de naissance'},
 
{'P1477', 'Nom de naissance', 'Noms de naissance', 'nom de naissance'},
 
{'P1449', 'Surnom', 'Surnoms', 'surnom'},
 
{'P1449', 'Surnom', 'Surnoms', 'surnom'},
{'P742', 'Pseudonyme', 'Pseudonymes', 'pseudonyme',},
+
{'P2001', 'Romanisation révisée', 'Romanisation révisée', 'nom de pinceau'},
 +
{'P1942', 'McCune-Reischauer', 'McCune-Reischauer', 'nom de pinceau'},
 +
{'P742', 'Pseudonyme', 'Pseudonymes', 'pseudonyme'},
 
{'P1782', 'Prénom social', 'Prénoms sociaux', 'prénom social'},
 
{'P1782', 'Prénom social', 'Prénoms sociaux', 'prénom social'},
 
{'P1786', 'Nom posthume', 'Noms posthumes', 'nom posthume'},
 
{'P1786', 'Nom posthume', 'Noms posthumes', 'nom posthume'},
 
{'P1785', 'Nom de temple', 'Noms de temple', 'nom de temple'},
 
{'P1785', 'Nom de temple', 'Noms de temple', 'nom de temple'},
 
{'P1787', 'Nom de pinceau', 'Noms de pinceau', 'nom de pinceau'},
 
{'P1787', 'Nom de pinceau', 'Noms de pinceau', 'nom de pinceau'},
 +
{'P428', 'Abréviation en botanique', 'Abréviations en botanique', 'abréviation en botanique'},
 +
{'P835', 'Abréviation', 'Abréviations', 'abréviation'},
 +
{nil, 'Autres noms', 'Autres noms', 'autres noms'},
 
}
 
}
  
local rows = {type = 'multi', rows = {}}
+
local birthnamerow = { -- un peu particulier, donc à part
 +
type = "row",
 +
wikidata  = function()
 +
local s = wikidata.formatAndCat{entity = item, property = "P1559"}
 +
if (not s) then
 +
return nil
 +
end
 +
-- regarde si le nom de la valeur ressemble au libellé (en tenant compte de la pollution des marqueures de langue
 +
local label = mw.ustring.lower(wikidata.getLabel(item) or "")
 +
local useless
 +
if mw.ustring.find(mw.ustring.lower(s), mw.ustring.lower(label), 0, true) then
 +
useless = true
 +
end
 +
if useless then
 +
return nil
 +
end
 +
return s
 +
end,
 +
label = 'Nom dans la langue maternelle',
 +
plurallabel = 'Noms dans la langue maternelle',
 +
value = 'nom dans la langue maternelle',
 +
}
 +
 +
local rows = {type = "multi", rows = {birthnamerow}}
 
for i, j in pairs(names) do
 
for i, j in pairs(names) do
local query = {property = j[1], showqualifiers = {'P1721'}, conjtype = ',<br />'}
+
local query
 +
if j[1] and not localdata['autres noms'] then -- lorsqu'il y a un paramètre "autres noms", Wikidata est désactivée pour éviter risques de doublon
 +
query = {property = j[1], showqualifiers = {'P1721'}, conjtype = 'new line'}
 +
end
 
table.insert(rows.rows, {type = 'row', value = j[4], wikidata = query, label = j[2], plurallabel = j[3]})
 
table.insert(rows.rows, {type = 'row', value = j[4], wikidata = query, label = j[2], plurallabel = j[3]})
 
end
 
end
Ligne 166 : Ligne 306 :
  
 
-- NAISSANCE ET MORT
 
-- NAISSANCE ET MORT
local function wikidatadate(prop)
 
-- fonction à vocation généraliste, à externaliser
 
local vals = wikidata.getClaims{entity = item, property = prop, excludespecial = true}
 
if not vals then
 
return nil
 
end
 
local newvals = {}
 
for i, val in pairs(vals) do
 
local v = wikidata.statementDate(val, {linktopic = linktopic}) -- essaye les qualifs date de début/fin pour une date plus précise (en attendant un bon fonctionnement du "before/after" intégré)
 
if not v then
 
if val.mainsnak.snaktype ~= 'value' then
 
v = wikidata.formatStatement(val, {linktopic = linktopic})
 
elseif val.mainsnak.datavalue.value.precision > 7 then
 
v = wikidata.formatStatement(val, {linktopic = linktopic})
 
end
 
end
 
if val.qualifiers and val.qualifiers.P1480 then
 
local q = wikidata.getid( val.qualifiers.P1480[1])
 
if q == 'Q5727902' then
 
v = 'vers ' .. v
 
end
 
end
 
if v then
 
table.insert(newvals, v)
 
end
 
end
 
local str = linguistic.conj(newvals, 'or')
 
if str then
 
return wikidata.formatAndCat{entity = item, property = prop, value = str}
 
end
 
end
 
 
local birthdate = localdata['naissance'] or localdata['date de naissance'] or wikidatadate('P569') or ''
 
local deathdate = localdata['décès'] or localdata['date de décès'] or wikidatadate('P570') or ''
 
 
 
 
function p.birth() -- date de naissance en première ligne, lieu de naissance en deuxième
 
function p.birth() -- date de naissance en première ligne, lieu de naissance en deuxième
 
return {
 
return {
Ligne 208 : Ligne 312 :
 
value =
 
value =
 
function()
 
function()
local thedate = datemodule.dateInfobox{args = {[1] = 'naissance', [2] = birthdate, [3] = deathdate, qualificatif = linktopic}}
+
local thedate = datemodule.dateInfobox{args = {[1] = 'naissance', [2] = birthdate or '', [3] = deathdate or '', qualificatif = linktopic}}
local theplace = localdata['lieu de naissance'] or wikidata.formatAndCat({entity =item, property= 'P19', rank = 'best', conjtype= ' ou '})
+
local theplace = localdata['lieu de naissance'] or wikidata.formatAndCat({entity =item, property= 'P19', rank = 'best', conjtype= ' ou ', unknownlabel = "lieu inconnu"})
 
return dateandplace(thedate, theplace)
 
return dateandplace(thedate, theplace)
 
end
 
end
Ligne 216 : Ligne 320 :
  
 
function p.death() -- même fonctionnement que la fonction p.birth
 
function p.death() -- même fonctionnement que la fonction p.birth
 +
 +
local label = "Décès"
 +
 +
local val
 +
local thedate, theplace
 +
local disparitiondate, deathdate
 +
 +
-- date
 +
--- récup données locales
 +
disparitiondate = localdata["disparition"]
 +
deathdate = localdata['décès'] or localdata['date de décès']
 +
 +
--- récup Wikidata
 +
if not (disparitiondate or deathdate) then
 +
disparitiondate =  wikidata.formatAndCat{entity = item, property = "P746", rank = 'best', conjtype= ' ou '}
 +
if not disparitiondate then
 +
deathdate =  wikidatadate('P570', {unknownlabel = unknowndatelabel })
 +
end
 +
end
 +
 +
--- mise en forme
 +
thedate = datemodule.dateInfobox{args = {[1] = 'mort', [2] = birthdate or '', [3] = deathdate or disparitiondate or '', qualificatif = linktopic, unknownlabel = "date inconnue"}}
 +
 +
-- lieu
 +
theplace = localdata["lieu de décès"] or wikidata.formatAndCat{entity = item, property= 'P20', rank = 'best', conjtype= ' ou ', unknownlabel = "lieu inconnu"}
 +
 +
 +
-- Adaptations si on a la date de disparition à la place de la date de décès
 +
if disparitiondate then
 +
if theplace then -- cas un peu bizarre et pas très logique, ne vaut pas trop la peine d'un affichage plus élaboré
 +
disparitiondate = "Date de disparition : " .. thedate
 +
theplace = "Lieu de décès : " .. theplace
 +
else
 +
label = "Disparition"
 +
end
 +
end
 +
 +
 +
val = dateandplace(thedate, theplace)
 +
 
return {
 
return {
 
type = 'row',
 
type = 'row',
label = 'Décès',
+
label = label,
value =  
+
value = function() return val end,
function()
 
local thedate = datemodule.dateInfobox{args = {[1] = 'décès', [3] = birthdate, [2] = deathdate, qualificatif = linktopic}}
 
local theplace = localdata['lieu de décès'] or wikidata.formatAndCat({entity = item, property= 'P20', rank = 'best', conjtype= ' ou '})
 
return dateandplace(thedate, theplace)
 
end
 
 
}
 
}
 
end
 
end
Ligne 233 : Ligne 372 :
 
label = 'Période d’activité',
 
label = 'Période d’activité',
 
value = "Période d'activité",
 
value = "Période d'activité",
wikidata = function() return wikidatadate('P1317') end
+
wikidata = function()  
 +
local startDate = wikidata.formatStatements{entity = item, property = "P2031", conjtype = "or", sorttype = "chronological"}
 +
local endDate = wikidata.formatStatements{entity = item, property = "P2032", conjtype = "or", sorttype = "chronological"}
 +
if not (startDate or endDate) then
 +
return wikidatadate('P1317')
 +
end
 +
return complexdate.daterange(startDate, endDate, {precision = 11})
 +
end
 
}
 
}
 +
end
 +
 +
function p.placeofburial()
 +
return
 +
{type = 'row', label = "Sépulture", value = "sépulture", property = 'P119'}
 
end
 
end
  
 
function p.nationality()  
 
function p.nationality()  
 
 
-- à améliorer pour tenir compte des dates tout en évitant les doublons pour ceux qui ont Empire allemand + République de Weimar
+
-- à améliorer étant donnée les moeurs Wikidata comme nationalité : Empire allemand (1901-1918)  République de Weimar (1918-1933)
 
 
local function wdDate()
 
local function wdDate()
 
local nation = require "Module:Country data".nationality
 
local nation = require "Module:Country data".nationality
local statements = wikidata.getClaims{entity = item, property = 'P27'}
+
if not statements then
+
-- désactivation si date de naissance avant l'Ère contemporaine : trop d'imprécisions et d'anachronismes
 +
local mindate = '1789'
 +
 +
local birthdate = wikidata.formatStatements{entity = item, property = 'P569', displayformat = 'raw', numval = 1}
 +
if (not birthdate) or complexdate.before(mindate, birthdate) then
 
return nil
 
return nil
 
end
 
end
return wikidata.formatAndCat{
+
 +
return {
 
property = 'P27',
 
property = 'P27',
vals = statements,
+
-- vals = statements, -- statments est une variable non déclarée dans ce module
 
showdate = true,
 
showdate = true,
 
entity = item,
 
entity = item,
Ligne 257 : Ligne 412 :
 
displayformat =  
 
displayformat =  
 
function(snak)
 
function(snak)
local val, success = nation(wikidata.getid(snak), 'f')
+
local g = gender -- genre de la personne, pour affichage du gentilé
 +
if g == '?' then -- si inconnu, au masculin
 +
g = 'm'
 +
end
 +
local val, success = nation(wikidata.getid(snak), g)
 
if not success then
 
if not success then
 
val = wikidata.formatSnak(snak)
 
val = wikidata.formatSnak(snak)
Ligne 263 : Ligne 422 :
 
return val
 
return val
 
end
 
end
}, #statements
+
}
 
end
 
end
 
 
Ligne 271 : Ligne 430 :
 
plurallabel = 'Nationalités',
 
plurallabel = 'Nationalités',
 
value = 'nationalité',
 
value = 'nationalité',
wikidata = function() return wdDate() end
+
wikidata = wdDate() -- wdDate() retourne une table
 
}
 
}
  
 +
end
 +
function p.nativelanguage()
 +
return
 +
{type = 'row', label = 'Langue maternelle', value = 'langue maternelle', property = 'P103'}
 +
end
 +
 +
-- Domiciles
 +
function p.places()
 +
return {type = 'multi', rows = {
 +
{
 +
type = 'row',
 +
label = 'Dème',
 +
plurallabel = 'Dèmes',
 +
value = 'dème',
 +
wikidata = {property = 'P2462', showdate = true, sorttype= 'chronological', precision = 'year'},
 +
},
 +
{
 +
type = 'row',
 +
label = 'Domicile',
 +
plurallabel = 'Domiciles',
 +
value = 'domicile',
 +
wikidata = {property = 'P551', showdate = true, sorttype= 'chronological', precision = 'year'},
 +
},
 +
{
 +
type = 'row',
 +
label = 'Lieu de travail',
 +
plurallabel = 'Lieux de travail',
 +
value = 'lieu de travail',
 +
wikidata = {property = 'P937', sorttype= 'chronological', showdate = true, precision = 'year'},
 +
},
 +
}}
 
end
 
end
  
 
-- parcours professionel
 
-- parcours professionel
 
function p.education() -- à améliorer
 
function p.education() -- à améliorer
local query = {sorttype= 'chronological', property = 'P69', showdate = true, showqualifiers = 'P512', conjtype = '<br />'}
+
local query = {sorttype= 'chronological', property = 'P69', showdate = true, showqualifiers = 'P512', conjtype = 'new line', linktopic = '-'}
 
return {
 
return {
 
type = 'row',
 
type = 'row',
Ligne 290 : Ligne 480 :
 
return {
 
return {
 
type = 'row',  
 
type = 'row',  
value = 'activité',
+
value = {'activité', 'activités'},
wikidata = {property = 'P106', showdate = true, conjtype = 'comma', speciallabels = genderedlabels, defaultlink = '-'},  
+
wikidata = {
 +
property = 'P106',
 +
defaultlink = '-',
 +
defaultlinkquery = {property = 'P425'},
 +
labelformat = function(id) return genderedlabel(id) end,
 +
speciallabels = occupationlabels,
 +
excludevalues = { -- les occupations qui ne méritent pas d'être affichées
 +
'Q482980', -- auteur
 +
--'Q15980158', "auteur de non-fiction" a depuis été traduit par "essayiste"
 +
'Q18814623', -- autobiographe
 +
'Q948329', -- acteur de genre
 +
'Q1209498', -- juriste-poète
 +
}
 +
},
 
label = 'Activité',
 
label = 'Activité',
 
plurallabel = 'Activités'
 
plurallabel = 'Activités'
Ligne 301 : Ligne 504 :
 
type = 'row',  
 
type = 'row',  
 
value = 'employeur',
 
value = 'employeur',
wikidata = {property = 'P108', showdate = true},  
+
wikidata = {property = 'P108', showdate = true, sorttype= 'chronological'},  
 
label = function() return localdata['intitulé employeur'] or 'A travaillé pour' end,
 
label = function() return localdata['intitulé employeur'] or 'A travaillé pour' end,
 
}
 
}
 
end
 
end
  
function p.officialposition()
+
function p.victories()  
local title = 'Fonctions'
+
local title, singtitle = "Victoires", "Victoire"
local singtitle = 'Fonction'
+
local localparam = "victoire"
 +
local wdconf = {property = 'P2522'}
 +
local displayformat = "B"
 
 
local rows
+
return timeline(localparam, wdconf, displayformat, title, singtitle)
if localdata['fonction'] then
+
end
return {type = 'table', rows = {
+
 
{type = 'row',  label = title, value = 'fonction'}
+
 
}
+
function p.officialposition()
 +
local title, singtitle = "Fonctions", "Fonction"
 +
local localparam = "fonction"
 +
local wdconf =  {
 +
property = 'P39',
 +
rank = 'valid',
 +
sorttype = 'inverted',
 +
speciallabels = occupationlabels,
 +
defaultlinkquery =  {property = {'P2354', 'P2389', 'P453', 'P361', 'P108'}}, -- liens par défaut : liste, puise organisme dirigé, "membre de", "partie de", employeur
 +
}
 +
-- sur une ligne séparée : juridiction, "de", circonsription, diocèse, affiliation, assemblée, parti, emmloyeur
 +
local details = function(statement) return wikidata.getFormattedQualifiers(statement, {'P1001', 'P642', 'P768', 'P708', 'P1416', 'P194', 'P102', 'P108', 'P937'}) end
 +
local displayformat = "C"
 +
 +
return timeline(localparam, wdconf, displayformat, title, singtitle, details)
 +
end
 +
 
 +
function p.nobilitytitle()
 +
local title, singtitle = "Titres de noblesse", "Titre de noblesse"
 +
local localparam = "titre de noblesse"
 +
local wdconf = {
 +
property = 'P97',
 +
entity = item, rank = 'valid',
 +
showqualifiers =  {'P642'},
 +
defaultlinkquery =  {property = {'P2354', 'P361'}}, -- liens par défaut : liste, puise organisme dirigé, "membre de" et "partie de"
 +
}
 +
local displayformat = "B"
 +
 +
return timeline(localparam, wdconf, displayformat, title, singtitle)
 +
end
 +
 
 +
 
 +
function p.honorifictitle()
 +
local title, singtitle = "Titres honorifiques", "Titre honorifique"
 +
local localparam = "titre honorifique"
 +
local wdconf = {property = 'P511', entity = item, rank = 'valid'}
 +
local displayformat = "C"
 +
 +
return timeline(localparam, wdconf, displayformat, title, singtitle)
 +
end
 +
 
 +
function p.tombe()
 +
return {
 +
type = 'images',
 +
imageparameters =  {'tombe'},
 +
defaultimages = nil,
 +
defaultupright = 0.7,
 +
uprightparameter = 'upright tombe',
 +
sizeparameter = 'taille tombe', -- obsolète
 +
captionparameter = 'légende tombe',
 +
defaultcaption = 'sépulture',
 +
property = 'P1442',
 +
numval = 1,
 +
}
 +
end
 +
 
 +
function p.plaque()
 +
return {
 +
type = 'images',
 +
imageparameters =  {'plaque'},
 +
defaultimages = nil,
 +
defaultupright = 0.7,
 +
uprightparameter = 'upright plaque',
 +
sizeparameter = 'taille plaque', -- obsolète
 +
captionparameter = 'légende plaque',
 +
defaultcaption = 'plaque commémorative',
 +
property = 'P1801',
 +
numval = 1,
 +
}
 +
end
 +
 
 +
function p.blason()
 +
return {
 +
type = 'images',
 +
imageparameters =  {'blason'},
 +
defaultimages = nil,
 +
defaultupright = 0.7,
 +
uprightparameter = 'upright blason',
 +
sizeparameter = 'taille blason', -- obsolète
 +
captionparameter = 'légende blason',
 +
defaultcaption = 'blason',
 +
property = 'P94',
 +
numval = 1,
 +
}
 +
end
 +
 
 +
function p.sceau()
 +
return {
 +
type = 'images',
 +
imageparameters = {'sceau'},
 +
defaultimages = nil,
 +
defaultupright = 0.7,
 +
uprightparameter = 'upright sceau',
 +
sizeparameter = 'taille sceau', -- obsolète
 +
captionparameter = 'légende sceau',
 +
defaultcaption = 'sceau',
 +
property = 'P158',
 +
numval = 1,
 +
}
 +
end
 +
 
 +
function p.monogram()
 +
return {
 +
type = 'images',
 +
imageparameters = {'monogramme'},
 +
defaultimages = nil,
 +
defaultsize = '100px',
 +
sizeparameter = 'taille monogramme',
 +
captionparameter = 'légende monogramme',
 +
defaultcaption = 'Monogramme',
 +
property = 'P1543',
 +
numval = 1,
 +
}
 +
end
 +
 
 +
function p.flag()
 +
return {
 +
type = 'images',
 +
imageparameters =  {'drapeau'},
 +
defaultimages = nil,
 +
defaultsize = '150px',
 +
sizeparameter = 'taille drapeau',
 +
captionparameter = 'légende drapeau',
 +
defaultcaption = 'Drapeau',
 +
property = 'P41',
 +
numval = 1,
 
}
 
}
else
+
end
local statements = wikidata.getClaims{property = 'P39', entity = item, sorttype = 'chronological'}
 
if not statements then
 
return nil
 
end
 
if #statements == 1 then
 
title = singtitle
 
end
 
rows = timeline(statements, 'P39')
 
end
 
return
 
{
 
type = 'table',
 
title = title,
 
rows = rows,
 
}
 
  
 +
function p.logo()
 +
return {
 +
type = 'images',
 +
imageparameters =  {'logo'},
 +
defaultimages = nil,
 +
defaultsize = '150px',
 +
sizeparameter = 'taille logo',
 +
captionparameter = 'légende logo',
 +
defaultcaption = 'Marque ou logotype',
 +
property = 'P154',
 +
numval = 1,
 +
}
 
end
 
end
  
Ligne 341 : Ligne 668 :
 
label = 'Parti politique',
 
label = 'Parti politique',
 
plurallabel = 'Partis politiques',
 
plurallabel = 'Partis politiques',
wikidata = { property = 'P102', sorttype= 'chronological', showdate = true, conjtype = '<br />', excludespecial = true},  
+
wikidata = { property = 'P102', sorttype= 'chronological', showdate = true, conjtype = 'new line', excludespecial = true},  
 
}
 
}
 
end
 
end
  
function p.awards() -- à améliorer
+
function p.memberof()
+
return {type = 'multi', rows = {
local function awardsList(item)
+
{
local majorlist = require "Module:Dictionnaire Wikidata/Distinctions"
+
type = 'row',
 
+
value = 'ordre de chevalerie',
local query = {
+
label = 'Ordre de chevalerie',
entity = item, property= 'P166', sorttype= 'chronological',
+
plurallabel = 'Ordres de chevalerie',
showqualifiers = 'P642', showdate= true, precision = 'year', textformat = 'minimum', linktopic = '-',
+
wikidata = {property = 'P550', sorttype= 'chronological', showdate = true},
speciallabels = majorlist
+
},
}
+
{
 
+
type = 'row',  
local major = {} -- récompenses importantes obtenues
+
label = 'Membre de',  
local all = {}  
+
value = 'membre de',  
local message = "Liste détaillée"
+
wikidata = {property = 'P463', sorttype= 'chronological', showdate = true, precision = 'year'},
 +
},
 +
}}
 +
end
  
local claims = wikidata.getClaims(query)
+
function p.awards()
if not claims then
 
return nil
 
end
 
 
 
if #claims < 4 then
+
local function awardsList()
query.claims = claims
+
local majorawards = require "Module:Dictionnaire Wikidata/Distinctions"
return wikidata.formatAndCat(query), #claims
+
local query = {
end
+
entity = item,
+
property= 'P166',
-- formate la liste des statements, en met certaine dans les "major"
+
sorttype= 'chronological',
for i, j in pairs(claims) do
+
grouped = true,
local id = wikidata.getmainid(j)
+
showqualifiers = 'P642',
local s = wikidata.formatStatement(j, query)
+
showdate= true,
table.insert(all, s)
+
precision = 'year',
if majorlist[id] then
+
conjtype = 'new line',
table.insert(major, s)
+
textformat = 'minimum',
 +
linktopic = '-',
 +
defaultlinkquery = {property = {'P2354', 'P361'}},
 +
excludevalues = 'Q15631401', -- membre de la Royal Society, redondance avec le champ « membre de » (P463)
 +
speciallabels = majorawards,
 +
labelformat = function(id) return genderedlabel(id) end,
 +
}
 +
local claims = wikidata.getClaims(query)
 +
if (not claims) then
 +
return nil
 +
end
 +
local str = wikidata.formatAndCat(query)
 +
if #claims < 4 then
 +
return str, #claims
 
end
 
end
end
 
  
-- transforme la liste complète en chaîne
+
--si trop de valeurs, n'afficher que les importantes de [[Module:Dictionnaire Wikidata/Distinctions]], et mettre les autrs dans un menu pliant
query.value = table.concat(all, '<br />')
 
local str = wikidata.formatAndCat(query) -- la liste complète des récompenses
 
if (#all - #major < 2) then -- s'il n' a qu'une seule récompense mineure, ça ne sert à rien de la collapser
 
return str
 
end
 
 
-- transforme la liste des valeurs importantes en chaîne
 
if (#major > 0) then
 
query.value = table.concat(major, '<br />')
 
majorstr = wikidata.formatAndCat(query)
 
else
 
message = nil --=> pas de titre pour la liste complète
 
end
 
  
-- met la liste complète dans un menu replié
+
--- récupération des importantes
local obj = mw.html.create('div')
+
local majorStr
:addClass("toccolours mw-collapsible mw-collapsed")
+
local targetvalues = {}
:wikitext(message)
+
for i, j in pairs(majorawards) do
:css{border = "none"}
+
table.insert(targetvalues, i)
:tag('div')
+
end
:addClass("mw-collapsible-content")
+
query.targetvalue = targetvalues
:css{['line-height'] = '150%'} -- sinon c'est vraiment serré
+
query.value, query.claims, query.valuetable = nil, nil, nil -- apparemment sinon ce n'est pas le cas, pourquoi ? BUG IMPORTANT
:wikitext(str)
+
majorStr = wikidata.formatAndCat(query)
:done()
 
:allDone()
 
  
str = linguistic.conj({majorstr, tostring(obj)}, '<br />')
+
--- repliage des autres
 +
local message = "'''Liste détaillée'''"
 +
local allAwardsTable = mw.html.create('div')
 +
:addClass("toccolours mw-collapsible mw-collapsed")
 +
:wikitext(message)
 +
:css{border = "none"}
 +
:tag('div')
 +
:addClass("mw-collapsible-content")
 +
:css{['line-height'] = '150%'} -- sinon c'est vraiment serré
 +
:wikitext( str)
 +
:done()
 +
:allDone()
  
return str, #claims
+
return linguistic.conj({majorStr, tostring(allAwardsTable)}, "<br />"), #claims
end
+
end
 
 
 
return {
 
return {
 
type = 'row',  
 
type = 'row',  
 
value = {'prix', 'récompenses', 'distinction', 'distinctions'},
 
value = {'prix', 'récompenses', 'distinction', 'distinctions'},
label = 'Distinction',
+
label = 'Distinctions',
plurallabel = 'Distinctions',
+
singularlabel = 'Distinction',
wikidata = function() return awardsList(item) end
+
wikidata = function() return awardsList() end
 
}
 
}
 
end
 
end
Ligne 426 : Ligne 761 :
 
type = 'row',
 
type = 'row',
 
label =  
 
label =  
function(localdata, item)  
+
function(localdata, item)
if not gender then setgender(localdata, item) end
 
 
if gender == 'f' then
 
if gender == 'f' then
 
return 'Influencée par'
 
return 'Influencée par'
Ligne 446 : Ligne 780 :
 
label = 'A influencé',
 
label = 'A influencé',
 
value = {'a influencé', 'influence de'},
 
value = {'a influencé', 'influence de'},
wikidata = {property = 'P738'},
 
 
}
 
}
 +
end
 +
 +
-- Appartenances
 +
function p.movement()
 +
return
 +
{
 +
type = 'row',
 +
label = 'Mouvement',
 +
value = 'mouvement',
 +
wikidata = {property = 'P135', sorttype= 'chronological', showdate = true, precision = 'year'},
 +
}
 +
end
 +
 +
-- Religion
 +
function p.religion()
 +
return {type = 'multi', rows = {
 +
{
 +
type = 'row',
 +
label = 'Religion',
 +
plurallabel = 'Religions',
 +
value = 'religion',
 +
wikidata = {property = 'P140', sorttype= 'chronological', showdate = true, precision = 'year', excludevalues = 'Q7066'},
 +
},
 +
{
 +
type = 'row',
 +
label = 'Date de baptême',
 +
value = 'date de baptême',
 +
property = 'P1636',
 +
},
 +
{
 +
type = 'row',
 +
label = 'Parrain',
 +
plurallabel = 'Parrains',
 +
value = 'parrain',
 +
property = 'P1290',
 +
},
 +
{
 +
type = 'row',
 +
label = 'Nom en religion',
 +
plurallabel = 'Noms en religion',
 +
value = 'nom en religion',
 +
property = 'P1635',
 +
},
 +
{
 +
type = 'row',
 +
label = 'Ordre religieux',
 +
plurallabel = 'Ordres religieux',
 +
value = 'ordre religieux',
 +
property = 'P611',
 +
},
 +
{
 +
type = 'row',
 +
label = 'Consécrateur',
 +
plurallabel = 'Consécrateurs',
 +
value = 'consécrateur',
 +
property = 'P1598',
 +
},
 +
{
 +
type = 'row',
 +
label =
 +
function(localdata, item)
 +
if gender == 'f' then
 +
return 'Vénérée par'
 +
elseif gender == 'm' then
 +
return 'Vénéré par'
 +
else
 +
return 'Vénéré(e) par'
 +
end
 +
end,
 +
value = 'vénéré par',
 +
property = 'P1049',
 +
},
 +
{
 +
type = 'row',
 +
label = 'Étape de canonisation',
 +
value = 'étape de canonisation',
 +
wikidata = {
 +
property = 'P411',
 +
labelformat = function(id) return genderedlabel(id) end,
 +
},
 +
},
 +
}}
 
end
 
end
  
Ligne 458 : Ligne 873 :
 
plurallabel = 'Armes',
 
plurallabel = 'Armes',
 
value = 'arme',
 
value = 'arme',
wikidata = {property = 'P241', showdate = true, sorttype= 'chronological'},
+
wikidata = {property = 'P241', showdate = true, sorttype= 'chronological', precision = 'year'},
 
},
 
},
 
{
 
{
Ligne 465 : Ligne 880 :
 
plurallabel = 'Grades militaires',
 
plurallabel = 'Grades militaires',
 
value = 'grade militaire',
 
value = 'grade militaire',
wikidata = {property = 'P410', showdate = true, sorttype= 'chronological'},
+
wikidata = {property = 'P410', showdate = true, sorttype= 'chronological', precision = 'year', speciallabels = militaryranks, conjtype ='new line'},
 +
},
 +
{
 +
type = 'row',
 +
label = 'Conflit',
 +
plurallabel = 'Conflits',
 +
value = 'conflit',
 +
wikidata = {property = 'P607', showdate = true, sorttype= 'chronological', precision = 'year'},
 +
},
 +
}}
 +
end
 +
 
 +
-- Carrière de torero
 +
function p.torero()
 +
return {type = 'multi', rows = {
 +
{
 +
type = "row",
 +
label = "Alternative",
 +
value = "alternative",
 +
wikidata = function() return wikidata.keyDate("Q2840411", item) end
 +
},
 +
{
 +
type = "row",
 +
label = "Confirmation d'alternative",
 +
value = "confirmation alt",
 +
wikidata = function() return wikidata.keyDate("Q23308805", item) end
 
},
 
},
 
}}
 
}}
Ligne 475 : Ligne 915 :
 
{
 
{
 
type = 'row',
 
type = 'row',
label = 'Sport',
+
label = 'Spécialité',
plurallabel = 'Sports',
+
plurallabel = 'Spécialités',
value = 'sport',
+
value = 'spécialité',
wikidata = {property = 'P641', showdate = true},
+
wikidata = {property = 'P413',
 +
labelformat = function(id) return genderedlabel(id) end,
 +
},
 +
},
 +
{
 +
type = 'row',
 +
label = 'Discipline sportive',
 +
plurallabel = 'Disciplines sportives',
 +
value = 'discipline sportive',
 +
wikidata = {property = 'P2416'},
 +
},
 +
{
 +
type = 'row',
 +
label = 'Prise de raquette',
 +
value = 'prise de raquette',
 +
wikidata = {property = 'P741'},
 +
},
 +
{
 +
type = 'row',
 +
label = 'Tire de la',
 +
value = 'tire',
 +
wikidata = {property = 'P423'},
 
},
 
},
 
{
 
{
Ligne 485 : Ligne 946 :
 
plurallabel = 'Équipes',
 
plurallabel = 'Équipes',
 
value = 'équipe',
 
value = 'équipe',
wikidata = {property = 'P54', sorttype= 'chronological', showdate = true, conjtype = '<br />'},
+
wikidata = {
 +
property = 'P54',
 +
sorttype= 'chronological',
 +
conjtype = "new line",
 +
statementformat = function(statement)
 +
local str = wikidata.formatStatement(statement, {showdate = true})
 +
local compets = wikidata.getFormattedQualifiers(statement, {"P1350"})
 +
if compets and (tonumber(compets) > 1) then
 +
compets = compets .. " matchs joués"
 +
elseif compets then
 +
compets = compets .. " match joué"
 +
end
 +
local points = wikidata.getFormattedQualifiers(statement, {"P1351"})
 +
if points and (tonumber(points) > 1) then
 +
points = points .. " points marqués"
 +
elseif points then
 +
points = points  .. "point marqué"
 +
end
 +
local qualifiers = linguistic.conj{compets, points}
 +
if qualifiers then
 +
str= str .. " <small> – " .. qualifiers .. " </small>"
 +
end
 +
return str
 +
end
 +
}
 +
},
 +
{
 +
type = 'row',
 +
label = 'Capes internationales',
 +
value = 'capes',
 +
wikidata = {property = 'P1129', numval = 1},
 +
},
 +
{
 +
type = 'row',
 +
label = 'Titre aux échecs',
 +
plurallabel = 'Titres aux échecs',
 +
value = 'titre aux échecs',
 +
wikidata = {property = 'P2962', sorttype= 'chronological', showdate = true, precision = 'year'},
 +
},
 +
{
 +
type = 'row',
 +
label = 'Classement Elo',
 +
value = 'classement elo',
 +
wikidata = {property = 'P1087', numval = '3', sorttype = 'inverted', conjtype = 'new line', showdate = true, precision = 'month', removedupes = true},
 +
},
 +
{
 +
type = 'row',
 +
label = 'Record détenu',
 +
plurallabel = 'Records détenus',
 +
value = 'record détenu',
 +
wikidata = {property = 'P1000', sorttype= 'chronological', showdate = true},
 +
},
 +
{
 +
type = 'row',
 +
label = 'Entraîneur',
 +
plurallabel = 'Entraîneurs',
 +
value = 'entraîneur',
 +
wikidata = {property = 'P286', sorttype= 'chronological', showdate = true, precision = 'year'},
 +
},
 +
{
 +
type = 'row',
 +
label = 'Copilote',
 +
plurallabel = 'Copilotes',
 +
value = 'copilote',
 +
wikidata = {property = 'P2095', sorttype= 'chronological', showdate = true, precision = 'year'},
 
},
 
},
 
{
 
{
Ligne 492 : Ligne 1 017 :
 
plurallabel = 'Sponsors',
 
plurallabel = 'Sponsors',
 
value = 'sponsor',
 
value = 'sponsor',
wikidata = {property = 'P859', sorttype= 'chronological', showdate = true},
+
wikidata = {property = 'P859', sorttype= 'chronological', showdate = true, precision = 'year'},
 +
},
 +
}}
 +
end
 +
 
 +
-- Contacts
 +
function p.contacts()
 +
return {type = 'multi', rows = {
 +
{
 +
type = 'row',
 +
label = localdata['intitulé maître'] or 'Maître',
 +
plurallabel = 'Maîtres',
 +
value = {'maître', 'maîtres'},
 +
wikidata = {property = 'P1066', sorttype= 'chronological', showdate = true, precision = 'year'},
 +
},
 +
{
 +
type = 'row',
 +
label = 'Directeur de thèse',
 +
plurallabel = 'Directeurs de thèse',
 +
value = 'directeur de thèse',
 +
wikidata = {property = 'P184', sorttype= 'chronological', showdate = true, precision = 'year'},
 
},
 
},
 
{
 
{
 
type = 'row',
 
type = 'row',
label = 'Domicile',
+
label = 'Agent',
plurallabel = 'Domiciles',
+
label =
value = 'domicile',
+
function(localdata, item)
wikidata = {property = 'P551', showdate = true, sorttype= 'chronological'},
+
if gender == 'f' then
 +
return 'Représentée par'
 +
elseif gender == 'm' then
 +
return 'Représenté par'
 +
else
 +
return 'Représenté(e) par'
 +
end
 +
end,
 +
value = 'représenté par',
 +
wikidata = {property = 'P1875'},
 +
},
 +
{
 +
type = 'row',
 +
label = 'Partenaire',
 +
plurallabel = 'Partenaires',
 +
value = 'partenaire',
 +
wikidata = {property = 'P1327'},
 +
},
 +
{
 +
type = 'row',
 +
label = localdata['intitulé élève'] or 'Élève',
 +
plurallabel = 'Élèves',
 +
value = {'élève', 'élèves'},
 +
wikidata = {property = 'P802', sorttype= 'chronological', showdate = true, precision = 'year', numval = 5},
 +
},
 +
{
 +
type = 'row',
 +
label = 'Étudiant de thèse',
 +
plurallabel = 'Étudiants de thèse',
 +
value = 'étudiant de thèse',
 +
wikidata = {property = 'P185', sorttype= 'chronological', showdate = true, precision = 'year', numval = 5},
 +
},
 +
{
 +
type = 'row',
 +
label = 'Personne liée',
 +
plurallabel = 'Personnes liées',
 +
value = 'personne liée',
 +
wikidata = {property = 'P3342', numval = 5, showqualifiers = 'P794'},
 +
},
 +
}}
 +
end
 +
 
 +
-- Mécénat
 +
function p.patron()
 +
return {
 +
type = 'row',
 +
label = '[[Mécénat|Mécènes]]',
 +
singularlabel = '[[Mécénat|Mécène]]',
 +
plurallabel = '[[Mécénat|Mécènes]]',
 +
value = 'mécènes',
 +
wikidata = {property = 'P1962', showdate = true, sorttype = 'chronological', conjtype = 'comma'},
 +
}
 +
end
 +
 
 +
-- Musique
 +
function p.music()
 +
return {type = 'multi', rows = {
 +
{
 +
type = 'row',
 +
label = 'Tessiture',
 +
value = 'tessiture',
 +
property = 'P412',
 +
},
 +
{
 +
type = 'row',
 +
label = 'Fach',
 +
value = 'fach',
 +
property = 'P1731',
 +
},
 +
{
 +
type = 'row',
 +
label = 'Instrument',
 +
plurallabel = 'Instruments',
 +
value = 'instrument',
 +
wikidata = {property = 'P1303', sorttype= 'chronological'},
 +
},
 +
{
 +
type = 'row',
 +
label = 'Label',
 +
plurallabel = 'Labels',
 +
value = 'label',
 +
wikidata = {property = 'P264', sorttype= 'chronological', showdate = true, precision = 'year'},
 +
},
 +
}}
 +
end
 +
 
 +
-- Victimes
 +
function p.victims()
 +
return {type = 'multi', rows = {
 +
{
 +
type = 'row',
 +
label = 'Victimes',
 +
value = 'victimes',
 +
wikidata = {property = 'P1345'},
 +
},
 +
}}
 +
end
 +
 
 +
-- Condamnations
 +
function p.penalties()
 +
return {type = 'multi', rows = {
 +
{
 +
type = 'row',
 +
label =
 +
function(localdata, item)
 +
if gender == 'f' then
 +
return 'Condamnée pour'
 +
elseif gender == 'm' then
 +
return 'Condamné pour'
 +
else
 +
return 'Condamné(e) pour'
 +
end
 +
end,
 +
value = 'condamné pour',
 +
wikidata = {property = 'P1399', showdate = true, sorttype = 'chronological', precision = 'year', conjtype = 'comma'},
 +
},
 +
{
 +
type = 'row',
 +
label = 'Condamnation',
 +
plurallabel = 'Condamnations',
 +
value = 'condamnation',
 +
wikidata = {property = 'P1596', showdate = true, sorttype = 'chronological', precision = 'year', conjtype = 'comma'},
 +
},
 +
{
 +
type = 'row',
 +
label = 'Lieu de détention',
 +
plurallabel = 'Lieux de détention',
 +
value = 'lieu de détention',
 +
wikidata = {property = 'P2632', showdate = true, sorttype = 'chronological', precision = 'year', conjtype = 'comma'},
 +
},
 +
}}
 +
end
 +
 
 +
-- Physique
 +
function p.appearance()
 +
return {type = 'multi', rows = {
 +
{
 +
type = 'row',
 +
label = 'Taille',
 +
value = 'taille',
 +
wikidata = {property = 'P2048', targetunit = 'metre', rounding = '2'},
 +
},
 +
{
 +
type = 'row',
 +
label = 'Poids',
 +
value = 'poids',
 +
wikidata = {property = 'P2067', targetunit = 'kilogram', rounding = '1'},
 +
},
 +
{
 +
type = 'row',
 +
label = 'Cheveux',
 +
value = 'cheveux',
 +
wikidata = {property = 'P1884'},
 +
},
 +
{
 +
type = 'row',
 +
label = 'Yeux',
 +
value = 'yeux',
 +
wikidata = {property = 'P1340'},
 
},
 
},
 
}}
 
}}
Ligne 507 : Ligne 1 210 :
 
function p.family()
 
function p.family()
 
return {type = 'multi', rows = {
 
return {type = 'multi', rows = {
 +
{
 +
type = 'row',
 +
label = 'Famille',
 +
plurallabels = 'Familles',
 +
value = 'famille',
 +
property = 'P53',
 +
},
 
{
 
{
 
type = 'row',
 
type = 'row',
 
label = 'Père',  
 
label = 'Père',  
 
value = 'père',
 
value = 'père',
property = 'P22',
+
wikidata = {property = 'P22', conjtype = ' ou '},
 
},
 
},
 
{
 
{
Ligne 517 : Ligne 1 227 :
 
label = 'Mère',
 
label = 'Mère',
 
value = 'mère',
 
value = 'mère',
property = 'P25',
+
wikidata = {property = 'P25', conjtype = ' ou '},
 
},
 
},
 
{
 
{
 
type = 'row',
 
type = 'row',
label = 'Frère',  
+
label = 'Beau-parent',
plurallabel = 'Frères',
+
plurallabel = 'Beaux-parents',
value = 'Frère',
+
value = {'beau-parent', 'beau-père', 'belle-mère'},
property = 'P7',
+
property = 'P3448',
 
},
 
},
 
{
 
{
 
type = 'row',
 
type = 'row',
label = 'Sœur',
+
label = 'Fratrie',
plurallabel = 'Sœurs',
+
value = 'fratrie',
value = 'Sœur',
+
wikidata = {
property = 'P9',
+
property = 'P3373',
 +
sorttype = 'chronological',
 +
conjtype = 'new line',
 +
textformat = 'long',
 +
precision = 'year',
 +
stilltrue = (not deathdate),
 +
}
 
},
 
},
 
{
 
{
 
type = 'row',
 
type = 'row',
label = function()
+
label = 'Conjoint', -- todo : adapter le libellé en genre ?
-- retourne une forme singulière ou plurielle. Pourrait éventuellement adapter féminin masculine, mais demanderait logiquement de vérifier le sexe de chaque valeur
+
plurallabel = 'Conjoints',
local claims = wikidata.getClaims{property = 'P26', entity = item}
 
if (not claims) or #claims == 1 then
 
return "Conjoint"
 
end
 
return "Conjoints"
 
end,
 
 
value = 'conjoint',
 
value = 'conjoint',
wikidata = function()
+
wikidata = {
local claims = wikidata.getClaims{entity = item, property = 'P26', sorttype = 'chronological'}
+
property = 'P26',
if not claims then
+
showdate = true,
return nil
+
sorttype = 'chronological',
end
+
conjtype = 'new line',
if #claims > 4 then -- quand il y a trop de conjoints, on ne va pas à la ligne à chaque fois
+
textformat = 'long',
return wikidata.formatStatements{entity = item, property = 'P26', showdate = true, textformat = 'minimum', precision = 'year', linktopic = '-'}
+
precision = 'year',
end
+
stilltrue = (not deathdate),
-- sinon si (textformat = 'long', showdate = true, precision = 'year', linktopic = '-')
+
precision = 'year',
return wikidata.formatStatements{entity = item, property = 'P26', showdate = true, textformat = 'long', precision = 'year', linktopic = '-', conjtype = '<br />'}
+
}
end
 
 
},
 
},
 
{
 
{
 
type = 'row',
 
type = 'row',
label = 'Enfant',
+
label = localdata['intitulé enfant'] or 'Enfant',-- todo : adapter le libellé en genre ?
 
plurallabel = 'Enfants',
 
plurallabel = 'Enfants',
 
value = 'enfant',
 
value = 'enfant',
wikidata = {property = 'P40'}
+
wikidata = {
 +
property = 'P40',
 +
sorttype = 'chronological',
 +
conjtype = 'new line',
 +
textformat = 'long',
 +
precision = 'year',
 +
stilltrue = (not deathdate),
 +
precision = 'year',
 +
}
 +
},
 +
{
 +
type = 'row',
 +
label = 'Parentèle',
 +
value = 'parentèle',
 +
wikidata = {
 +
property = 'P1038',
 +
excludespecial = true,
 +
conjtype = 'new line',
 +
statementformat = function(statement)
 +
local personid = wikidata.getmainid(statement)
 +
local personlabel = wikidata.formatEntity(personid)
 +
local persongender = getgender(personid)
 +
local kintype = wikidata.getFormattedQualifiers(
 +
statement,
 +
"P1039",
 +
{
 +
labelformat = function(id) return genderedlabel(id, persongender) end,
 +
link = "-"
 +
}
 +
)
 +
if kintype then
 +
return personlabel .. " " .. linguistic.inparentheses(kintype)
 +
end
 +
return personlabel
 +
end,
 +
}
 +
},
 +
}}
 +
end
 +
 
 +
-- Esclavage
 +
function p.slavery()
 +
return {type = 'multi', rows = {
 +
{
 +
type = 'row',
 +
label = 'Propriétaire',
 +
plurallabels = 'Propriétaires',
 +
value = 'propriétaire',
 +
property = 'P127',
 
},
 
},
 
}}
 
}}
 
end
 
end
  
-- oeuvres
+
-- Œuvres
function p.works()
+
function p.works(params)
local title = 'Œuvres réputées'
+
params = params or {}
-- on pourrait mettre quelque chose comme "oeuvre principale" lorsque #vals == 1 mais les données de Wikidata sont trop approximatives pour que cela ait du sens
+
local title = params.title or 'Œuvres réputées'
 +
 
 +
local wikidata = {
 +
excludespecial = true,
 +
numval = 5,
 +
property = 'P800',
 +
defaultlink = 'image',
 +
showdate= true,
 +
labelformat = function(id) local label =  wikidata.getLabel(id) if label then return '<i>' .. label .. '</i>' end end,
 +
}
 +
 +
for i, j in pairs(params) do
 +
wikidata[i] = j
 +
end
 +
 
return  
 
return  
{type = 'table', title = title, rows =
+
{type = 'table', title = title, singulartitle = singulartitle, rows =
 
{
 
{
 
{
 
{
 
type = 'row',
 
type = 'row',
 
value = 'œuvres principales',
 
value = 'œuvres principales',
wikidata = {
+
wikidata = wikidata
property = 'P800',
 
numval = 5,
 
excludespecial = true,
 
displayformat =
 
function(snak)
 
return '<i>' .. wikidata.formatEntity(wikidata.getid(snak), {defaultlink = 'image'}) .. '</i>'
 
end
 
}
 
 
}
 
}
 
}
 
}
 
}
 
}
 +
end
 +
 +
function p.filmography()
 +
local title = 'Films notables'
 +
return
 +
{type = 'row', label = 'Films notables', value = 'films notables', property = 'P1283'}
 +
end
 +
 +
function p.discography()
 +
local title = 'Discographie'
 +
return
 +
{type = 'row', label = 'Discographie', value = 'discographie', property = 'P358'}
 
end
 
end
  
 
-- Signature
 
-- Signature
 
function p.signature(default)
 
function p.signature(default)
 +
local nom = localdata.nom or mw.title.getCurrentTitle().text
 +
local alt = 'signature de ' .. nom
 +
if mw.ustring.match( nom, '^[AEÈÉIOUY]' )  then
 +
alt = "signature d'" .. nom
 +
end
 
return {
 
return {
 
type = 'images',
 
type = 'images',
 
imageparameters =  {'signature'},
 
imageparameters =  {'signature'},
 
defaultimage = default,
 
defaultimage = default,
defaultsize = '150px',
 
 
captionparameter = 'légende signature',
 
captionparameter = 'légende signature',
 
defaultcaption = 'signature',
 
defaultcaption = 'signature',
 +
uprightparameter = 'upright signature',
 +
defaultupright = 0.5,
 +
defaultalt = alt,
 
property = 'P109',
 
property = 'P109',
 
numval = 1
 
numval = 1
 +
}
 +
end
 +
 +
-- Enregistrement vocal
 +
function p.voice()
 +
return {
 +
type     = 'images',
 +
style            = {['padding-top'] = '25px'},--{['border-width'] = '10px', ['border-style'] = 'solid'},
 +
label     = 'Enregistrement vocal',
 +
captionparameter = 'légende voix',
 +
value     = 'voix',
 +
property     = 'P990',
 +
numval          = 1,
 
}
 
}
 
end
 
end

Version actuelle datée du 31 mai 2017 à 13:54

La documentation pour ce module peut être créée à Module:Infobox/Fonctions/Personne/doc

-- Functions utilisées par les infobox personnes
local p = {}
local localdata = require( 'Module:Infobox/Localdata' )
local item = localdata.item
local wikidata = require( "Module:Interface Wikidata" ).fromLua
local general = require "Module:Infobox/Fonctions"
local datemodule = require "Module:Date"
local complexdate = require "Module:Date complexe"
local linguistic = require "Module:Linguistique"
local militaryranks = require "Module:Dictionnaire Wikidata/Grades militaires"

--=== Accord en genre

-- établit la variable gender pour l'élément
local function getgender(id)
	local vals = {
		['Q6581072'] = 'f',
		['Q6581097'] = 'm',
		default      = '?'
	}
	local gender = wikidata.formatStatements{entity = id, property = 'P21', displayformat = 'raw'}
	return vals[gender] or vals.default
end

local gender = getgender(item)

-- récupération des libellés spéciaux codés en dur sur Wikipédia (attention : contient à la fois le libellé et le lien)
local occupationlabels = require "Module:Dictionnaire Wikidata/Métiers"[gender]

-- récupération des libellés genrés de Wikidata
local function genderedlabel(id, labelgender)
	local label
	if not labelgender then
		labelgender = gender -- si le genre n'est pas indiqué, c'est celui de la personne dont c'est l'infobox
	end
	if labelgender == 'f' then -- femme : chercher le libellé dans P2521 (libellé féminin)
		label = wikidata.formatStatements{entity = id, property = 'P2521', isinlang = 'fr', numval = 1, ucfirst = '-'}
	elseif labelgender == 'm' then -- homme : chercher le libellé dans P3321 (libellé masculin)
		label = wikidata.formatStatements{entity = id, property = 'P3321', isinlang = 'fr', numval = 1, ucfirst = '-'}
	end
	if not label then
		label = wikidata.getLabel(id)
	end
	return label
end

-- === Gestion des dates

-- Liens thématiques vers les dates
local datelinks = { -- lien vers le domaine d'activité approprié
	Q483501 = 'en arts plastiques', -- artiste
	Q1028181 = 'en arts plastiques', -- peintre
	Q1281618 = 'en arts plastiques', -- sculpteur
	Q2309784 = 'en cyclisme', -- cycliste
	Q16947657 = 'en arts plastiques', -- lithographe
	Q11569986 = 'en arts plastiques', -- graveur
	Q13365770 = 'en arts plastiques', -- graveur sur cuivre
	Q21925567 = 'en arts plastiques', -- sérigraphe
	Q10862983 = 'en arts plastiques', -- aquafortiste
}

local function getdatetopic() -- obtient le lien le plus approprié pour une date en fonction de la profession
	local claims = wikidata.stringTable{entity = item, property = 'P106', excludespecial = true, displayformat = "raw"}
	if not claims then
		return nil
	end
	for i, j in pairs(claims) do
		if datelinks[j] then
			return datelinks[j]
		end
	end
end

local linktopic = getdatetopic()

--=====
local function wikidatadate(prop, args) 	-- fonction à vocation généraliste, à externaliser
	if not args then
		args = {}
	end
	args.linktopic = args.linktopic or linktopic
	return wikidata.wikidataDate(prop, item, args)
end
local unknowndatelabel = "date inconnue"
local birthdate = localdata['naissance'] or localdata['date de naissance'] or wikidatadate('P569', {unknownlabel = unknowndatelabel})
local deathdate = localdata['décès'] or localdata['date de décès'] or wikidatadate('P570', {unknownlabel =unknowndatelabel })


local function format1(event, period, predecessor, successor, displayformat)
	local mainstr = event
	if predecessor then
		local s = 'précédé par ' .. predecessor
		if gender == 'f' then
			s = 'précédée par ' .. predecessor
		end
		mainstr = mainstr .. '<small><br />&nbsp;' .. s .. '</small>'
	end
	if successor then
		local s = 'suivi par ' .. successor
		if gender == 'f' then
			s = 'suivie par ' .. successor
		end
		mainstr = mainstr .. '<small><br />&nbsp;' .. s .. '</small>'
	end
	return {type = 'row', label = period or '', value = function() return mainstr end}
end

-----------------

local function format2(event, period, predecessor, successor, displayformat)
	if (not event) then
		return nil
	end
	
	local rows = {}

	local eventrow = {type = 'row1col', color = 'secondcolor', value = event }
	table.insert(rows, eventrow)

	if period then
		period = '<span style="font-weight:normal">' .. period .. '</span>'
		local periodrow = {type = 'row1col', color = '#F9F9F9', value = period }
		table.insert(rows, periodrow)
	end

	if predecessor then
		local prederow = {type = 'row', label = 'Prédécesseur', value = function() return predecessor end}
		table.insert(rows, prederow)
	end

	if successor then
		local succrow = {type = 'row', label = 'Successeur', value = function() return successor end}
		table.insert(rows, succrow)
	end
	return {type = 'multi', rows = rows}
end


local function format3(event, period, predecessor, successor, displayformat, details)
	if details then
		details = '<span style="font-weight:normal">' .. details .. '</span>'
		event = linguistic.conj({event, details}, "new line")
	end
	local mainrow =  {type = 'row1col', color = 'secondcolor', value = event }
	if period then
		period = '<span style="font-weight:normal">' .. period .. '</span>'
	end
	local periodrow = {type = 'row1col', color = '#F9F9F9', value = period }
	local successionrow = {
		style = {['background-color'] = '#E1E1E1', ['padding-bottom'] = '2%'},
		type = 'navbox',
		inner = true,
		previousval = function() return predecessor end,
		nextval = function() return successor end,
	}

	return {type = 'multi', rows = {mainrow, periodrow, successionrow}}
end


local function timeline(localparam, wdconf, timelineformat, title, singtitle, details) -- affiche date : événement (suppose les événements déjà triés)
	local rows = {}
	local function returnTable()
		return {
			type = "table",
			title = title,
			rows = rows
	}
	end
	
	-- avec données locales
	local val = localdata[localparam]
	if val == '-' then
		return nil
	elseif val then
		table.insert(rows, {type = 'row1col', color = 'secondcolor', value = val})
		return returnTable()
	end
	-- avec données wikidata
	if not wdconf then
		return nil
	end
	
	wdconf.entity = wdconf.entity or item
	wdconf.sorttype = wdconf.sorttype or "chronological"
	wdconf.labelformat = wdconf.labelformat  or function(id) return genderedlabel(id) end
	wdconf.linktopic = wdconf.linktopic or "-"
	wdconf.stilltrue = not(deathdate) -- si la personne est vivante, on emploie "depuis" plutôt que "à partir de" (mais lorsque c'est fini mais que la date de fin manque, ça devient faux)

	local statements = wikidata.getClaims(wdconf)
	if not statements then
		return nil
	end
	if #statements == 1 then
		title = singtitle
	end
	local displayformats = {
		A = format1,
		B = format2,
		C = format3,
	}
	local applyformat = displayformats[timelineformat] or displayformats['A']
	
	rows = {}
	for i, statement in pairs(statements) do
		local event =  linguistic.ucfirst(wikidata.formatStatement(statement, wdconf))
		local predecessor = wikidata.getFormattedQualifiers(statement, {'P155', 'P1365'})
		local successor = wikidata.getFormattedQualifiers(statement, {'P156', 'P1366'})
		local period = wikidata.statementDate(statement, wdconf )
		local detailstr		
		if type(details) == "function" then
			detailstr = details(statement)
		end
		local row = applyformat(event, period, predecessor, successor, wdconf, detailstr)
		if row then
			table.insert(rows, row)
		end
	end
	table.insert(rows, {type = "external text", value = function() return wikidata.addtrackingcat(wdconf.property) end})
	return returnTable()
end


local function dateandplace(thedate, theplace)
	if thedate and theplace and mw.ustring.find(thedate, "inconnu") and mw.ustring.find(theplace, "inconnu") then
		theplace = nil
		thedate =  mw.ustring.gsub(thedate, unknowndatelabel, "Date et lieu inconnus")	
	end
	return linguistic.conj({thedate, theplace}, "new line")
end


--Titre
function p.title(icon, style)
	return general.title(icon, style)
end

--Image
function p.mainimage()
	
	 -- demande d'illustration que si la personne est née ou morte après 1900, sinon c'est souvent impossible à trouver
	local defaultimage = 'Defaut 2.svg'
	local age = wikidata.stringTable{property = 'P569,P570', entity = item, displayformat = 'raw', excludespecial = true}

	if age then
		local pattern = "(%W)(%d+)%-(%d+)%-(%d+)"
		local era, year = age[1]:match(pattern)
		if (era == '-') or (tonumber(year)) < 1900 then
			defaultimage = nil
		end
	end
	return  general.mainimage('Article à illustrer/Biographie', defaultimage)
end

-- Noms
function p.othernames()

	local names = {
		{'P1477', 'Nom de naissance', 'Noms de naissance', 'nom de naissance'},
		{'P1449', 'Surnom', 'Surnoms', 'surnom'},
		{'P2001', 'Romanisation révisée', 'Romanisation révisée', 'nom de pinceau'},
		{'P1942', 'McCune-Reischauer', 'McCune-Reischauer', 'nom de pinceau'},
		{'P742', 'Pseudonyme', 'Pseudonymes', 'pseudonyme'},
		{'P1782', 'Prénom social', 'Prénoms sociaux', 'prénom social'},
		{'P1786', 'Nom posthume', 'Noms posthumes', 'nom posthume'},
		{'P1785', 'Nom de temple', 'Noms de temple', 'nom de temple'},
		{'P1787', 'Nom de pinceau', 'Noms de pinceau', 'nom de pinceau'},
		{'P428', 'Abréviation en botanique', 'Abréviations en botanique', 'abréviation en botanique'},
		{'P835', 'Abréviation', 'Abréviations', 'abréviation'},
		{nil, 'Autres noms', 'Autres noms', 'autres noms'},
	}

	local birthnamerow = { -- un peu particulier, donc à part
		type = "row",
		wikidata  = function()
			local s = wikidata.formatAndCat{entity = item, property = "P1559"}
			if (not s) then
				return nil
			end
			-- regarde si le nom de la valeur ressemble au libellé (en tenant compte de la pollution des marqueures de langue
			local label = mw.ustring.lower(wikidata.getLabel(item) or "")
			local useless
			if mw.ustring.find(mw.ustring.lower(s), mw.ustring.lower(label), 0, true) then
				useless = true
			end
			if useless then
				return nil
			end
			return s		
			end,
		label = 'Nom dans la langue maternelle',
		plurallabel = 'Noms dans la langue maternelle',
		value = 'nom dans la langue maternelle',
	}
	
	local rows = {type = "multi", rows = {birthnamerow}}
	for i, j in pairs(names) do
		local query
		if j[1] and not localdata['autres noms'] then -- lorsqu'il y a un paramètre "autres noms", Wikidata est désactivée pour éviter risques de doublon
			query = {property = j[1], showqualifiers = {'P1721'}, conjtype = 'new line'}
		end
		table.insert(rows.rows, {type = 'row', value = j[4], wikidata = query, label = j[2], plurallabel = j[3]})
	end
	return rows
end

-- NAISSANCE ET MORT
function p.birth() -- date de naissance en première ligne, lieu de naissance en deuxième
	return {
		type = 'row',
		label = 'Naissance',
		value =
			function()
			local thedate = datemodule.dateInfobox{args = {[1] = 'naissance', [2] = birthdate or '', [3] = deathdate or '', qualificatif = linktopic}}
			local theplace = localdata['lieu de naissance'] or wikidata.formatAndCat({entity =item, property= 'P19', rank = 'best', conjtype= ' ou ', unknownlabel = "lieu inconnu"})
			return dateandplace(thedate, theplace)
			end
	}
end

function p.death() -- même fonctionnement que la fonction p.birth
	
	local label = "Décès"

	local val
	local thedate, theplace
	local disparitiondate, deathdate

	-- date
	--- récup données locales
	disparitiondate = localdata["disparition"]
	deathdate = localdata['décès'] or localdata['date de décès']

	--- récup Wikidata
	if not (disparitiondate or deathdate) then
		disparitiondate =  wikidata.formatAndCat{entity = item, property = "P746", rank = 'best', conjtype= ' ou '}
		if not disparitiondate then
			deathdate =  wikidatadate('P570', {unknownlabel = unknowndatelabel })
		end
	end

	--- mise en forme
	thedate = datemodule.dateInfobox{args = {[1] = 'mort', [2] = birthdate or '', [3] = deathdate or disparitiondate or '', qualificatif = linktopic, unknownlabel = "date inconnue"}}

	-- lieu
	theplace = localdata["lieu de décès"] or wikidata.formatAndCat{entity = item, property= 'P20', rank = 'best', conjtype= ' ou ', unknownlabel = "lieu inconnu"}


	-- Adaptations si on a la date de disparition à la place de la date de décès
	if disparitiondate then
		if theplace then -- cas un peu bizarre et pas très logique, ne vaut pas trop la peine d'un affichage plus élaboré
			disparitiondate = "Date de disparition : " .. thedate
			theplace = "Lieu de décès : " .. theplace
		else
			label = "Disparition"
		end
	end


	val = dateandplace(thedate, theplace)

	return {
		type = 'row',
		label = label,
		value = function() return val end,
	}
end

function p.floruit()
	return {
		type = 'row',
		label = 'Période d’activité',
		value = "Période d'activité",
		wikidata = function() 
			local startDate = wikidata.formatStatements{entity = item, property = "P2031", conjtype = "or", sorttype = "chronological"}
			local endDate = wikidata.formatStatements{entity = item, property = "P2032", conjtype = "or", sorttype = "chronological"}
			if not (startDate or endDate) then
				return wikidatadate('P1317')
			end
			return complexdate.daterange(startDate, endDate, {precision = 11})
			end
	}
end

function p.placeofburial()
	return
		{type = 'row', label = "Sépulture", value = "sépulture", property = 'P119'}
end

function p.nationality() 
	
	-- à améliorer étant donnée les moeurs Wikidata comme nationalité : Empire allemand (1901-1918)  République de Weimar (1918-1933)
	local function wdDate()
		local nation = require "Module:Country data".nationality
		
		-- désactivation si date de naissance avant l'Ère contemporaine : trop d'imprécisions et d'anachronismes
		local mindate = '1789'
		
		local birthdate = wikidata.formatStatements{entity = item, property = 'P569', displayformat = 'raw', numval = 1}
		if (not birthdate) or complexdate.before(mindate, birthdate) then
			return nil
		end
		
		return {
			property = 'P27',
			-- vals = statements, -- statments est une variable non déclarée dans ce module
			showdate = true,
			entity = item,
			conjtype = 'comma',
			removedupes = true,
			linktopic = '-',
			displayformat = 
				function(snak)
					local g = gender -- genre de la personne, pour affichage du gentilé
					if g == '?' then -- si inconnu, au masculin
						g = 'm'
					end
					local val, success = nation(wikidata.getid(snak), g)
					if not success then
						val = wikidata.formatSnak(snak)
					end
					return val
				end
			}
	end
		
	return {
		type = 'row',
		label = 'Nationalité',
		plurallabel = 'Nationalités',
		value = 'nationalité',
		wikidata = wdDate() -- wdDate() retourne une table
	}

end
function p.nativelanguage()
	return
	{type = 'row', label = 'Langue maternelle', value = 'langue maternelle', property = 'P103'}
end

-- Domiciles
function p.places()
	return {type = 'multi', rows = {
{
		type = 'row',
		label = 'Dème',
		plurallabel = 'Dèmes',
		value = 'dème',
		wikidata = {property = 'P2462', showdate = true, sorttype= 'chronological', precision = 'year'},
},
{
		type = 'row',
		label = 'Domicile',
		plurallabel = 'Domiciles',
		value = 'domicile',
		wikidata = {property = 'P551', showdate = true, sorttype= 'chronological', precision = 'year'},
},
{
		type = 'row',
		label = 'Lieu de travail',
		plurallabel = 'Lieux de travail',
		value = 'lieu de travail',
		wikidata = {property = 'P937', sorttype= 'chronological', showdate = true, precision = 'year'},
},
	}}
end

-- parcours professionel
function p.education() -- à améliorer
	local query = {sorttype= 'chronological', property = 'P69', showdate = true, showqualifiers = 'P512', conjtype = 'new line', linktopic = '-'}
	return {
		type = 'row',
		value = {'éducation', 'formation'},
		wikidata = query,
		label = 'Formation',
	}
end

function p.occupation()
	return {
		type = 'row', 
		value = {'activité', 'activités'},
		wikidata = {
			property = 'P106',
			defaultlink = '-',
			defaultlinkquery = {property = 'P425'},
			labelformat = function(id) return genderedlabel(id) end,
			speciallabels = occupationlabels,
			excludevalues = { -- les occupations qui ne méritent pas d'être affichées 
				'Q482980', -- auteur
				--'Q15980158', "auteur de non-fiction" a depuis été traduit par "essayiste"
				'Q18814623', -- autobiographe
				'Q948329', -- acteur de genre
				'Q1209498', -- juriste-poète
			}
		},
		label = 'Activité',
		plurallabel = 'Activités'
	}
end

function p.employer()
	return {
		type = 'row', 
		value = 'employeur',
		wikidata = {property = 'P108', showdate = true, sorttype= 'chronological'}, 
		label = function() return localdata['intitulé employeur'] or 'A travaillé pour' end,
	}
end

function p.victories() 
	local title, singtitle = "Victoires", "Victoire" 
	local localparam = "victoire"
	local wdconf = {property = 'P2522'}
	local displayformat = "B"
	
	return timeline(localparam, wdconf, displayformat, title, singtitle)
end


function p.officialposition() 
	local title, singtitle = "Fonctions", "Fonction"
	local localparam = "fonction"
	local wdconf =  {
		property = 'P39',
		rank = 'valid',
		sorttype = 'inverted',
		speciallabels = occupationlabels,
		defaultlinkquery =  {property = {'P2354', 'P2389', 'P453', 'P361', 'P108'}}, -- liens par défaut : liste, puise organisme dirigé, "membre de", "partie de", employeur
	}
	-- sur une ligne séparée : juridiction, "de", circonsription, diocèse, affiliation, assemblée, parti, emmloyeur
	local details = function(statement) return wikidata.getFormattedQualifiers(statement, {'P1001', 'P642', 'P768', 'P708', 'P1416', 'P194', 'P102', 'P108', 'P937'}) end
	local displayformat = "C"
	
	return timeline(localparam, wdconf, displayformat, title, singtitle, details)
end

function p.nobilitytitle() 
	local title, singtitle = "Titres de noblesse", "Titre de noblesse"
	local localparam = "titre de noblesse"
	local wdconf = {
		property = 'P97', 
		entity = item, rank = 'valid', 
		showqualifiers =  {'P642'},
		defaultlinkquery =  {property = {'P2354', 'P361'}}, -- liens par défaut : liste, puise organisme dirigé, "membre de" et "partie de"
	}
	local displayformat = "B"
	
	return timeline(localparam, wdconf, displayformat, title, singtitle)
end


function p.honorifictitle() 
	local title, singtitle = "Titres honorifiques", "Titre honorifique"
	local localparam = "titre honorifique"
	local wdconf = {property = 'P511', entity = item, rank = 'valid'}
	local displayformat = "C"
	
	return timeline(localparam, wdconf, displayformat, title, singtitle)
end

function p.tombe()
	return {
		type = 'images',
		imageparameters =  {'tombe'},
		defaultimages = nil,
		defaultupright = 0.7,
		uprightparameter = 'upright tombe',
		sizeparameter = 'taille tombe', -- obsolète
		captionparameter = 'légende tombe',
		defaultcaption = 'sépulture',
		property = 'P1442',
		numval = 1,
	}
end

function p.plaque()
	return {
		type = 'images',
		imageparameters =  {'plaque'},
		defaultimages = nil,
		defaultupright = 0.7,
		uprightparameter = 'upright plaque',
		sizeparameter = 'taille plaque', -- obsolète
		captionparameter = 'légende plaque',
		defaultcaption = 'plaque commémorative',
		property = 'P1801',
		numval = 1,
	}
end

function p.blason()
	return {
		type = 'images',
		imageparameters =  {'blason'},
		defaultimages = nil,
		defaultupright = 0.7,
		uprightparameter = 'upright blason',
		sizeparameter = 'taille blason', -- obsolète
		captionparameter = 'légende blason',
		defaultcaption = 'blason',
		property = 'P94',
		numval = 1,
	}
end

function p.sceau()
	return {
		type = 'images',
		imageparameters =  {'sceau'},
		defaultimages = nil,
		defaultupright = 0.7,
		uprightparameter = 'upright sceau',
		sizeparameter = 'taille sceau', -- obsolète
		captionparameter = 'légende sceau',
		defaultcaption = 'sceau',
		property = 'P158',
		numval = 1,
	}
end

function p.monogram()
	return {
		type = 'images',
		imageparameters =  {'monogramme'},
		defaultimages = nil,
		defaultsize = 	'100px',
		sizeparameter = 'taille monogramme',
		captionparameter = 'légende monogramme',
		defaultcaption = 'Monogramme',
		property = 'P1543',
		numval = 1,
	}
end

function p.flag()
	return {
		type = 'images',
		imageparameters =  {'drapeau'},
		defaultimages = nil,
		defaultsize = 	'150px',
		sizeparameter = 'taille drapeau',
		captionparameter = 'légende drapeau',
		defaultcaption = 'Drapeau',
		property = 'P41',
		numval = 1,
	}
end

function p.logo()
	return {
		type = 'images',
		imageparameters =  {'logo'},
		defaultimages = nil,
		defaultsize = 	'150px',
		sizeparameter = 'taille logo',
		captionparameter = 'légende logo',
		defaultcaption = 'Marque ou logotype',
		property = 'P154',
		numval = 1,
	}
end

function p.politicalparty()
	return {
		type = 'row', 
		value = 'parti politique',
		label = 'Parti politique',
		plurallabel = 'Partis politiques',
		wikidata = { property = 'P102', sorttype= 'chronological', showdate = true, conjtype = 'new line', excludespecial = true}, 
	}
end

function p.memberof()
	return {type = 'multi', rows = {
{
	type = 'row', 
	value = 'ordre de chevalerie',
	label = 'Ordre de chevalerie',
	plurallabel = 'Ordres de chevalerie',
	wikidata = {property = 'P550', sorttype= 'chronological', showdate = true}, 
},
{
	type = 'row', 
	label = 'Membre de', 
	value = 'membre de', 
	wikidata = {property = 'P463', sorttype= 'chronological', showdate = true, precision = 'year'},
},
	}}
end

function p.awards()
	
	local function awardsList()
		local majorawards = require "Module:Dictionnaire Wikidata/Distinctions"
		local query = {
			entity = item,
			property= 'P166',
			sorttype= 'chronological',
			grouped = true,
			showqualifiers = 'P642',
			showdate= true,
			precision = 'year',
			conjtype = 'new line',
			textformat = 'minimum',
			linktopic = '-',
			defaultlinkquery = {property = {'P2354', 'P361'}},
			excludevalues = 'Q15631401', -- membre de la Royal Society, redondance avec le champ « membre de » (P463)
			speciallabels = majorawards,
			labelformat = function(id) return genderedlabel(id) end,
		}
		local claims = wikidata.getClaims(query)
		if (not claims) then
			return nil
		end
		local str = wikidata.formatAndCat(query)
		if #claims < 4 then
			return str, #claims
		end

		--si trop de valeurs, n'afficher que les importantes de [[Module:Dictionnaire Wikidata/Distinctions]], et mettre les autrs dans un menu pliant

		--- récupération des importantes
		local majorStr
		local targetvalues = {}
		for i, j in pairs(majorawards) do
			table.insert(targetvalues, i)
		end
		query.targetvalue = targetvalues
		query.value, query.claims, query.valuetable = nil, nil, nil -- apparemment sinon ce n'est pas le cas, pourquoi ? BUG IMPORTANT
		majorStr = wikidata.formatAndCat(query)

		--- repliage des autres
		local message = "'''Liste détaillée'''"
		local allAwardsTable = mw.html.create('div') 
			:addClass("toccolours mw-collapsible mw-collapsed")
			:wikitext(message)
			:css{border = "none"}
			:tag('div')
				:addClass("mw-collapsible-content")
				:css{['line-height'] = '150%'} -- sinon c'est vraiment serré
				:wikitext( str)
				:done()
			:allDone()

		return linguistic.conj({majorStr, tostring(allAwardsTable)}, "<br />"), #claims
	end
	
	return {
		type = 'row', 
		value = {'prix', 'récompenses', 'distinction', 'distinctions'},
		label = 'Distinctions',
		singularlabel = 'Distinction',
		wikidata = function() return awardsList() end
	}
end

-- Influences 
function p.influencedby()
	return {
		type = 'row',
		label = 
		function(localdata, item)
		if gender == 'f' then
			return 'Influencée par'
		elseif gender == 'm' then
			return 'Influencé par'
		else
			return 'Influencé(e) par'
		end
		end,
		value = 'influencé par',
		wikidata = {property = 'P737'},
    }
end

function p.influenced()
	return {
		type = 'row',
		label = 'A influencé',
		value = {'a influencé', 'influence de'},
}
end

-- Appartenances
function p.movement()
	return
	{
	type = 'row',
	label = 'Mouvement',
	value = 'mouvement',
	wikidata = {property = 'P135', sorttype= 'chronological', showdate = true, precision = 'year'},
}
end

-- Religion
function p.religion()
	return {type = 'multi', rows = {
{
		type = 'row',
		label = 'Religion',
		plurallabel = 'Religions',
		value = 'religion',
		wikidata = {property = 'P140', sorttype= 'chronological', showdate = true, precision = 'year', excludevalues = 'Q7066'},
},
{
		type = 'row',
		label = 'Date de baptême',
		value = 'date de baptême',
		property = 'P1636',
},
{
		type = 'row',
		label = 'Parrain',
		plurallabel = 'Parrains',
		value = 'parrain',
		property = 'P1290',
},
{
		type = 'row',
		label = 'Nom en religion',
		plurallabel = 'Noms en religion',
		value = 'nom en religion',
		property = 'P1635',
},
{
		type = 'row',
		label = 'Ordre religieux',
		plurallabel = 'Ordres religieux',
		value = 'ordre religieux',
		property = 'P611',
},
{
		type = 'row',
		label = 'Consécrateur',
		plurallabel = 'Consécrateurs',
		value = 'consécrateur',
		property = 'P1598',
},
{
		type = 'row',
		label = 
		function(localdata, item) 
		if gender == 'f' then
			return 'Vénérée par'
		elseif gender == 'm' then
			return 'Vénéré par'
		else
			return 'Vénéré(e) par'
		end
		end,
		value = 'vénéré par',
		property = 'P1049',
},
{
		type = 'row',
		label = 'Étape de canonisation',
		value = 'étape de canonisation',
		wikidata = {
			property = 'P411',
			labelformat = function(id) return genderedlabel(id) end,
		},
},
	}}
end

-- Carrière militaire
function p.military()
	return {type = 'multi', rows = {
{
		type = 'row',
		label = 'Arme',
		plurallabel = 'Armes',
		value = 'arme',
		wikidata = {property = 'P241', showdate = true, sorttype= 'chronological', precision = 'year'},
},
{
		type = 'row',
		label = 'Grade militaire',
		plurallabel = 'Grades militaires',
		value = 'grade militaire',
		wikidata = {property = 'P410', showdate = true, sorttype= 'chronological', precision = 'year', speciallabels = militaryranks, conjtype ='new line'},
},
{
		type = 'row',
		label = 'Conflit',
		plurallabel = 'Conflits',
		value = 'conflit',
		wikidata = {property = 'P607', showdate = true, sorttype= 'chronological', precision = 'year'},
},
	}}
end

-- Carrière de torero
function p.torero()
	return {type = 'multi', rows = {
{
		type = "row",
		label = "Alternative",
		value = "alternative",
		wikidata = function() return wikidata.keyDate("Q2840411", item) end
},
{
		type = "row",
		label = "Confirmation d'alternative",
		value = "confirmation alt",
		wikidata = function() return wikidata.keyDate("Q23308805", item) end
},
	}}
end

-- Sport
function p.sport()
	return {type = 'multi', rows = {
{
		type = 'row',
		label = 'Spécialité',
		plurallabel = 'Spécialités',
		value = 'spécialité',
		wikidata = {property = 'P413',
			labelformat = function(id) return genderedlabel(id) end,
			},
},
{
		type = 'row',
		label = 'Discipline sportive',
		plurallabel = 'Disciplines sportives',
		value = 'discipline sportive',
		wikidata = {property = 'P2416'},
},
{
		type = 'row',
		label = 'Prise de raquette',
		value = 'prise de raquette',
		wikidata = {property = 'P741'},
},
{
		type = 'row',
		label = 'Tire de la',
		value = 'tire',
		wikidata = {property = 'P423'},
},
{
		type = 'row',
		label = 'Équipe',
		plurallabel = 'Équipes',
		value = 'équipe',
		wikidata = {
			property = 'P54',
			sorttype= 'chronological',
			conjtype = "new line",
			statementformat = function(statement)
				local str = wikidata.formatStatement(statement, {showdate = true})
				local compets = wikidata.getFormattedQualifiers(statement, {"P1350"})
				if compets and (tonumber(compets) > 1) then
					compets = compets .. " matchs joués"
				elseif compets then
					compets = compets .. " match joué"
				end
				local points = wikidata.getFormattedQualifiers(statement, {"P1351"})
				if points and (tonumber(points) > 1) then
					points = points .. " points marqués"
				elseif points then
					points = points  .. "point marqué"
				end
				local qualifiers = linguistic.conj{compets, points}
				if qualifiers then
					str= str .. " <small> – " .. qualifiers .. " </small>"
				end
				return str
			end
		}
},
{
		type = 'row',
		label = 'Capes internationales',
		value = 'capes',
		wikidata = {property = 'P1129', numval = 1},
},
{
		type = 'row',
		label = 'Titre aux échecs',
		plurallabel = 'Titres aux échecs',
		value = 'titre aux échecs',
		wikidata = {property = 'P2962', sorttype= 'chronological', showdate = true, precision = 'year'},
},
{
		type = 'row',
		label = 'Classement Elo',
		value = 'classement elo',
		wikidata = {property = 'P1087', numval = '3', sorttype = 'inverted', conjtype = 'new line', showdate = true, precision = 'month', removedupes = true},
},
{
		type = 'row',
		label = 'Record détenu',
		plurallabel = 'Records détenus',
		value = 'record détenu',
		wikidata = {property = 'P1000', sorttype= 'chronological', showdate = true},
},
{
		type = 'row',
		label = 'Entraîneur',
		plurallabel = 'Entraîneurs',
		value = 'entraîneur',
		wikidata = {property = 'P286', sorttype= 'chronological', showdate = true, precision = 'year'},
},
{
		type = 'row',
		label = 'Copilote',
		plurallabel = 'Copilotes',
		value = 'copilote',
		wikidata = {property = 'P2095', sorttype= 'chronological', showdate = true, precision = 'year'},
},
{
		type = 'row',
		label = 'Sponsor',
		plurallabel = 'Sponsors',
		value = 'sponsor',
		wikidata = {property = 'P859', sorttype= 'chronological', showdate = true, precision = 'year'},
},
	}}
end

-- Contacts
function p.contacts()
	return {type = 'multi', rows = {
{
		type = 'row',
		label = localdata['intitulé maître'] or 'Maître',
		plurallabel = 'Maîtres',
		value = {'maître', 'maîtres'},
		wikidata = {property = 'P1066', sorttype= 'chronological', showdate = true, precision = 'year'},
},
{
		type = 'row',
		label = 'Directeur de thèse',
		plurallabel = 'Directeurs de thèse',
		value = 'directeur de thèse',
		wikidata = {property = 'P184', sorttype= 'chronological', showdate = true, precision = 'year'},
},
{
		type = 'row',
		label = 'Agent',
		label = 
		function(localdata, item) 
		if gender == 'f' then
			return 'Représentée par'
		elseif gender == 'm' then
			return 'Représenté par'
		else
			return 'Représenté(e) par'
		end
		end,
		value = 'représenté par',
		wikidata = {property = 'P1875'},
},
{
		type = 'row',
		label = 'Partenaire',
		plurallabel = 'Partenaires',
		value = 'partenaire',
		wikidata = {property = 'P1327'},
},
{
		type = 'row',
		label = localdata['intitulé élève'] or 'Élève',
		plurallabel = 'Élèves',
		value = {'élève', 'élèves'},
		wikidata = {property = 'P802', sorttype= 'chronological', showdate = true, precision = 'year', numval = 5},
},
{
		type = 'row',
		label = 'Étudiant de thèse',
		plurallabel = 'Étudiants de thèse',
		value = 'étudiant de thèse',
		wikidata = {property = 'P185', sorttype= 'chronological', showdate = true, precision = 'year', numval = 5},
},
{
		type = 'row',
		label = 'Personne liée',
		plurallabel = 'Personnes liées',
		value = 'personne liée',
		wikidata = {property = 'P3342', numval = 5, showqualifiers = 'P794'},
},
	}}
end

-- Mécénat
function p.patron()
	return {
		type = 'row', 
		label = '[[Mécénat|Mécènes]]',
		singularlabel = '[[Mécénat|Mécène]]',
		plurallabel = '[[Mécénat|Mécènes]]', 
		value = 'mécènes', 
		wikidata = {property = 'P1962', showdate = true, sorttype = 'chronological', conjtype = 'comma'},
		}
end

-- Musique
function p.music()
	return {type = 'multi', rows = {
{
		type = 'row',
		label = 'Tessiture',
		value = 'tessiture',
		property = 'P412',
},
{
		type = 'row',
		label = 'Fach',
		value = 'fach',
		property = 'P1731',
},
{
		type = 'row',
		label = 'Instrument',
		plurallabel = 'Instruments',
		value = 'instrument',
		wikidata = {property = 'P1303', sorttype= 'chronological'},
},
{
		type = 'row',
		label = 'Label',
		plurallabel = 'Labels',
		value = 'label',
		wikidata = {property = 'P264', sorttype= 'chronological', showdate = true, precision = 'year'},
},
	}}
end

-- Victimes
function p.victims()
	return {type = 'multi', rows = {
{
		type = 'row',
		label = 'Victimes',
		value = 'victimes',
		wikidata = {property = 'P1345'},
},
	}}
end

-- Condamnations
function p.penalties()
	return {type = 'multi', rows = {
{
		type = 'row',
		label = 
		function(localdata, item) 
		if gender == 'f' then
			return 'Condamnée pour'
		elseif gender == 'm' then
			return 'Condamné pour'
		else
			return 'Condamné(e) pour'
		end
		end,
		value = 'condamné pour',
		wikidata = {property = 'P1399', showdate = true, sorttype = 'chronological', precision = 'year', conjtype = 'comma'},
},
{
		type = 'row', 
		label = 'Condamnation',
		plurallabel = 'Condamnations', 
		value = 'condamnation', 
		wikidata = {property = 'P1596', showdate = true, sorttype = 'chronological', precision = 'year', conjtype = 'comma'},
},
{
		type = 'row', 
		label = 'Lieu de détention',
		plurallabel = 'Lieux de détention', 
		value = 'lieu de détention', 
		wikidata = {property = 'P2632', showdate = true, sorttype = 'chronological', precision = 'year', conjtype = 'comma'},
},
	}}
end

-- Physique
function p.appearance()
	return {type = 'multi', rows = {
{
		type = 'row',
		label = 'Taille',
		value = 'taille',
		wikidata = {property = 'P2048', targetunit = 'metre', rounding = '2'},
},
{
		type = 'row',
		label = 'Poids',
		value = 'poids',
		wikidata = {property = 'P2067', targetunit = 'kilogram', rounding = '1'},
},
{
		type = 'row',
		label = 'Cheveux',
		value = 'cheveux',
		wikidata = {property = 'P1884'},
},
{
		type = 'row',
		label = 'Yeux',
		value = 'yeux',
		wikidata = {property = 'P1340'},
},
	}}
end

-- Famille
function p.family()
	return {type = 'multi', rows = {
{
		type = 'row',
		label = 'Famille',
		plurallabels = 'Familles',
		value = 'famille',
		property = 'P53',
},
{
		type = 'row',
		label = 'Père', 
		value = 'père',
		wikidata = {property = 'P22', conjtype = ' ou '},
},
{
		type = 'row',
		label = 'Mère',
		value = 'mère',
		wikidata = {property = 'P25', conjtype = ' ou '},
},
{
		type = 'row',
		label = 'Beau-parent',
		plurallabel = 'Beaux-parents',
		value = {'beau-parent', 'beau-père', 'belle-mère'},
		property = 'P3448',
},
{
		type = 'row',
		label = 'Fratrie',
		value = 'fratrie',
		wikidata = {
			property = 'P3373',
			sorttype = 'chronological',
			conjtype = 'new line',
			textformat = 'long',
			precision = 'year',
			stilltrue = (not deathdate),
		}
},
{
		type = 'row',
		label = 'Conjoint', -- todo : adapter le libellé en genre ?
		plurallabel = 'Conjoints',
		value = 'conjoint',
		wikidata = {
			property = 'P26',
			showdate = true,
			sorttype = 'chronological',
			conjtype = 'new line',
			textformat = 'long',
			precision = 'year',
			stilltrue = (not deathdate),
			precision = 'year',
		}
},
{
		type = 'row',
		label = localdata['intitulé enfant'] or 'Enfant',-- todo : adapter le libellé en genre ?
		plurallabel = 'Enfants',
		value = 'enfant',
		wikidata = {
			property = 'P40',
			sorttype = 'chronological',
			conjtype = 'new line',
			textformat = 'long',
			precision = 'year',
			stilltrue = (not deathdate),
			precision = 'year',
		}
},
{
	type = 'row',
	label = 'Parentèle',
	value = 'parentèle',
	wikidata = {
		property = 'P1038',
		excludespecial = true,
		conjtype = 'new line',
		statementformat = function(statement)
			local personid = wikidata.getmainid(statement)
			local personlabel = wikidata.formatEntity(personid)
			local persongender = getgender(personid)
			local kintype = wikidata.getFormattedQualifiers(
				statement,
				"P1039", 
				{
					labelformat = function(id) return genderedlabel(id, persongender) end,
					link = "-"
				}
				)
			if kintype then
				return personlabel .. " " .. linguistic.inparentheses(kintype)
			end
			return personlabel 
			end,
		}
},
	}}
end

-- Esclavage
function p.slavery()
	return {type = 'multi', rows = {
{
		type = 'row',
		label = 'Propriétaire',
		plurallabels = 'Propriétaires',
		value = 'propriétaire',
		property = 'P127',
},
	}}
end

-- Œuvres
function p.works(params)
	params = params or {}
	local title = params.title or 'Œuvres réputées'

	local wikidata = {
		excludespecial = true,
		numval = 5,
		property = 'P800',
		defaultlink = 'image',
		showdate= true,
		labelformat = function(id) local label =  wikidata.getLabel(id) if label then return '<i>' .. label .. '</i>' end end,
	}
	
	for i, j in pairs(params) do
		wikidata[i] = j
	end
	
	return 
	{type = 'table', title = title, singulartitle = singulartitle, rows =
		{
			{
			type = 'row',
			value = 'œuvres principales',
			wikidata = wikidata
			}
		}
	}
end

function p.filmography()
	local title = 'Films notables'
	return
	{type = 'row', label = 'Films notables', value = 'films notables', property = 'P1283'}
	end

function p.discography()
	local title = 'Discographie'
	return
	{type = 'row', label = 'Discographie', value = 'discographie', property = 'P358'}
end

-- Signature
function p.signature(default)
	local nom = localdata.nom or mw.title.getCurrentTitle().text
	local alt = 'signature de ' .. nom
	if mw.ustring.match( nom, '^[AEÈÉIOUY]' )  then
		alt = "signature d'" .. nom
	end
	return {
		type = 'images',
		imageparameters =  {'signature'},
		defaultimage = default,
		captionparameter = 'légende signature',
		defaultcaption = 'signature',
		uprightparameter = 'upright signature',
		defaultupright = 0.5,
		defaultalt = alt,
		property = 'P109',
		numval = 1
	}
end

-- Enregistrement vocal
function p.voice()
	return {
		type		     = 'images',
		style            = {['padding-top'] = '25px'},--{['border-width'] = '10px', ['border-style'] = 'solid'},
		label		     = 'Enregistrement vocal',
		captionparameter = 'légende voix',
		value		     = 'voix',
		property	     = 'P990',
		numval           = 1,
	}
end

--== Site web
function p.website()
	return general.website()
end

return p