מאשרי תמונות, בדוקי עריכות אוטומטית, ביוראקראטן, אינטערפעיס רעדאקטארן, emailconfirmed, אינטערפעיס אדמיניסטראַטאָרן, אונטערדריקער, סיסאפן, צוות טכני, מייבאים, מעדכנים, מייבא
2,782
רעדאגירונגען
ק (תיקון באג - nil ומחרוזת ריקה - שניהם פרמטר חסר) |
שרגא (שמועס | ביישטייערונגען) ק (1 רעוויזיע אימפארטירט: אימפארטירט פון די יידישע וויקיפעדיע, זע ביישטייערער ליסטע) |
||
| שורה 1: | שורה 1: | ||
local Infobox = require('Module:תבנית מידע').Infobox | local Infobox = require('Module:תבנית מידע').Infobox | ||
local LocationAndCountry = require('Module:LocationAndCountry') | local LocationAndCountry = require('Module:LocationAndCountry') | ||
local PropertyLink = require('Module:PropertyLink') | local PropertyLink = require('Module:PropertyLink') | ||
local ageModule = require('Module:גיל לערכי אישים') | local ageModule = require('Module:גיל לערכי אישים') | ||
local hebrewDateModule = require('Module:תאריך עברי') | local hebrewDateModule = require('Module:תאריך עברי') | ||
local WikidataCrossValidation = require('Module:WikidataCrossValidation') | local WikidataCrossValidation = require('Module:WikidataCrossValidation') | ||
| שורה 20: | שורה 20: | ||
end | end | ||
local function getDeathLabel(deathCause, entityId | local function getDeathLabel(deathCause, entityId) | ||
entityId = entityId or mw.wikibase.getEntityIdForCurrentPage() | entityId = entityId or mw.wikibase.getEntityIdForCurrentPage() | ||
if | if deathCause == nil and entityId ~= nil then | ||
local deathCauseWikidata = mw.wikibase.getBestStatements(entityId, 'P1196') | local deathCauseWikidata = mw.wikibase.getBestStatements(entityId, 'P1196') | ||
deathCauseWikidata = deathCauseWikidata and deathCauseWikidata[1] and deathCauseWikidata[1].mainsnak | deathCauseWikidata = deathCauseWikidata and deathCauseWikidata[1] and deathCauseWikidata[1].mainsnak | ||
if deathCauseWikidata then | if deathCauseWikidata then | ||
deathCause = mw.wikibase.renderSnak(deathCauseWikidata) | deathCause = mw.wikibase.renderSnak(deathCauseWikidata) | ||
end | end | ||
end | end | ||
local gender = PropertyLink.getPropertyByOptions( 'P21', entityId ) | |||
if deathCause and deathCause ~= '' then | if deathCause and deathCause ~= '' then | ||
if deathCause == 'נהרג' or deathCause == 'נהרגה | if 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 == 'רצח | |||
return (gender=='נקבה' and 'נרצחה') or 'נרצח' | return (gender=='נקבה' and 'נרצחה') or 'נרצח' | ||
elseif deathCause == 'התאבד' or deathCause == 'התאבדה' or deathCause == 'התאבדות' then | |||
return (gender=='נקבה' and 'התאבדה') or 'התאבד' | return (gender=='נקבה' and 'התאבדה') or 'התאבד' | ||
elseif deathCause == 'הוצא להורג' or deathCause == 'הוצאה להורג' or deathCause == 'עונש מוות | elseif deathCause == 'הוצא להורג' or deathCause == 'הוצאה להורג' or deathCause == 'עונש מוות' then | ||
return 'הוצאה להורג' | return 'הוצאה להורג' | ||
end | end | ||
end | end | ||
return | return 'פטירה' | ||
end | end | ||
function getEventDetails(generalDate, hebDate, eventPlace, propDate, propPlace, age, usingWikidata, | |||
entityId = | function getEventDetails(generalDate, hebDate, eventPlace, propDate, propPlace, age, usingWikidata, entityId) | ||
entityId = entityId or mw.wikibase.getEntityIdForCurrentPage() | |||
age = age or '' | age = age or '' | ||
local formattedEvent | local formattedEvent | ||
if generalDate~=nil and generalDate~='' then | if generalDate~=nil and generalDate~='' then | ||
formattedEvent = generalDate .. age | formattedEvent = generalDate .. age | ||
if hebDate~=nil and hebDate~='' then | if hebDate~=nil and hebDate~='' then | ||
| שורה 68: | שורה 59: | ||
if (eventPlace == nil or eventPlace == '') and entityId then | if (eventPlace == nil or eventPlace == '') and entityId then | ||
local success, res = pcall(LocationAndCountry.displayFromParams, propPlace, entityId, | local success, res = pcall(LocationAndCountry.displayFromParams, propPlace, entityId, propDate , 1) | ||
if success and res and #res>0 then | if success and res and #res>0 then | ||
usingWikidata = true | usingWikidata = true | ||
eventPlace = res | eventPlace = res | ||
end | end | ||
end | end | ||
| שורה 88: | שורה 71: | ||
if usingWikidata and entityId then | if usingWikidata and entityId then | ||
formattedEvent = formattedEvent .. ' [[File:Blue pencil RTL.svg|15px|link=https://www.wikidata.org/wiki/'..entityId.. '?uselang= | formattedEvent = formattedEvent .. ' [[File:Blue pencil RTL.svg|15px|link=https://www.wikidata.org/wiki/'..entityId.. '?uselang=yi#P569|עריכת הנתון בוויקינתונים]]' | ||
end | end | ||
| שורה 94: | שורה 77: | ||
end | end | ||
function addMissingImage(infoObj, birthDate, deathDate | function addMissingImage(infoObj, birthDate, deathDate) | ||
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 | ||
| שורה 104: | שורה 87: | ||
if yearsEstimated>150 then return end | if yearsEstimated>150 then return end | ||
if infoObj.args.entityId == nil then | |||
return false -- no wikidata entity | |||
end | |||
local gender = PropertyLink.getPropertyByOptions( 'P21', infoObj.args.entityId ) | |||
local frame = mw.getCurrentFrame() | local frame = mw.getCurrentFrame() | ||
infoObj.args.image = frame:expandTemplate{ title = ' | infoObj.args.image = frame:expandTemplate{ title = 'קיין בילד', args = { gender, ['יישור'] = 'center' } } | ||
end | end | ||
| שורה 111: | שורה 99: | ||
local usingWikidata = false | local usingWikidata = false | ||
if infoObj.args.entityId == nil then | if infoObj.args.entityId == nil then | ||
return false -- no wikidata entity | return false -- no wikidata entity | ||
end | end | ||
| שורה 123: | שורה 107: | ||
end | end | ||
else | else | ||
local matching = WikidataCrossValidation.crossValidate(templateArgs[paramName], property, infoObj.args.entityId ) | |||
if matching then | |||
table.insert(infoObj.wikidataCats, WikidataCrossValidation.maintainceCategory(matching, property)) | |||
end | end | ||
end | end | ||
return usingWikidata | return usingWikidata | ||
end | end | ||
| שורה 166: | שורה 119: | ||
local usingBirthWikidata = false | local usingBirthWikidata = false | ||
local usingDeathWikidata = false | local usingDeathWikidata = false | ||
local birthLabel = ' | local birthLabel = 'געבורט' | ||
local deathLabel = ' | local deathLabel = 'טויט' | ||
-- fill birth/death dates from wikidata is missing | |||
-- fill birth/death dates from wikidata | |||
usingBirthWikidata = fillWikidataParam(templateArgs, 'תאריך לידה', 'P569', infoObj) | usingBirthWikidata = fillWikidataParam(templateArgs, 'תאריך לידה', 'P569', infoObj) | ||
usingDeathWikidata = fillWikidataParam(templateArgs, 'תאריך פטירה', 'P570', infoObj) | usingDeathWikidata = fillWikidataParam(templateArgs, 'תאריך פטירה', 'P570', infoObj) | ||
| שורה 205: | שורה 132: | ||
local age = nil | local age = nil | ||
if deathDate==nil then | if deathDate==nil then | ||
age = ageModule.ageCalc(birthDate, nil, true, false, true | age = ageModule.ageCalc(birthDate, nil, true, false, true) 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.args.entityId) | ||
table.insert(infoObj.templateStructure, 1, { | table.insert(infoObj.templateStructure, 1, { | ||
label= | label='געבורט', | ||
data=birthDetails | data=birthDetails | ||
}) | }) | ||
usingBirthWikidata = usingBirthWikidata or usingBirthWikidataEvent | usingBirthWikidata = usingBirthWikidata or usingBirthWikidataEvent | ||
else | |||
if templateArgs['מקום לידה']~= '-' and templateArgs['מקום לידה']~= '' and templateArgs['מקום לידה']~=nil and #templateArgs['מקום לידה']>0 then | |||
table.insert(infoObj.templateStructure, 1, { | table.insert(infoObj.templateStructure, 1, { | ||
label=birthLabel, | |||
data= templateArgs['מקום לידה'] | |||
}) | |||
end | |||
end | |||
if deathDate~=nil then | if deathDate~=nil then | ||
deathLabel = getDeathLabel(templateArgs['סיבת המוות'], infoObj.args.entityId) | |||
local age = ageModule.ageCalc(birthDate, deathDate, false, false, true) or '' | local age = ageModule.ageCalc(birthDate, deathDate, false, false, true) or '' | ||
local deathDetails, usingDeathWikidataEvent = getEventDetails(templateArgs['תאריך פטירה'], templateArgs['תאריך פטירה עברי'], templateArgs['מקום פטירה'], 'P570', 'P20', age, usingDeathWikidata, infoObj) | local deathDetails, usingDeathWikidataEvent = getEventDetails(templateArgs['תאריך פטירה'], templateArgs['תאריך פטירה עברי'], templateArgs['מקום פטירה'], 'P570', 'P20', age, usingDeathWikidata, infoObj.args.entityId) | ||
table.insert(infoObj.templateStructure, 2, { | table.insert(infoObj.templateStructure, 2, { | ||
label=deathLabel, | label=deathLabel, | ||
| שורה 232: | שורה 158: | ||
}) | }) | ||
usingDeathWikidata = usingDeathWikidata or usingDeathWikidataEvent | usingDeathWikidata = usingDeathWikidata or usingDeathWikidataEvent | ||
end | end | ||
| שורה 268: | שורה 186: | ||
if frame.args['תמונה']~='-' then | if frame.args['תמונה']~='-' then | ||
addMissingImage(infoObj, birthDate, deathDate | addMissingImage(infoObj, birthDate, deathDate) | ||
end | end | ||
end | end | ||
רעדאגירונגען