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

דא איז דער לאך. קרויז אויס אידישע דאטום צו רעכענען אויך בעפאר קביעת הלוח
אין תקציר עריכה
(דא איז דער לאך. קרויז אויס אידישע דאטום צו רעכענען אויך בעפאר קביעת הלוח)
שורה 6: שורה 6:
local hebrewDateModule = require('Module:אידישע דאטום')
local hebrewDateModule = require('Module:אידישע דאטום')
local WikidataCrossValidation = require('Module:WikidataCrossValidation')
local WikidataCrossValidation = require('Module:WikidataCrossValidation')
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


--[[ Get general date if known, otherwise guess from hebrew date.
--[[ Get general date if known, otherwise guess from hebrew date.
שורה 200: שורה 209:
end
end
local birthDate = getSpeculativeDate(templateArgs['תאריך לידה'] or templateArgs['געבורט דאטום'], templateArgs['תאריך לידה עברי'])
-- יחידה:אידישע דאטום ווערט פארלוירן מיט יארן בעפאר ד'ק"כ
local deathDate = getSpeculativeDate(templateArgs['תאריך פטירה'] or templateArgs['פטירה דאטום'], templateArgs['תאריך פטירה עברי'])
local genBirthDate = templateArgs['תאריך לידה'] or templateArgs['געבורט דאטום']
if genBirthDate == nil and templateArgs['תאריך לידה עברי'] ~= nil then
local l = frame:preprocess(args['תאריך לידה עברי']) -- preprocess, to handle {{לינק צו אידיש יאר}}
if (#mw.text.split(l, '%s' ) == 1 or count(l, "%[%[") == 1) then --most probably just year or yearlink
if #mw.text.split(l, '%s' ) > 1 then
l = l:match("%[%[.-|(.*)%]%]")
end
local birthParts = mw.text.split( l, "'", true )
if #birthParts == 1 then
table.insert(birthParts, 1, 0) -- אדער אלף החמישי?
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
local genDeathDate = templateArgs['תאריך פטירה'] or templateArgs['פטירה דאטום']
if genDeathDate == nil and templateArgs['תאריך פטירה עברי'] ~= nil then
local p = frame:preprocess(args['תאריך פטירה עברי']) -- preprocess, to handle {{לינק צו אידיש יאר}}
if (#mw.text.split(p, '%s' ) == 1 or count(p, "%[%[") == 1) then --most probably just year or yearlink
if #mw.text.split(p, '%s' ) > 1 then
p = p:match("%[%[.-|(.*)%]%]")
end
local deathParts = mw.text.split( p, "'", true )
if #deathParts == 1 then
table.insert(deathParts, 1, 0) -- אדער אלף החמישי?
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
local birthDate = getSpeculativeDate(genBirthDate, templateArgs['תאריך לידה עברי'])
local deathDate = getSpeculativeDate(genDeathDate, templateArgs['תאריך פטירה עברי'])
if birthDate~=nil then
if birthDate~=nil then