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

משתמש:IKhitron/טיוטה
אין תקציר עריכה
שורה 241: שורה 241:
end
end


function findhdatetype(hdate)
function fromhebrew1()
local rem = mw.text.trim(remove(hdate))
local rem = mw.text.trim(remove(frame.args[1]))
if rem == ""
then return "empty", rem end
if ifabout(rem)
then return "about", rem end
for m, mm in pairs(monthtable) do
for m, mm in pairs(monthtable) do
if find1(rem, m) == 1 then
if find1(rem, m) == 1 then
return "my", rem end
return ifwhich(fromhebrewmonth(rem)) end
end
end
if rem == "ה' אלפים" then if frame.args["exact"] ~= "כן"
then return ifwhich("1239-1240") else return ifwhich(1240) end end -- here
if find1(rem, " ") == 0 then
if find1(rem, " ") == 0 then
return "y", rem end
return ifwhich(fromhebrewyear(rem)) end
return "dmy", rem
return ifwhich(fromhebrewdate(rem, to))
end
 
function fromhebrew1()
if rem == "[[ה' אלפים]]" then if frame.args["exact"] ~= "כן"
then return ifwhich("1239-1240") else return ifwhich(1240) end end -- here
local w, rem = findhdatetype(frame.args[1])
if w == "dmy"
then return ifwhich(fromhebrewdate(rem, to))
elseif w == "my"
then ifwhich(fromhebrewmonth(rem))
elseif w == "y"
then return ifwhich(fromhebrewyear(rem))
else error("Wrong type") end
end
end


שורה 279: שורה 264:
which = false
which = false
return fromhebrewandverify(f)
return fromhebrewandverify(f)
end
function ifabout(adate)
return frame:expandTemplate({title = "גיל לערכי אישים/מקורב", args = {str = adate}}) ~= ""
end
end


function fromhebrewandverify(f)
function fromhebrewandverify(f)
frame = f
frame = f
if frame.args["about"] == "כן" and ifabout(frame.args[1])
if frame.args["about"] == "כן" and
frame:expandTemplate({title = "גיל לערכי אישים/מקורב", args = {str = frame.args[1]}}) ~= ""
then return ifwhich(frame.args[1], "[[קטגוריה:דפים עם תאריך עברי מקורב]]") end
then return ifwhich(frame.args[1], "[[קטגוריה:דפים עם תאריך עברי מקורב]]") end
local success, res = pcall(fromhebrew1)
local success, res = pcall(fromhebrew1)
שורה 343: שורה 325:
function findwdatetype(wdate)
function findwdatetype(wdate)
local rem = mw.text.trim(remove(wdate))
local rem = mw.text.trim(remove(wdate))
if rem == ""
if find1(rem, "-") ~= 0 then
then return "empty", rem end
return "num", rem end
if ifabout(rem)
then return "about", rem end
if find1(rem, "-") ~= 0
then return "num", rem end
for m, mm in pairs(mtable) do
for m, mm in pairs(mtable) do
if find1(rem, mm) == 1
if find1(rem, mm) == 1 then
then return "my", rem end
return "my", rem end
end
end
if tonumber(rem) ~= nil and tonumber(rem) .. "" == rem then
if tonumber(rem) ~= nil and tonumber(rem) .. "" == rem then