יחידה:תבנית מידע/אישיות: הבדלים בין גרסאות בדף
תווית "סיבת המוות" משמשת גם כשאין תאריך מוות אך יש פרמטר סיבת מוות. |
מ 9 גרסאות של הדף wikipedia:he:יחידה:תבנית_מידע/אישיות יובאו |
||
| (22 גרסאות ביניים של 5 משתמשים אינן מוצגות) | |||
| שורה 20: | שורה 20: | ||
end | end | ||
local function getDeathLabel(deathCause, entityId) | local function getDeathLabel(deathCause, entityId, gender) | ||
local result='' | local result='' | ||
local fromWikidata=nil | local fromWikidata=nil | ||
| שורה 32: | שורה 32: | ||
end | end | ||
end | end | ||
if deathCause and deathCause ~= '' then | if deathCause and deathCause ~= '' then | ||
if deathCause == 'נהרג' or deathCause == 'נהרגה' or deathCause == 'מוות בקרב' or deathCause == 'נהרג בקרב' or deathCause == 'נהרגה בקרב' or deathCause == 'תאונה' then | if deathCause == 'נהרג' or deathCause == 'נהרגה' or deathCause == 'מוות בקרב' or deathCause == 'נהרג בקרב' or deathCause == 'נהרגה בקרב' or deathCause == 'תאונה' or deathCause == 'טביעה' then | ||
return (gender=='נקבה' and 'נהרגה') or 'נהרג' | return (gender=='נקבה' and 'נהרגה') or 'נהרג' | ||
elseif deathCause == 'נרצח' or deathCause == 'נרצחה' or deathCause == 'רצח' or deathCause == 'רעל' then | elseif deathCause == 'נעדר' or deathCause == 'נעדרת' then | ||
return (gender=='נקבה' and 'נעדרת') or 'נעדר' | |||
elseif deathCause == 'נרצח' or deathCause == 'נרצחה' or deathCause == 'רצח' or deathCause == 'רצח המוני' or deathCause == 'רעל' then | |||
return (gender=='נקבה' and 'נרצחה') or 'נרצח' | return (gender=='נקבה' and 'נרצחה') or 'נרצח' | ||
elseif deathCause == 'התאבד' or deathCause == 'התאבדה' or deathCause == 'התאבדות' then | elseif deathCause == 'התאבד' or deathCause == 'התאבדה' or deathCause == 'התאבדות' then | ||
| שורה 77: | שורה 75: | ||
else | else | ||
local pageNs = mw.title.getCurrentTitle().namespace | local pageNs = mw.title.getCurrentTitle().namespace | ||
if pageNs==0 then | if pageNs==0 and not infoObj.isNonPerson then | ||
local matching = WikidataCrossValidation.crossValidate(eventPlace, propPlace, entityId ) | local matching = WikidataCrossValidation.crossValidate(eventPlace, propPlace, entityId ) | ||
if matching then | if matching then | ||
| שורה 96: | שורה 94: | ||
end | end | ||
function addMissingImage(infoObj, birthDate, deathDate) | function addMissingImage(infoObj, birthDate, deathDate, gender) | ||
if infoObj.args.image ~= nil and #infoObj.args.image > 0 then return end -- there is already image | if infoObj.args.image ~= nil and #infoObj.args.image > 0 then return end -- there is already image | ||
local latestDate = deathDate or birthDate | local latestDate = deathDate or birthDate | ||
| שורה 106: | שורה 104: | ||
if yearsEstimated>150 then return end | if yearsEstimated>150 then return end | ||
local frame = mw.getCurrentFrame() | local frame = mw.getCurrentFrame() | ||
infoObj.args.image = frame:expandTemplate{ title = 'אין תמונה', args = { gender, ['יישור'] = ' | infoObj.args.image = frame:expandTemplate{ title = 'אין תמונה', args = { gender, ['יישור'] = 'מרכז' } } | ||
end | end | ||
| שורה 131: | שורה 124: | ||
else | else | ||
local pageNs = mw.title.getCurrentTitle().namespace | local pageNs = mw.title.getCurrentTitle().namespace | ||
if pageNs==0 then | if pageNs==0 and not infoObj.isNonPerson then | ||
local matching = WikidataCrossValidation.crossValidate(templateArgs[paramName], property, infoObj.args.entityId ) | local matching = WikidataCrossValidation.crossValidate(templateArgs[paramName], property, infoObj.args.entityId ) | ||
if matching then | if matching then | ||
| שורה 139: | שורה 132: | ||
end | end | ||
return usingWikidata | return usingWikidata | ||
end | |||
local function instanceOfViolation(infoObj) | |||
local pageNs = mw.title.getCurrentTitle().namespace | |||
if pageNs~=0 then | |||
return true | |||
end | |||
local wikidataInstanceOf = nil | |||
if infoObj.args.entityId ~= nil then | |||
wikidataInstanceOf = mw.wikibase.getBestStatements(infoObj.args.entityId, 'P31') | |||
wikidataInstanceOf = wikidataInstanceOf and wikidataInstanceOf[1] and wikidataInstanceOf[1].mainsnak | |||
end | |||
if wikidataInstanceOf == nil then | |||
local matching = WikidataCrossValidation.crossValidate('אדם', 'P31', infoObj.args.entityId ) | |||
if matching then | |||
mw.logObject(matching) | |||
table.insert(infoObj.wikidataCats, WikidataCrossValidation.maintainceCategory(matching, 'P31')) | |||
end | |||
else | |||
wikidataInstanceOf = wikidataInstanceOf.datavalue and wikidataInstanceOf.datavalue.value and wikidataInstanceOf.datavalue.value.id | |||
if wikidataInstanceOf ~= 'Q5' then | |||
table.insert(infoObj.wikidataCats, '[[קטגוריה: ויקינתונים - תבניות אישיות למופע לא מתאים]]') | |||
return true | |||
end | |||
end | |||
return false | |||
end | end | ||
| שורה 148: | שורה 169: | ||
local deathLabel = 'פטירה' | local deathLabel = 'פטירה' | ||
-- fill birth/death dates from wikidata is | infoObj.isNonPerson = instanceOfViolation(infoObj) | ||
usingBirthWikidata = fillWikidataParam(templateArgs, 'תאריך לידה', 'P569', infoObj) | |||
local wikidataGender = nil | |||
if not infoObj.isNonPerson then | |||
wikidataGender = PropertyLink.getItem( 'P21', infoObj.args.entityId ) | |||
if wikidataGender == nil then | |||
table.insert(infoObj.wikidataCats, '[[קטגוריה:אישים חסרי מגדר בוויקינתונים]]') | |||
else | |||
if (wikidataGender == "Q6581097") then -- male | |||
wikidataGender = 'זכר' | |||
elseif (wikidataGender == "Q2449503") then -- transgender male | |||
wikidataGender = 'זכר' | |||
elseif (wikidataGender == "Q15145778") then -- cisgender male | |||
wikidataGender = 'זכר' | |||
elseif (wikidataGender == "Q6581072") then -- female | |||
wikidataGender = 'נקבה' | |||
elseif (wikidataGender == "Q1052281") then -- transgender female | |||
wikidataGender = 'נקבה' | |||
elseif (wikidataGender == "Q15145779") then -- cisgender female | |||
wikidataGender = 'נקבה' | |||
elseif wikidataGender == 'Q1097630' -- intersex | |||
or wikidataGender == 'Q48270' -- non binary | |||
then wikidataGender = '' -- עד שתחליטו | |||
end | |||
end | |||
end | |||
-- fill birth/death dates from wikidata if missing and the person is not a human biblical figure | |||
if PropertyLink.getItem( 'P31', infoObj.args.entityId )~="Q20643955" then | |||
usingBirthWikidata = fillWikidataParam(templateArgs, 'תאריך לידה', 'P569', infoObj) | |||
usingDeathWikidata = fillWikidataParam(templateArgs, 'תאריך פטירה', 'P570', infoObj) | |||
end | |||
local birthDate = getSpeculativeDate(templateArgs['תאריך לידה'], templateArgs['תאריך לידה עברי']) | local birthDate = getSpeculativeDate(templateArgs['תאריך לידה'], templateArgs['תאריך לידה עברי']) | ||
| שורה 158: | שורה 207: | ||
local age = nil | local age = nil | ||
if deathDate==nil then | if deathDate==nil then | ||
age = ageModule.ageCalc(birthDate, nil, true, false, true) or '' | age = ageModule.ageCalc(birthDate, nil, true, false, true, nil, wikidataGender) or '' | ||
end | end | ||
local birthDetails, usingBirthWikidataEvent = getEventDetails(templateArgs['תאריך לידה'], templateArgs['תאריך לידה עברי'], templateArgs['מקום לידה'], 'P569', 'P19', age, usingBirthWikidata, infoObj) | local birthDetails, usingBirthWikidataEvent = getEventDetails(templateArgs['תאריך לידה'], templateArgs['תאריך לידה עברי'], templateArgs['מקום לידה'], 'P569', 'P19', age, usingBirthWikidata, infoObj) | ||
table.insert(infoObj.templateStructure, 1, { | table.insert(infoObj.templateStructure, 1, { | ||
label= | label=birthLabel, | ||
data=birthDetails | data=birthDetails | ||
}) | }) | ||
| שורה 168: | שורה 217: | ||
elseif templateArgs['מקום לידה']~= '-' then | elseif templateArgs['מקום לידה']~= '-' then | ||
fillWikidataParam(templateArgs, 'מקום לידה', 'P19', infoObj) | fillWikidataParam(templateArgs, 'מקום לידה', 'P19', infoObj) | ||
table.insert(infoObj.templateStructure, 1, { | if templateArgs['מקום לידה']~= nil and templateArgs['מקום לידה']~= '' then -- only if we fill the parameter eventually - add to template | ||
table.insert(infoObj.templateStructure, 1, { | |||
label=birthLabel, | |||
data= templateArgs['מקום לידה'] | |||
}) | |||
end | |||
end | end | ||
deathLabel = getDeathLabel(templateArgs['סיבת המוות'], infoObj.args.entityId) | deathLabel = getDeathLabel(templateArgs['סיבת המוות'], infoObj.args.entityId, wikidataGender) | ||
if deathDate~=nil then | if deathDate~=nil then | ||
local age = ageModule.ageCalc(birthDate, deathDate, false, false, true) or '' | local age = ageModule.ageCalc(birthDate, deathDate, false, false, true) or '' | ||
| שורה 185: | שורה 236: | ||
elseif templateArgs['מקום פטירה']~= '-' then | elseif templateArgs['מקום פטירה']~= '-' then | ||
fillWikidataParam(templateArgs, 'מקום פטירה', 'P20', infoObj) | fillWikidataParam(templateArgs, 'מקום פטירה', 'P20', infoObj) | ||
table.insert(infoObj.templateStructure, 2, { | if templateArgs['מקום פטירה']~= nil and templateArgs['מקום פטירה']~= '' then -- only if we fill the parameter eventually - add to template | ||
table.insert(infoObj.templateStructure, 2, { | |||
label=deathLabel, | |||
data= templateArgs['מקום פטירה'] | |||
}) | |||
end | |||
end | end | ||
| שורה 217: | שורה 270: | ||
if frame.args['תמונה']~='-' then | if frame.args['תמונה']~='-' then | ||
addMissingImage(infoObj, birthDate, deathDate) | addMissingImage(infoObj, birthDate, deathDate, wikidataGender) | ||
end | end | ||
end | end | ||