יחידה:תבנית מידע/אישיות
מתוך ויקיפדיה, האנציקלופדיה החופשית
פעולות נוספות
יחידה זו מרחיבה את יחידה:תבנית מידע עבור תבניות מידע של אישים. היחידה כוללת תמיכה אוטומטית בפרמטרים האופיינים לאישים כדוגמת תמונה, תאריכי לידה/פטירה ומקומות של לידה/פטירה, יחד עם חישוב גיל.
-- [Pinkas] Wikibase Client is not installed; route mw.wikibase through a local no-op stub
-- so Wikidata-backed fields degrade to nil/empty instead of raising Lua errors. No external
-- data is ever fetched. See [[Module:Wikibase-stub]].
if not mw.wikibase then mw.wikibase = require( 'Module:Wikibase-stub' ) end
local dataTemplateModule = require('Module:תבנית מידע')
local Infobox = dataTemplateModule.Infobox
local BackgroundColors = mw.loadJsonData('Module:תבנית מידע/אישיות/צבע רקע לפי סיווג.json')
local LocationAndCountry = require('Module:LocationAndCountry')
local PropertyLink = require('Module:PropertyLink')
local ageModule = require('Module:גיל לערכי אישים')
local Date = require('Module:תאריך')
local hebrewDateModule = require('Module:תאריך עברי')
local WikidataCrossValidation = require('Module:WikidataCrossValidation')
local siteModule = require('Module:תבנית מידע/אתר')
local TimeRange = require('Module:טווח זמנים')
--[[ Get general date if known, otherwise guess from hebrew date.
]]
function getSpeculativeDate(generalDate, hebrewDate)
if generalDate == '-' then return nil end
if generalDate ~= nil and generalDate ~= '' then return generalDate end
if hebrewDate ~= nil and hebrewDate ~= '' then
local success, sepcDate = pcall(hebrewDateModule.pick, mw.getCurrentFrame():newChild{ args = {hebrew=hebrewDate, world='', exact='כן' } })
if not success or sepcDate == '' then return nil end
return sepcDate
end
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
local function getDeathLabel(deathCause, entityId, gender)
local result=''
local fromWikidata=nil
entityId = entityId or mw.wikibase.getEntityIdForCurrentPage()
if ( deathCause == nil or deathCause == '' ) and entityId ~= nil then
local deathCauseWikidata = mw.wikibase.getBestStatements(entityId, 'P1196')
deathCauseWikidata = deathCauseWikidata and deathCauseWikidata[1] and deathCauseWikidata[1].mainsnak
if deathCauseWikidata then
deathCause = mw.wikibase.renderSnak(deathCauseWikidata)
fromWikidata=true
end
end
if deathCause and deathCause ~= '' then
if deathCause == 'נהרג' or deathCause == 'נהרגה' or deathCause == 'מוות בקרב' or deathCause == 'נהרג בקרב' or deathCause == 'נהרגה בקרב' or deathCause == 'תאונה' or deathCause == 'טביעה' then
return (gender=='נקבה' and 'נהרגה') or 'נהרג'
elseif deathCause == 'נעדר' or deathCause == 'נעדרת' then
return (gender=='נקבה' and 'נעדרת') or 'נעדר'
elseif deathCause == 'נרצח' or deathCause == 'נרצחה' or deathCause == 'רצח' or deathCause == 'רצח המוני' or deathCause == 'רעל' then
return (gender=='נקבה' and 'נרצחה') or 'נרצח'
elseif deathCause == 'התאבד' or deathCause == 'התאבדה' or deathCause == 'התאבדות' then
return (gender=='נקבה' and 'התאבדה') or 'התאבד'
elseif deathCause == 'הוצא להורג' or deathCause == 'הוצאה להורג' or deathCause == 'עונש מוות' or deathCause == 'תלייה' then
return 'הוצאה להורג'
elseif not fromWikidata then result = mw.title.getCurrentTitle().namespace == 0 and '[[קטגוריה:ערכים עם סיבת מוות שגויה בתבנית]]' or ''
end
end
return result .. 'פטירה'
end
function getEventDetails(generalDate, hebDate, eventPlace, propDate, propPlace, age, usingWikidata, infoObj)
entityId = infoObj.args.entityId or mw.wikibase.getEntityIdForCurrentPage()
age = age or ''
local formattedEvent
local placeDate = propDate
if generalDate ~= nil and generalDate ~= '' then
local success, placeDateParsed = pcall(Date.newFromWikitext, generalDate)
if success then
placeDate = placeDateParsed
end
formattedEvent = generalDate .. age
if hebDate ~= nil and hebDate ~= '' then
formattedEvent = formattedEvent .. '<br/>' .. hebDate
end
elseif hebDate ~= nil and hebDate ~= '' then
formattedEvent = hebDate .. age
end
if (eventPlace == nil or eventPlace == '') and entityId then
local success, res = pcall(LocationAndCountry.displayFromParams, propPlace, entityId, placeDate , 1)
if success and res and #res > 0 then
usingWikidata = true
eventPlace = res
end
else
local pageNs = mw.title.getCurrentTitle().namespace
if pageNs==0 and not infoObj.isNonPerson then
local matching = WikidataCrossValidation.crossValidate(eventPlace, propPlace, entityId)
if matching then
table.insert(infoObj.wikidataCats, WikidataCrossValidation.maintainceCategory(matching, propPlace))
end
end
end
if eventPlace~='' and eventPlace~=nil and eventPlace~='-' then
formattedEvent = formattedEvent..'<br/>' ..eventPlace
end
if usingWikidata and entityId then
formattedEvent = formattedEvent .. getPencilLink(entityId, 'P856')
end
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
function addMissingImage(infoObj, birthDate, deathDate, gender)
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
if latestDate == nil then return end
-- 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
local yearsEstimated = res/(60*60*24*365)
if yearsEstimated>150 then return end
local frame = mw.getCurrentFrame()
infoObj.args.image = frame:expandTemplate{ title = 'אין תמונה', args = { gender, ['יישור'] = 'מרכז' } }
end
function fillWikidataParam(templateArgs, paramName, property, infoObj, opts)
local usingWikidata = false
if infoObj.args.entityId == nil then
local matching = WikidataCrossValidation.crossValidate(templateArgs[paramName], property, infoObj.args.entityId )
if matching then
table.insert(infoObj.wikidataCats, WikidataCrossValidation.maintainceCategory(matching, property))
end
return false -- no wikidata entity
end
if templateArgs[paramName] == nil or templateArgs[paramName] == '' then
opts = opts or {}
templateArgs[paramName] = PropertyLink.getPropertyByOptions(property, infoObj.args.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 templateArgs[paramName] and #templateArgs[paramName] > 0 then
usingWikidata = true
end
else
local pageNs = mw.title.getCurrentTitle().namespace
if pageNs==0 and not infoObj.isNonPerson then
local matching = WikidataCrossValidation.crossValidate(templateArgs[paramName], property, infoObj.args.entityId )
if matching then
table.insert(infoObj.wikidataCats, WikidataCrossValidation.maintainceCategory(matching, property))
end
end
end
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
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
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 content == '-' then return end -- explicitly suppressed
if ((content == nil or content == '') and opts.blockedByPlus ~= true) or (content == "+" and opts.blockedByPlus) then
if not disableWikidataFetch and (#propertyIds > 0) then
local values = {}
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-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
if #values == 0 then return end
content = table.concat(values, opts.join or '<br/>')
end
else
local pageNs = mw.title.getCurrentTitle().namespace
if pageNs==0 and not infoObj.isNonPerson and #propertyIds==1 then
local matching = WikidataCrossValidation.crossValidate(content, propertyIds[1], infoObj.args.entityId )
if matching then
table.insert(infoObj.wikidataCats, WikidataCrossValidation.maintainceCategory(matching, propertyIds[1]))
end
end
end
local row = { label = label }
row.data = content
if opts.image == true then
row.data = dataTemplateModule.getValueOrWikidataImage({
valueArg=content,
width='180px'
})
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 renderFirstQualifier(statement, pid)
local qs = statement and statement.qualifiers
local arr = qs and qs[pid]
local snak = arr and arr[1]
if not snak then return '' end
local ok, val = pcall(mw.wikibase.renderSnak, snak)
return (ok and val) or ''
end
local function renderTimeRangeFromStatement(frame, statement)
local startVal = renderFirstQualifier(statement, 'P580')
local endVal = renderFirstQualifier(statement, 'P582')
if startVal == '' and endVal == '' then
return ''
end
local timeRangeArgs = {
['תאריך התחלה'] = startVal,
['תאריך סיום'] = endVal,
['הצגת הפרשת זמנים'] = 'כן',
['הווה'] = 'הווה,היום',
['טקסט הווה'] = 'הווה',
['טקסט התחלה'] = 'מ-%s',
['טקסט סיום'] = 'עד ל-%s',
}
local tr = TimeRange['טווח זמנים'](frame:newChild{ args = timeRangeArgs })
return tr or ''
end
local function renderPartnerLine(frame, prop, entityId, statement)
-- שם/קישור של בן/בת הזוג עצמו/ה
local person = ''
if statement and statement.mainsnak then
local ok, v = pcall(mw.wikibase.formatValue, statement.mainsnak)
if ok and v then person = v end
end
if person == '' or person == 'אין ערך' then return '' end
local tr = renderTimeRangeFromStatement(frame, statement)
if tr ~= '' then
person = person .. ' <small><span class="nowrap">(' .. tr .. ')</span></small>'
end
return person .. getPencilLink(entityId, prop)
end
function getWikidataGender(infoObj, entityId, isPerson, missingCat)
local wikidataGender = PropertyLink.getItem( 'P21', entityId )
if isPerson then
if wikidataGender == nil then
table.insert(infoObj.wikidataCats, missingCat)
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 == "Q121307100") then -- intersex woman
wikidataGender = 'נקבה'
elseif wikidataGender == 'Q1097630' -- intersex
or wikidataGender == 'Q48270' -- non binary
then wikidataGender = '' -- עד שתחליטו
end
end
else
if (wikidataGender == "Q44148") then -- male (animal or plant)
wikidataGender = 'זכר'
elseif (wikidataGender == "Q43445") then -- female (animal or plant)
wikidataGender = 'נקבה'
end
end
return wikidataGender
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 ~= '-') or (not 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 = 'מדינה'
if templateArgs['סוג ישות'] ~= nil and templateArgs['סוג ישות'] ~= '' then
country_label = templateArgs['סוג ישות'] .. '[[קטגוריה:דפים עם סוג ישות]]'
end
useArgsOrWikidata(templateArgs, infoObj, disableWikidataFetch, country_label, {'P27'}, 'מדינה', {multi=true, pencil=true, indic=20})
-- Residence - only show if different from country
local residence_content = templateArgs['מקום מגורים']
local country_content = templateArgs['מדינה']
if (residence_content and residence_content ~= '-') or (not residence_content) then
if (country_content and country_content ~= "-" and residence_content ~= country_content) or (not country_content) then
useArgsOrWikidata(templateArgs, infoObj, disableWikidataFetch, 'מקום מגורים', {'P551'}, 'מקום מגורים', {multi=true, sep='*', join='*', pencil=true, indic=25})
end
end
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, 'עיסוק', {'P106'}, 'עיסוק', {multi=true, pencil=true, blockedByPlus=true, indic=55})
useArgsOrWikidata(templateArgs, infoObj, disableWikidataFetch, 'מעסיק', {'P108'}, 'מעסיק', {multi=true, pencil=true, blockedByPlus=true, 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 ""
local spouseLabel = 'בן או בת זוג'
if (not disableWikidataFetch) or spouseVal ~= '' then
if spouseVal ~= '-' then
local output = {}
if spouseVal and spouseVal ~= '' then
table.insert(output, spouseVal)
else
local entityId = infoObj.args.entityId or mw.wikibase.getEntityIdForCurrentPage()
if entityId then
for _, prop in ipairs({ 'P26', 'P451' }) do
local statements = mw.wikibase.getBestStatements(entityId, prop) or {}
for i_st, st in ipairs(statements) do
local wikidataGender = nil
if st and st.mainsnak and st.mainsnak.datavalue and st.mainsnak.datavalue.value and st.mainsnak.datavalue.value.id then
wikidataGender = getWikidataGender(infoObj, st.mainsnak.datavalue.value.id, not infoObj.isNonPerson, '[[קטגוריה:ויקינתונים - בני זוג חסרי מגדר בוויקינתונים]]')
end
if i_st==1 then
if wikidataGender == 'נקבה' then
spouseLabel ='בת זוג'
elseif wikidataGender == 'זכר' then
spouseLabel ='בן זוג'
end
else
if wikidataGender == 'נקבה' and spouseLabel =='בת זוג' then
spouseLabel ='בנות זוג'
elseif wikidataGender == 'זכר' and spouseLabel =='בן זוג' then
spouseLabel ='בני זוג'
elseif (wikidataGender == 'נקבה' and spouseLabel =='בן זוג') or (wikidataGender == 'זכר' and spouseLabel =='בת זוג') then
spouseLabel ='בן או בת זוג'
end
end
local line = renderPartnerLine(frame, prop, entityId, st)
if line ~= '' then
table.insert(output, line)
end
end
end
end
end
if #output > 0 then
insertInOrder(infoObj.templateStructure, {
label = ((templateArgs['בן זוג']) and 'בן זוג') or ((templateArgs['בת זוג']) and 'בת זוג') or spouseLabel,
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='*', genderAware=true, pencil=true, indic=95, qualifiers={'P585'}, sortOrder = 'desc', filter = filterMinorPrizes})
-- Signature (P109)
useArgsOrWikidata(templateArgs, infoObj, disableWikidataFetch, 'חתימה', {'P109'}, 'חתימה', {pencil=true, image=true, indic=100})
-- Media
local mediaInput = templateArgs['מדיה']
if not mediaInput or mediaInput == "" then
-- use the media template as fallback
nameArg = templateArgs['שם']
if (not nameArg) or nameArg == "" then
nameArg = mw.title.getCurrentTitle().text
end
mediaInput = frame:expandTemplate{
title = "מדיה",
args = {
['תיאור'] = "הקול של " .. nameArg
}
}
end
if (not disableWikidataFetch) or (mediaInput ~= "-" and mediaInput ~= "") then
insertInOrder(infoObj.templateStructure, {
label,
data = mediaInput,
indic = 295
})
end
-- 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
function addPersonDetails(frame, infoObj)
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 disableWikidataFetch = templateArgs['שם'] == '-'
local usingBirthWikidata = false
local usingDeathWikidata = false
local birthLabel = 'לידה'
local deathLabel = 'פטירה'
infoObj.isNonPerson = instanceOfViolation(infoObj)
local wikidataGender = getWikidataGender(infoObj, infoObj.args.entityId, not infoObj.isNonPerson, '[[קטגוריה:אישים חסרי מגדר בוויקינתונים]]')
if not disableWikidataFetch then
-- 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 deathDate = getSpeculativeDate(templateArgs['תאריך פטירה'], 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['תאריך לידה'], templateArgs['תאריך לידה עברי'], templateArgs['מקום לידה'], 'P569', 'P19', age, usingBirthWikidata, infoObj)
insertInOrder(infoObj.templateStructure, {
label = birthLabel,
data = birthDetails,
indic = 1
})
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
insertInOrder(infoObj.templateStructure, {
label = birthLabel,
data = templateArgs['מקום לידה'],
indic = 1
})
end
end
deathLabel = getDeathLabel(templateArgs['סיבת המוות'], infoObj.args.entityId, wikidataGender)
if deathDate ~= nil then
local age = ''
if not templateArgs['ללא גיל'] then
age = ageModule.ageCalc(birthDate, deathDate, false, false, true) or ''
end
local deathDetails, usingDeathWikidataEvent = getEventDetails(templateArgs['תאריך פטירה'], templateArgs['תאריך פטירה עברי'], templateArgs['מקום פטירה'], 'P570', 'P20', age, usingDeathWikidata, infoObj)
insertInOrder(infoObj.templateStructure, {
label = deathLabel,
data = deathDetails,
indic = 2
})
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
insertInOrder(infoObj.templateStructure, {
label = deathLabel,
data = templateArgs['מקום פטירה'],
indic = 2
})
end
end
if infoObj.isSelfUse then
insertInOrder(infoObj.templateStructure, {
label=birthLabel,
data='{{{תאריך לידה}}}<br/>{{{מקום לידה}}}',
indic = 1
})
insertInOrder(infoObj.templateStructure, {
label=deathLabel,
data='{{{תאריך פטירה}}}<br/>{{{מקום פטירה}}}',
indic = 2
})
end
if usingBirthWikidata or usingDeathWikidata then
infoObj.args.usingWikidata = true
end
if frame.args['כותרת0'] then
insertInOrder(infoObj.templateStructure, {
header=1,
data=frame.args['כותרת0'],
rowstyle=frame.args['עיצוב-שורה0'],
rowclass=frame.args['מחלקה-שורה0'],
headerstyle=frame.args['כותרת0-עיצוב'],
indic = 1
})
end
if frame.args['תמונה'] ~= '-' then
addMissingImage(infoObj, birthDate, deathDate, wikidataGender)
end
end
addAdditionalDetails(frame, infoObj, wikidataGender, disableWikidataFetch)
end
function infobox(frame)
local infoObj = Infobox:new()
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)
addPersonDetails(frame, infoObj)
return infoObj:render()
end
return {
['מידע']=infobox,
['addPersonDetails'] = addPersonDetails
}