Module:Infoboesse/biyografeye
La documentation pour ce module peut être créée à Module:Infoboesse/biyografeye/doc
-- Ci module ci c' est po les dnêyes biyografikes
local p = {}
local lang = mw.language.new("wa")
local date = require("Module:Date")
local infoboesse = require("Module:Infoboesse")
function p.get_infos(entity)
local data = mw.html.create()
local tb = {}
-- djinre : ome Q6581097, feme Q6581072
local gender = entity:getClaims('P21')
if gender:hasValue("Q6581072") then
gender = "f"
else
gender = "o"
end
-- date di skepiaedje
local birthdate = entity:getBestStatements('P569')
if birthdate ~= nil and birthdate[1] ~= nil and birthdate[1].mainsnak.datavalue ~= nil then
val = date.formatDate(birthdate[1].mainsnak)
-- plaece
local birthloc = entity:getBestStatements('P19')
if birthloc ~= nil and birthloc[1] ~= nil then
val = val .. ", "
local val_loc = ""
if birthloc[1].mainsnak.datavalue.type == "string" then
val_loc = birthloc[1].mainsnak.datavalue.value
elseif birthloc[1].mainsnak.datavalue.type == "wikibase-entityid" then
val_loc = mw.wikibase.getLabel(birthloc[1].mainsnak.datavalue.value.id)
end
if mw.wikibase.getSitelink(birthloc[1].mainsnak.datavalue.value.id) then
val_loc = "[[".. mw.wikibase.getSitelink(birthloc[1].mainsnak.datavalue.value.id) .."|" .. val_loc .. "]]"
end
val = val..val_loc
end
table.insert(tb, {"Skepiaedje", val})
end
-- date di moirt
local deathdate = entity:getBestStatements('P570')
if deathdate ~= nil and deathdate[1] ~= nil and deathdate[1].mainsnak.datavalue ~= nil then
val = date.formatDate(deathdate[1].mainsnak)
-- plaece
local deathloc = entity:getBestStatements('P20')
if deathloc ~= nil and deathloc[1] ~= nil then
val = val .. ", "
local val_loc = ""
if deathloc[1].mainsnak.datavalue.type == "string" then
val_loc = deathloc[1].mainsnak.datavalue.value
elseif deathloc[1].mainsnak.datavalue.type == "wikibase-entityid" then
val_loc = mw.wikibase.getLabel(deathloc[1].mainsnak.datavalue.value.id)
end
if mw.wikibase.getSitelink(deathloc[1].mainsnak.datavalue.value.id) then
val_loc = "[[".. mw.wikibase.getSitelink(deathloc[1].mainsnak.datavalue.value.id) .."|" .. val_loc .. "]]"
end
val = val..val_loc
end
table.insert(tb, {"Moirt", val})
end
-- nåcionålité
-- TODO i pout nd aveur pus d'ene
local nationalities = entity:getAllStatements('P27')
val = ""
if nationalities ~= nil then
for i, nationality in ipairs( nationalities ) do
local val_nat = ""
vals = mw.wikibase.getBestStatements(nationality.mainsnak.datavalue.value.id, 'P1549')
for i, v in ipairs( vals ) do
if v.mainsnak.datavalue.value.language == "wa" then
if v.qualifiers ~= nil then
if gender == "o" and v.qualifiers["P518"][1].datavalue.value.id == "Q47088290" or
gender == "f" and v.qualifiers["P518"][1].datavalue.value.id == "Q47088293" then
val_nat = lang:ucfirst(v.mainsnak.datavalue.value.text)
break
end
end
val_nat = lang:ucfirst(v.mainsnak.datavalue.value.text)
end
end
if val ~= "" then val = val .. ",<br/>" end
if val_nat == "" then
val_nat = mw.wikibase.getLabel(nationality.mainsnak.datavalue.value.id)
end
if mw.wikibase.getSitelink(nationality.mainsnak.datavalue.value.id) then
val_nat = "[[".. mw.wikibase.getSitelink(nationality.mainsnak.datavalue.value.id) .."|" .. val_nat .. "]]"
end
val = val .. val_nat
if nationality.qualifiers then
if nationality.qualifiers["P580"] then
date_begin = date.formatDate(nationality.qualifiers["P580"][1])
end
if nationality.qualifiers["P582"] then
date_end = date.formatDate(nationality.qualifiers["P582"][1])
end
if date_begin and date_end then
val = val .. " <small>(" .. date_begin.. "-"..date_end.. ")</small>"
elseif date_end then
val = val .. " <small>(disk' e " .. date_end.. ")</small>"
end
end
end
table.insert(tb, {"Nåcionålité", val})
end
-- activités
local occupations = entity:getBestStatements('P106')
local val_of
val = {}
if occupations ~= nil then
for i, occupation in ipairs( occupations ) do
local val_of = mw.wikibase.getLabel(occupation.mainsnak.datavalue.value.id)
if gender == "f" then
vals = mw.wikibase.getBestStatements(occupation.mainsnak.datavalue.value.id, 'P2521')
for i, v in ipairs( vals ) do
if v.mainsnak.datavalue.value.language == "wa" then
val_of = v.mainsnak.datavalue.value.text
end
end
end
if mw.wikibase.getSitelink(occupation.mainsnak.datavalue.value.id) then
val_of = "[[".. mw.wikibase.getSitelink(occupation.mainsnak.datavalue.value.id) .."|" .. val_of .. "]]"
end
table.insert(val, val_of)
end
val = table.concat(val, ', ')
table.insert(tb, {"Activités", val})
end
local akaWD = entity:getBestStatements('P742')
local i = 1
local akas = {}
local altname = ""
while( akaWD[i] ~= nil and akaWD[i].mainsnak.datavalue ~= nil ) do
local aka = akaWD[i].mainsnak.datavalue.value
table.insert(akas, aka)
if i == 10 then break end
i = i + 1
end
val = table.concat(akas, ', ')
table.insert(tb, {"Ôtes nos", val})
data:node(infoboesse.get_simple_html_table(tb))
-- signateure
local signature = entity:getBestStatements('P109')
if signature ~= nil and signature[1] ~= nil then
val = signature[1].mainsnak.datavalue.value
val = '[[File:'..val..'|center|150px]]'
div = mw.html.create('div')
:addClass("infoboesse-signateure")
:wikitext(val)
data:node(div)
end
return data
end
return p