« Module:Infobox/Fonctions/Personne » : différence entre les versions
Contenu supprimé Contenu ajouté
interface wikidata → wikidata |
p.death : meilleure articulation wikipédia / wikidata et disparition / décès, fonctions : à partir de->depuis quand la personne n'est pas morte |
||
Ligne 84 :
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 dead = wikidata.getClaims{entity = item, property = 'P570'} --utilisé comme booléen qui dit si une personne est morte pour modifier certaines élément d'affichage
▲local deathdate = localdata['décès'] or localdata['date de décès']
local function format1(event, period, predecessor, successor, displayformat)
Ligne 186 ⟶ 188 :
wdconf.labelformat = wdconf.labelformat or function(id) return genderedlabel(id) end
wdconf.linktopic = wdconf.linktopic or "-"
wdconf.stilltrue = not
local statements = wikidata.getClaims(wdconf)
Ligne 207 ⟶ 209 :
local predecessor = wikidata.getFormattedQualifiers(statement, {'P155', 'P1365'})
local successor = wikidata.getFormattedQualifiers(statement, {'P156', 'P1366'})
local period = wikidata.getFormattedDate(statement, {linktopic = wdconf.linktopic, stilltrue = not dead } ) -- dont pass all wdconf or else qualifiers will show up
local detailstr
if type(details) == "function" then
Ligne 312 ⟶ 314 :
value =
function()
local thedate = datemodule.dateInfobox{args = {[1] = 'naissance', [2] = birthdate or '', [3] = deathdate or wddeathdate 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)
Ligne 321 ⟶ 323 :
function p.death() -- même fonctionnement que la fonction p.birth
--- récup de Wikidata seulement en l'absence de données locales▼
local ddate = deathdate --déclarée pour l'ensemble du module
if (not ddate) and (not localdata['disparition']) then
deathdate = wddeathdate
▲ --- récup données locales
if not disparitiondate then▼
▲ deathdate = wikidatadate('P570', {unknownlabel = unknowndatelabel })
end
thedate = datemodule.dateInfobox{args = {[1] = 'mort', [2] = birthdate or '', [3] = deathdate
▲ thedate = datemodule.dateInfobox{args = {[1] = 'mort', [2] = birthdate or '', [3] = deathdate or disparitiondate or '', qualificatif = linktopic, unknownlabel = "date inconnue"}}
theplace = localdata["lieu de décès"] or wikidata.formatAndCat{entity = item, property= 'P20', rank = 'best', conjtype= ' ou ', unknownlabel = "lieu inconnu"}
label = "Disparition"▼
val = dateandplace(thedate, theplace)
return
{type = 'multi', rows = {
{ -- disparition
type = 'row',
},
{ -- décès
type = 'row',
label = label,
value = function() return val end,
}}
end
Ligne 1 245 ⟶ 1 227 :
textformat = 'long',
precision = 'year',
stilltrue =
}
},
Ligne 1 260 ⟶ 1 242 :
textformat = 'long',
precision = 'year',
stilltrue =
precision = 'year',
}
Ligne 1 275 ⟶ 1 257 :
textformat = 'long',
precision = 'year',
stilltrue = (not
precision = 'year',
}
|