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

מכלוליזאציע
אין תקציר עריכה
(מכלוליזאציע)
שורה 23: שורה 23:
local result=''
local result=''
local fromWikidata=nil
local fromWikidata=nil
entityId = entityId or mw.wikibase.getEntityIdForCurrentPage()
entityId = entityId
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')
שורה 50: שורה 50:
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 = infoObj.args.entityId
age = age or ''
age = age or ''
local formattedEvent
local formattedEvent
שורה 95: שורה 95:


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
return
local latestDate = deathDate or birthDate
if latestDate == nil then return end
local dateModule = require('Module:תאריך')
local success, res = pcall(dateModule.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
end


שורה 155: שורה 145:
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
שורה 175: שורה 165:
wikidataGender = PropertyLink.getItem( 'P21', infoObj.args.entityId )
wikidataGender = PropertyLink.getItem( 'P21', infoObj.args.entityId )
if wikidataGender == nil then
if wikidataGender == nil then
table.insert(infoObj.wikidataCats, '[[קאטעגאריע:אישים חסרי מגדר בוויקינתונים]]')
table.insert(infoObj.wikidataCats, '')
else
else
if (wikidataGender == "Q6581097") then -- male
if (wikidataGender == "Q6581097") then -- male