יחידה:גיל לערכי אישים: הבדלים בין גרסאות בדף

מאין תקציר עריכה
מאין תקציר עריכה
שורה 35: שורה 35:
DisplayForDead = (DisplayForDead=='כן')
DisplayForDead = (DisplayForDead=='כן')
Brackets = (Brackets~='לא')
Brackets = (Brackets~='לא')
local entity = mw.wikibase.getEntityObject()
if BirthDate=='' or BirthDate==nil then
-- pull the birth date from wikidata
if entity and entity.claims and entity.claims['P569'] then
BirthDate=entity:formatPropertyValues( 'P569' ).value
end
end
-- validate dates are valid
if BirthDate==nil or BirthDate=='' then
return -- missing date, nothing to do
end
if DeathDate=='' or DeathDate==nil then
-- pull the death date from wikidata
if entity and entity.claims and entity.claims['P570'] then
DeathDate = entity:formatPropertyValues( 'P570' ).value
end
end
local IsDead = (DeathDate~=nil and DeathDate~='')
local IsDead = (DeathDate~=nil and DeathDate~='')
שורה 41: שורה 61:
if (DisplayForDead~=IsDead) or (DisplayForAlive==IsDead) then
if (DisplayForDead~=IsDead) or (DisplayForAlive==IsDead) then
return ''
return ''
end
-- validate dates are valid
if BirthDate==nil or BirthDate=='' then
return -- missing date, nothing to do
end
end