אונטערשייד צווישן ווערסיעס פון "יחידה:תבנית מידע/אישיות"

אפדעיט
ק (מניעת שאיבת תאריכי לידה מוויקינתונים עבור דמות מקראית אנושית, לפי בקשה באולם הדיונים של התבניות)
(אפדעיט)
 
(30 מיטלסטע ווערסיעס פון 2 באַניצער נישט געוויזן.)
שורה 1: שורה 1:
local Infobox = require('Module:תבנית מידע').Infobox
local dataTemplateModule = require('Module:תבנית מידע')
local Infobox = dataTemplateModule.Infobox
local BackgroundColors = mw.loadJsonData('Module:תבנית מידע/אישיות/צבע רקע לפי סיווג.json')
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 Date = require('Module:תאריך')
local Date = require('Module:דאטום')
local hebrewDateModule = require('Module:תאריך עברי')
local hebrewDateModule = require('Module:אידישע דאטום')
local WikidataCrossValidation = require('Module:WikidataCrossValidation')
local WikidataCrossValidation = require('Module:WikidataCrossValidation')
local siteModule = require('Module:תבנית מידע/אתר')
local TimeRange = require('Module:טווח זמנים')
local gim = require( "Module:גימטריה" )
function count(str, substring)
    local count = 0
    local _, occurrences = string.gsub(str, substring, function()
        count = count + 1
    end)
    return count
end
function enclosed(s)
return mw.ustring.sub(s, 1, 2) == "[[" and mw.ustring.sub(s, -2) == "]]" and count(s, "%[%[") == 1
end


--[[ Get general date if known, otherwise guess from hebrew date.
--[[ Get general date if known, otherwise guess from hebrew date.
שורה 11: שורה 26:
function getSpeculativeDate(generalDate, hebrewDate)
function getSpeculativeDate(generalDate, hebrewDate)
if generalDate == '-' then return nil end
if generalDate == '-' then return nil end
if generalDate~=nil and generalDate~='' then return generalDate end
if generalDate ~= nil and generalDate ~= '' then return generalDate end
if hebrewDate~=nil and hebrewDate~='' then
if hebrewDate ~= nil and hebrewDate ~= '' then
local success, sepcDate = pcall(hebrewDateModule.pick, mw.getCurrentFrame():newChild{ args = {hebrew=hebrewDate, world='', exact='כן' } })
local success, sepcDate = pcall(hebrewDateModule.pick, mw.getCurrentFrame():newChild{ args = {hebrew=hebrewDate, world='', exact='כן' } })
if not success or sepcDate=='' then return nil end
if not success or sepcDate == '' then return nil end
return sepcDate
return sepcDate
end
end
return nil
return nil
end
local function getPencilLink(entityId, prop)
if not entityId then return '' end
return string.format(' [[File:Blue pencil RTL.svg|15px|link=https://www.wikidata.org/wiki/%s?uselang=he#%s|עריכת הנתון בוויקינתונים]]', entityId, prop)
end
end


שורה 23: שורה 43:
local result=''
local result=''
local fromWikidata=nil
local fromWikidata=nil
entityId = entityId or mw.wikibase.getEntityIdForCurrentPage()
entityId = nil
if ( deathCause == nil or deathCause =='' ) and entityId ~= nil then
if ( deathCause == nil or deathCause == '' ) 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
שורה 40: שורה 60:
elseif deathCause == 'נרצח' or deathCause == 'נרצחה' or deathCause == 'רצח' or deathCause == 'רצח המוני' or deathCause == 'רעל' then
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
return (gender=='נקבה' and 'התאבדה') or 'התאבד'
return (gender=='נקבה' and 'התאבדה') or 'התאבד'
elseif deathCause == 'הוצא להורג' or deathCause == 'הוצאה להורג' or deathCause == 'עונש מוות' or deathCause == 'תלייה' then
elseif deathCause == 'הוצא להורג' or deathCause == 'הוצאה להורג' or deathCause == 'עונש מוות' or deathCause == 'תלייה' then
return 'הוצאה להורג'
return 'הוצאה להורג'
elseif not fromWikidata then result='[[קטגוריה:ערכים עם סיבת מוות שגויה בתבנית]]'
elseif not fromWikidata then result = '[[קאטעגאריע:ערכים עם סיבת מוות שגויה בתבנית]]'
end
end
end
end
return result .. 'פטירה'
return result .. 'פטירה'
end
end
function getEventDetails(generalDate, hebDate, eventPlace, propDate, propPlace, age, usingWikidata, infoObj)
function getEventDetails(generalDate, hebDate, eventPlace, propDate, propPlace, age, usingWikidata, infoObj)
entityId = infoObj.args.entityId or mw.wikibase.getEntityIdForCurrentPage()
entityId = nil --infoObj.args.entityId or mw.wikibase.getEntityIdForCurrentPage()
age = age or ''
age = age or ''
local formattedEvent
local formattedEvent = ''
local placeDate = propDate
local placeDate = propDate
if generalDate~=nil and generalDate~='' then
if generalDate ~= nil and generalDate ~= '' then
local success, placeDateParsed = pcall(Date.newFromWikitext, generalDate)
local success, placeDateParsed = pcall(Date.newFromWikitext, generalDate)
if success then
if success then
placeDate = placeDateParsed
placeDate = placeDateParsed
end
end
formattedEvent = generalDate .. age
formattedEvent = generalDate .. age
if hebDate~=nil and hebDate~='' then  
if hebDate ~= nil and hebDate ~= '' then  
formattedEvent = formattedEvent ..'<br/>' ..hebDate
formattedEvent = formattedEvent .. '<br/>' .. hebDate
end
end
elseif hebDate~=nil and hebDate~='' then
elseif hebDate ~= nil and hebDate ~= '' then
formattedEvent = hebDate .. age
formattedEvent = hebDate .. age
end
end
if (eventPlace == nil or eventPlace == '') and entityId then
if (eventPlace == nil or eventPlace == '') and entityId then
local success, res = pcall(LocationAndCountry.displayFromParams, propPlace, entityId, placeDate , 1)
local success, res = pcall(LocationAndCountry.displayFromParams, propPlace, entityId, placeDate , 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
שורה 76: שורה 97:
local pageNs = mw.title.getCurrentTitle().namespace
local pageNs = mw.title.getCurrentTitle().namespace
if pageNs==0 and not infoObj.isNonPerson 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
table.insert(infoObj.wikidataCats, WikidataCrossValidation.maintainceCategory(matching, propPlace))
table.insert(infoObj.wikidataCats, WikidataCrossValidation.maintainceCategory(matching, propPlace))
שורה 88: שורה 109:
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=he#P569|עריכת הנתון בוויקינתונים]]'
formattedEvent = formattedEvent .. getPencilLink(entityId, 'P856')
end
end


return formattedEvent, usingWikidata
return formattedEvent, usingWikidata
end
-- Split the comma-separated lists into tables and sort them
local function splitString(inputstr, sep)
local sep, fields = sep or ",", {}
local pattern = string.format("([^%s]+)", sep)
inputstr:gsub(pattern, function(c) fields[#fields + 1] = c end)
return fields
end
end


function addMissingImage(infoObj, birthDate, deathDate, gender)
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  
-- Assuming you have defined deathDate and birthDate earlier
local latestDate = deathDate or birthDate
local latestDate = deathDate or birthDate
if latestDate == nil then return end
if latestDate == nil then return end
local dateModule = require('Module:תאריך')
local success, res = pcall(dateModule.parseDateRange, latestDate, 'raw')
-- Split the comma-separated lists and extract dates
local dateList = splitString(latestDate:gsub(" או ", ","), ",")
if #dateList == 0 then return end
local countSuccess = 0
for i, date in ipairs(dateList) do
local success, DateRes = pcall(Date.newFromWikitext, date)
if success then
dateList[i] = DateRes
countSuccess = countSuccess + 1
end
end
 
if #dateList > 1 and countSuccess == #dateList then
latestDate = dateList[1]
for i, date in ipairs(dateList) do
if i ~= 1 then
local success, DateLeRes = pcall(Date.le, latestDate, date)
if DateLeRes then
latestDate = date
end
end
end
latestDate = os.time(latestDate)
latestDate = os.date("%d %m %Y", latestDate)
end
 
local success, res = pcall(Date.parseDateRange, latestDate, 'raw')
if success==false then return end -- there is no known VALID date
if success==false then return end -- there is no known VALID date
local yearsEstimated = res/(60*60*24*365)
local yearsEstimated = res/(60*60*24*365)
שורה 117: שורה 176:
return false -- no wikidata entity
return false -- no wikidata entity
end
end
if templateArgs[paramName]==nil or templateArgs[paramName]=='' then
if templateArgs[paramName] == nil or templateArgs[paramName] == '' then
templateArgs[paramName] = PropertyLink.getPropertyByOptions( property, infoObj.args.entityId )
templateArgs[paramName] = PropertyLink.getPropertyByOptions( property, infoObj.args.entityId )
if templateArgs[paramName] and #templateArgs[paramName]>0 then
if templateArgs[paramName] and #templateArgs[paramName] > 0 then
usingWikidata = true
usingWikidata = true
end
end
שורה 136: שורה 195:
local function instanceOfViolation(infoObj)
local function instanceOfViolation(infoObj)
local pageNs = mw.title.getCurrentTitle().namespace
local pageNs = mw.title.getCurrentTitle().namespace
if pageNs~=0 then
if pageNs ~= 0 then
return true
return true
end
end
שורה 149: שורה 208:
local matching = WikidataCrossValidation.crossValidate('אדם', 'P31', infoObj.args.entityId )
local matching = WikidataCrossValidation.crossValidate('אדם', 'P31', infoObj.args.entityId )
if matching then
if matching then
mw.logObject(matching)
table.insert(infoObj.wikidataCats, WikidataCrossValidation.maintainceCategory(matching, 'P31'))
table.insert(infoObj.wikidataCats, WikidataCrossValidation.maintainceCategory(matching, 'P31'))
end
end
שורה 155: שורה 213:
wikidataInstanceOf = wikidataInstanceOf.datavalue and wikidataInstanceOf.datavalue.value and wikidataInstanceOf.datavalue.value.id
wikidataInstanceOf = wikidataInstanceOf.datavalue and wikidataInstanceOf.datavalue.value and wikidataInstanceOf.datavalue.value.id
if wikidataInstanceOf ~= 'Q5' then
if wikidataInstanceOf ~= 'Q5' then
table.insert(infoObj.wikidataCats, '[[קטגוריה: ויקינתונים - תבניות אישיות למופע לא מתאים]]')
table.insert(infoObj.wikidataCats, '')
return true
return true
end
end
end
end
return false
return false
end
local function insertInOrder(templateStructure, row)
local inserted = false
for index, existingRow in ipairs(templateStructure) do
if existingRow.indic and existingRow.indic > row.indic then
table.insert(templateStructure, index, row)
inserted = true
break
end
end
if not inserted then
table.insert(templateStructure, row)
end
end
function filterMinorPrizes( propertyVals )
local tempVals = {}
    for i, property in ipairs(propertyVals) do
    local propValue = property.mainsnak and property.mainsnak.datavalue
    if propValue and propValue.value then
    local subGroup =  mw.wikibase.getBestStatements(propValue.value['id'], 'P279')
    local isMinor = false
    for _, p in pairs(subGroup) do
    local subGroupId = p.mainsnak and p.mainsnak.datavalue and p.mainsnak.datavalue.value and p.mainsnak.datavalue.value.id
if subGroupId=='Q11415564' then
isMinor = true
end
end
if not isMinor then
table.insert(tempVals, property)
end
end
end
return tempVals
end
local function useArgsOrWikidata(templateArgs, infoObj, disableWikidataFetch, label, propertyIds, paramName, opts)
    opts = opts or {}
    local content = templateArgs[paramName]
    if disableWikidataFetch then
        if content == nil or content == '' then return end -- No local content, no display
    end
    if content == '-' then return end -- explicitly suppressed
    local row = { label = label }
    if content and content ~= '' then
        row.data = content
        if opts.image == true then
        row.data = dataTemplateModule.getValueOrWikidataImage({
valueArg=content,
width='180'
})
        end
    else
        local values = {}
        if #propertyIds > 0 and not disableWikidataFetch then
            for _, prop in ipairs(propertyIds) do
                local result = PropertyLink.getPropertyByOptions(prop, entityId, {
        allowMulti = opts.multi or false,
        seperator = opts.sep or ', ',
        ['entity-gender-aware'] = opts.genderAware or false,
        qualifiers = opts.qualifiers,
        ['qualifiers-sep'] = opts.qualSep,
        ['default-value'] = opts.qualDefault,
        ['sort'] = opts.sort,
        ['sort-order'] = opts.sortOrder,
        ['img-width'] = '180px',
        ['filter'] = opts.filter
        })
                if result and result ~= '' then
local cleaned_result = mw.ustring.gsub(result, '%[%[%s*[Cc]ategory:[^%[%]]-%]%]', '')
cleaned_result = mw.ustring.gsub(cleaned_result, '%[%[%s*קאטעגאריע:[^%[%]]-%]%]', '')
                if cleaned_result and cleaned_result ~= '' then
                    local valueWithPencil = result .. (opts.pencil ~= false and getPencilLink(entityId, prop) or '')
                    table.insert(values, valueWithPencil)
                end
            end
            end
        end
       
        if #values == 0 then return end
        row.data = table.concat(values, opts.join or '<br/>')
    end
    row.indic = opts.indic or 700
    insertInOrder(infoObj.templateStructure, row)
end
local function isRelogiousLeader(entityId)
local religionLeader = false
if entityId == nil then
return false
end
local religionLeaderQIds ={
--jewish
['Q133485'] = true, -- rav
['Q931732']=true, --posek
--islam
['Q217029'] =true, --kadi
['Q1999841']=true, --faqih
['Q125482']=true, --imam
--christ
['Q152002']=true, -- pastor
['Q49476']=true, -- archbishop
['Q611644']=true, --Catholic bishop
}
local wikidataPosition = mw.wikibase.getBestStatements(entityId, 'P106')
if wikidataPosition then
for _,v in pairs(wikidataPosition) do
if v.mainsnak and v.mainsnak.datavalue and v.mainsnak.datavalue.value.id and religionLeaderQIds[v.mainsnak.datavalue.value.id] then
religionLeader=true
end
end
end
return religionLeader
end
local function addAdditionalDetails(frame, infoObj, wikidataGender, disableWikidataFetch)
local parentArgs = frame:getParent().args
local directArgs = frame.args
local templateArgs = setmetatable({}, { __index = function(_, key)
return directArgs[key] ~= nil and directArgs[key] or parentArgs[key]
end })
local entityId = infoObj.args.entityId
-- Determine the correct label for "Known For" based on gender
local knownForLabel = (wikidataGender == 'נקבה' and 'ידועה בשל' or 'ידוע בשל')
useArgsOrWikidata(templateArgs, infoObj, disableWikidataFetch, 'קבורה', {'P119'}, 'קבורה', {multi=true, pencil=true, indic=5})
useArgsOrWikidata(templateArgs, infoObj, disableWikidataFetch, 'תאריך עלייה', {}, 'תאריך עלייה', {indic=10})
-- Full name
local full_name_content =templateArgs['שם מלא']
local birth_name_content = templateArgs['שם לידה']
if full_name_content and full_name_content ~= '-' then
if (birth_name_content and birth_name_content ~= "-" and full_name_content ~= birth_name_content) or (not birth_name_content) then
useArgsOrWikidata(templateArgs, infoObj, disableWikidataFetch, 'שם מלא', {}, 'שם מלא', {indic=13})
end
end
useArgsOrWikidata(templateArgs, infoObj, disableWikidataFetch, 'שם לידה', {'P1477'}, 'שם לידה', {pencil=true, indic=15})
country_label = templateArgs['סוג ישות'] or 'מדינה'
useArgsOrWikidata(templateArgs, infoObj, disableWikidataFetch, country_label, {'P27'}, 'מדינה', {pencil=true, indic=20})
useArgsOrWikidata(templateArgs, infoObj, disableWikidataFetch, 'לאום', {'P172'}, 'לאום', {pencil=true, indic=22})
useArgsOrWikidata(templateArgs, infoObj, disableWikidataFetch, 'וואוין ארט', {'P551'}, 'וואוין ארט', {multi=true, sep='*', join='*', pencil=true, indic=25})
useArgsOrWikidata(templateArgs, infoObj, disableWikidataFetch, 'כינוי', {'P1449'}, 'כינוי', {pencil=true, indic=30})
useArgsOrWikidata(templateArgs, infoObj, disableWikidataFetch, 'פעילות בולטת', {}, 'פעילות בולטת', {indic=35})
useArgsOrWikidata(templateArgs, infoObj, disableWikidataFetch, knownForLabel, {}, 'ידוע בשל', {indic=40})
useArgsOrWikidata(templateArgs, infoObj, disableWikidataFetch, 'השכלה', {'P69'}, 'השכלה', {multi=true, qualifiers={'P582'}, sort={'P582'}, sortOrder='asc', sep='*', join='*', pencil=true, indic=45})
-- Time range
start_args = templateArgs['התחלת פעילות'] or ''
end_args = templateArgs['סיום פעילות'] or ''
if (not disableWikidataFetch) or (start_args ~= '' and end_args ~= '') then
local timeRangeArgs = {
['תאריך התחלה'] = start_args,
['תאריך סיום'] = end_args,
['הצגת הפרשת זמנים'] = 'כן',
['הווה'] = 'הווה,היום',
['טקסט הווה'] = 'הווה',
['טקסט התחלה'] = 'מ-%s',
['טקסט סיום'] = 'עד ל-%s',
['תאריך התחלה-ויקינתונים'] = 'P2031',
['תאריך סיום-ויקינתונים'] = 'P2032',
['גבול תאריך סיום-ויקינתונים'] = 'P570'
}
local timeRange = TimeRange['טווח זמנים'](frame:newChild{ args = timeRangeArgs })
if timeRange and timeRange ~= '' then
insertInOrder(infoObj.templateStructure, {
label = 'תקופת פעילות',
data = timeRange,
indic = 50
})
end
end
useArgsOrWikidata(templateArgs, infoObj, disableWikidataFetch, 'עיסוק', {}, 'עיסוק', {indic=55})
useArgsOrWikidata(templateArgs, infoObj, disableWikidataFetch, 'מעסיק', {}, 'מעסיק', {indic=60})
useArgsOrWikidata(templateArgs, infoObj, disableWikidataFetch, 'תארים', {'P812', 'P811', 'P512', 'P97', 'P2962'}, 'תואר', {multi=true, pencil=true, indic=65})
useArgsOrWikidata(templateArgs, infoObj, disableWikidataFetch, 'מפלגה', {'P102'}, 'מפלגה', {multi=true, pencil=true, indic=70})
local religionLeader = isRelogiousLeader(entityId)
--deathCauseWikidata = deathCauseWikidata and deathCauseWikidata[1] and deathCauseWikidata[1].mainsnak
useArgsOrWikidata(templateArgs, infoObj, disableWikidataFetch or religionLeader, 'השקפה דתית', {'P140'}, 'השקפה דתית', {pencil=true, indic=75})
-- Spouse + Partner
local spouseVal = templateArgs['מאן'] or templateArgs['ווייב'] or ""
if (not disableWikidataFetch) or spouseVal ~= '' then
if spouseVal ~= '-' then
local output = {}
if spouseVal and spouseVal ~= '' then
table.insert(output, spouseVal)
else
for _, prop in ipairs({'P26', 'P451'}) do
local result = PropertyLink.getPropertyByOptions(prop, entityId, {
allowMulti = true,
seperator = '*',
['entity-gender-aware'] = true,
qualifiers = {'P580', 'P582'},
['qualifiers-sep'] = ' – ',
['default-value'] = '?'
})
if result and result ~= '' then
table.insert(output, result .. getPencilLink(entityId, prop))
end
end
end
if #output > 0 then
insertInOrder(infoObj.templateStructure, {
label = ((templateArgs['מאן']) and 'מאן') or ((templateArgs['ווייב']) and 'ווייב') or 'מאן אדער ווייב',
data = table.concat(output, '\n*'),
indic = 80
})
end
end
end
useArgsOrWikidata(templateArgs, infoObj, disableWikidataFetch, 'קינדער', {'P40'}, 'קינדער', {pencil=true, multi=true, indic=85})
useArgsOrWikidata(templateArgs, infoObj, disableWikidataFetch, 'צאל קינדער', {'P1971'}, 'צאל קינדער', {pencil=true, indic=90})
useArgsOrWikidata(templateArgs, infoObj, disableWikidataFetch, 'פרסים והוקרה', {'P166'}, 'פרסים והוקרה', {multi=true, sep='*', join='*', pencil=true, indic=95, qualifiers={'P585'}, sortOrder = 'desc', filter = filterMinorPrizes})
-- Signature (P109)
useArgsOrWikidata(templateArgs, infoObj, disableWikidataFetch, 'חתימה', {'P109'}, 'חתימה', {pencil=true, image=true, indic=100})
-- Official website (P856)
local siteInput = templateArgs['אתר אינטרנט'] or ""
if (not disableWikidataFetch) or siteInput ~= "" then
local childFrame = frame:newChild{ args = { ['1'] = siteInput } }
local siteVal = siteModule.site(childFrame)
if siteVal and siteVal ~= '' then
insertInOrder(infoObj.templateStructure, {
label,
data = siteVal,
indic = 300
})
end
end
end
end


function addPersonDetails(frame, infoObj)
function addPersonDetails(frame, infoObj)
local templateArgs = frame:getParent().args
local templateArgs = frame:getParent().args
local args = infoObj.args
local disableWikidataFetch = infoObj.args.title == '-'
local usingBirthWikidata = false
local usingBirthWikidata = false
local usingDeathWikidata = false
local usingDeathWikidata = false
local birthLabel = 'לידה'
local birthLabel = 'געבורט'
local deathLabel = 'פטירה'  
local deathLabel = 'פטירה'  
 
infoObj.isNonPerson = instanceOfViolation(infoObj)
infoObj.isNonPerson = instanceOfViolation(infoObj)
local wikidataGender = nil
if not disableWikidataFetch then
if not infoObj.isNonPerson then
-- fill birth/death dates from wikidata if missing and the person is not a human biblical figure
wikidataGender = PropertyLink.getItem( 'P21', infoObj.args.entityId )
--[[
if wikidataGender == nil then
if PropertyLink.getItem('P31', infoObj.args.entityId) ~= "Q20643955" then
table.insert(infoObj.wikidataCats, '[[קטגוריה:אישים חסרי מגדר בוויקינתונים]]')
usingBirthWikidata = fillWikidataParam(templateArgs, 'תאריך לידה', 'P569', infoObj)
else
usingDeathWikidata = fillWikidataParam(templateArgs, 'תאריך פטירה', 'P570', infoObj)
if (wikidataGender == "Q6581097") then -- male
end
wikidataGender = 'זכר'
]]
elseif (wikidataGender == "Q2449503") then -- transgender male
 
wikidataGender = 'זכר'
-- יחידה:אידישע דאטום ווערט פארלוירן מיט יארן בעפאר ד'ק"כ
elseif (wikidataGender == "Q15145778") then -- cisgender male
local genBirthDate = templateArgs['תאריך לידה'] or templateArgs['געבורט דאטום']
wikidataGender = 'זכר'
if genBirthDate == nil and templateArgs['תאריך לידה עברי'] ~= nil then
elseif (wikidataGender == "Q6581072") then -- female
local l = frame:preprocess(templateArgs['תאריך לידה עברי']) -- preprocess, to handle {{לינק צו אידיש יאר}}
wikidataGender = 'נקבה'
if #mw.text.split(l, '%s' ) == 1 or enclosed(l) then --most probably just year or yearlink
elseif (wikidataGender == "Q1052281") then -- transgender female
if #mw.text.split(l, '%s' ) > 1 then
wikidataGender = 'נקבה'
l = l:match("%[%[.-|(.*)%]%]") or l:match("%[%[(.-)%]%]") -- try after pipe first, fallback and get the whole if there is no pipe
elseif (wikidataGender == "Q15145779") then -- cisgender female
end
wikidataGender = 'נקבה'
local birthParts = mw.text.split( l, "'", true )
elseif wikidataGender == 'Q1097630' -- intersex
if #birthParts == 1 then
or wikidataGender == 'Q48270' -- non binary
table.insert(birthParts, 1, '') -- אדער אלף החמישי?
then wikidataGender = '' -- עד שתחליטו
end
local BirthDateNum = gim.gimatria(birthParts[1])*1000 + gim.gimatria(birthParts[2]) - 3760
if BirthDateNum < 1 then
genBirthDate = tostring(math.abs(BirthDateNum)) .. " לפנה\"ס"
elseif BirthDateNum < 4120 then
genBirthDate = tostring(BirthDateNum)
end
end
end
end
end
end
-- fill birth/death dates from wikidata if missing and the person is not a human biblical figure
local genDeathDate = templateArgs['תאריך פטירה'] or templateArgs['פטירה דאטום']
if PropertyLink.getItem( 'P31', infoObj.args.entityId )~="Q20643955" then
if genDeathDate == nil and templateArgs['תאריך פטירה עברי'] ~= nil then
usingBirthWikidata = fillWikidataParam(templateArgs, 'תאריך לידה', 'P569', infoObj)
local p = frame:preprocess(templateArgs['תאריך פטירה עברי']) -- preprocess, to handle {{לינק צו אידיש יאר}}
usingDeathWikidata = fillWikidataParam(templateArgs, 'תאריך פטירה', 'P570', infoObj)
if #mw.text.split(p, '%s' ) == 1 or enclosed(p) then --most probably just year or yearlink
if #mw.text.split(p, '%s' ) > 1 then
p = p:match("%[%[.-|(.*)%]%]") or p:match("%[%[(.-)%]%]") -- try after pipe first, fallback and get the whole if there is no pipe
end
local deathParts = mw.text.split( p, "'", true )
if #deathParts == 1 then
table.insert(deathParts, 1, '') -- אדער אלף החמישי?
end
local DeathDateNum = gim.gimatria(deathParts[1])*1000 + gim.gimatria(deathParts[2]) - 3760
if DeathDateNum < 1 then
genDeathDate = tostring(math.abs(DeathDateNum)) .. " לפנה\"ס"
elseif DeathDateNum < 4120 then
genDeathDate = tostring(DeathDateNum)
end
end
end
end
local birthDate = getSpeculativeDate(templateArgs['תאריך לידה'], templateArgs['תאריך לידה עברי'])
local birthDate = getSpeculativeDate(genBirthDate, templateArgs['תאריך לידה עברי'])
local deathDate = getSpeculativeDate(templateArgs['תאריך פטירה'], templateArgs['תאריך פטירה עברי'])
local deathDate = getSpeculativeDate(genDeathDate, templateArgs['תאריך פטירה עברי'])
if birthDate ~= nil then
local age = nil
if deathDate == nil and not templateArgs['ללא גיל'] then
age = ageModule.ageCalc(birthDate, nil, true, false, true, nil, wikidataGender) or ''
end
local birthDetails, usingBirthWikidataEvent = getEventDetails(templateArgs['תאריך לידה'] or templateArgs['געבורט דאטום'], templateArgs['תאריך לידה עברי'], templateArgs['מקום לידה'] or templateArgs['געבורט ארט'], 'P569', 'P19', age, usingBirthWikidata, infoObj)
table.insert(infoObj.templateStructure, 1, {
label = birthLabel,
data = birthDetails
})
usingBirthWikidata = usingBirthWikidata or usingBirthWikidataEvent
elseif templateArgs['געבורט ארט'] ~= '-' then
fillWikidataParam(templateArgs, 'געבורט ארט', 'P19', infoObj)
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
deathLabel = getDeathLabel(templateArgs['סיבת המוות'], infoObj.args.entityId, wikidataGender)
if deathDate ~= nil then
if birthDate~=nil then
local age = ''
local age = nil
if not templateArgs['ללא גיל'] then
if deathDate==nil then
age = ageModule.ageCalc(birthDate, deathDate, false, false, true) or ''
age = ageModule.ageCalc(birthDate, nil, true, false, true, nil, wikidataGender) or ''
end
local deathDetails, usingDeathWikidataEvent = getEventDetails(templateArgs['תאריך פטירה'] or templateArgs['פטירה דאטום'], templateArgs['תאריך פטירה עברי'], templateArgs['מקום פטירה'] or templateArgs['פטירה ארט'], 'P570', 'P20', age, usingDeathWikidata, infoObj)
table.insert(infoObj.templateStructure, 2, {
label=deathLabel,
data=deathDetails
})
usingDeathWikidata = usingDeathWikidata or usingDeathWikidataEvent
elseif templateArgs['פטירה ארט'] ~= '-' then
fillWikidataParam(templateArgs, 'פטירה ארט', 'P20', infoObj)
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
local birthDetails, usingBirthWikidataEvent = getEventDetails(templateArgs['תאריך לידה'], templateArgs['תאריך לידה עברי'], templateArgs['מקום לידה'], 'P569', 'P19', age, usingBirthWikidata, infoObj)
table.insert(infoObj.templateStructure, 1, {
if infoObj.isSelfUse then
label=birthLabel,
data=birthDetails
})
usingBirthWikidata = usingBirthWikidata or usingBirthWikidataEvent
elseif templateArgs['מקום לידה']~= '-' then
fillWikidataParam(templateArgs, 'מקום לידה', 'P19', infoObj)
if  templateArgs['מקום לידה']~= nil and templateArgs['מקום לידה']~= '' then -- only if we fill the parameter eventually - add to template
table.insert(infoObj.templateStructure, 1, {
table.insert(infoObj.templateStructure, 1, {
label=birthLabel,
label=birthLabel,
data= templateArgs['מקום לידה']
data='{{{תאריך לידה}}}<br/>{{{געבורט ארט}}}'
})
})
end
end
deathLabel = getDeathLabel(templateArgs['סיבת המוות'], infoObj.args.entityId, wikidataGender)
if deathDate~=nil then
local age =  ageModule.ageCalc(birthDate, deathDate, false, false, true) or ''
local deathDetails, usingDeathWikidataEvent = getEventDetails(templateArgs['תאריך פטירה'], templateArgs['תאריך פטירה עברי'], templateArgs['מקום פטירה'], 'P570', 'P20', age, usingDeathWikidata, infoObj)
table.insert(infoObj.templateStructure, 2, {
label=deathLabel,
data=deathDetails
})
usingDeathWikidata = usingDeathWikidata or usingDeathWikidataEvent
elseif templateArgs['מקום פטירה']~= '-' then
fillWikidataParam(templateArgs, 'מקום פטירה', 'P20', infoObj)
if templateArgs['מקום פטירה']~= nil and templateArgs['מקום פטירה']~= '' then -- only if we fill the parameter eventually - add to template
table.insert(infoObj.templateStructure, 2, {
table.insert(infoObj.templateStructure, 2, {
label=deathLabel,
label=deathLabel,
data= templateArgs['מקום פטירה']
data='{{{תאריך פטירה}}}<br/>{{{פטירה ארט}}}'
})
})
end
if usingBirthWikidata or usingDeathWikidata then
infoObj.args.usingWikidata = true
end
end
end
if frame.args['כותרת0'] then
if infoObj.isSelfUse then
table.insert(infoObj.templateStructure, 1, {
table.insert(infoObj.templateStructure, 1, {
label=birthLabel,
header=1,
data='{{{תאריך לידה}}}<br/>{{{מקום לידה}}}'
data=frame.args['כותרת0'],
rowstyle=frame.args['עיצוב-שורה0'],
rowclass=frame.args['מחלקה-שורה0'],
headerstyle=frame.args['כותרת0-עיצוב']
})
})
table.insert(infoObj.templateStructure, 2, {
end
label=deathLabel,
data='{{{תאריך פטירה}}} <br/>{{{מקום פטירה}}}'
})
end
if usingBirthWikidata or usingDeathWikidata then
--[[
infoObj.args.usingWikidata = true
if frame.args['תמונה'] ~= '-' then
addMissingImage(infoObj, birthDate, deathDate, wikidataGender)
end
]]
end
end
if frame.args['כותרת0'] then
addAdditionalDetails(frame, infoObj, wikidataGender, disableWikidataFetch)
table.insert(infoObj.templateStructure, 1, {
header=1,
data=frame.args['כותרת0'],
rowstyle=frame.args['עיצוב-שורה0'],
rowclass=frame.args['מחלקה-שורה0'],
headerstyle=frame.args['כותרת0-עיצוב']
})
end
 
if frame.args['תמונה']~='-' then
addMissingImage(infoObj, birthDate, deathDate, wikidataGender)
end
end
end


function infobox(frame)
function infobox(frame)
local infoObj = Infobox:new()
local infoObj = Infobox:new()
frame.args['תמונה-גודל'] = frame.args['תמונה-גודל'] or '220'
frame.args['תמונה-גודל'] = frame.args['תמונה-גודל'] or '220'
 
local colorKey = frame.args["סיווג"] or frame.args["סוג"] or frame:getParent().args["סיווג"] or frame:getParent().args["סוג"]
local color = BackgroundColors[colorKey] or BackgroundColors["default"] or "#eeeeee"
 
infoObj.args.headerstyle = "background:" .. color .. ";" .. (infoObj.args.headerstyle or "")
local is_white_text = BackgroundColors[colorKey] == '#000000' or BackgroundColors[colorKey] == '#800000'
local header_style = "background:" .. color .. "; border:1px solid #aaaaaa; border-bottom:0px; color:" .. (is_white_text and 'white' or 'black')
frame.args['כותרת-עיצוב'] = header_style .. ";" .. (frame.args['כותרת-עיצוב'] or "")
frame.args['כותרת תבנית-עיצוב'] = header_style .. ";" .. (frame.args['כותרת תבנית-עיצוב'] or "")
frame.args['תת-כותרת תבנית-עיצוב'] = header_style .. ";" .. (frame.args['תת-כותרת תבנית-עיצוב'] or "")
infoObj:parseArgs(frame)
infoObj:parseArgs(frame)
 
if infoObj.args.title~='-' then
addPersonDetails(frame, infoObj)
addPersonDetails(frame, infoObj)
 
end
return infoObj:render()
return infoObj:render()
end
end


return {
return {