דער מאדול קביעות נעמט אריין א נומער פון א יאר, און געבט די דריי אותיות סימן פון די קביעות דערפון.

ביישפילן:

  1. {{#invoke:קביעות|סימן|5785}} => השא
  2. {{#invoke:קביעות|סימן|5763}} => זשה
  3. {{#invoke:קביעות|סימן|2450}} => גכה

local p = {}

-- פונקציית עזר – החזרת אות בעברית או מספר
local function gim(n)
    local a = "אבגדהוזחכש"
    if n > 11 then return tostring(n) end
    return mw.ustring.sub(a, n, n)
end

-- הפונקציה הראשית: מקבלת שנה עברית ומחזירה סימן (למשל "כז*")
 p["סימן"] = function(frame)
    local Y = tonumber(frame.args[1]) or tonumber(frame:getParent().args[1])
    if not Y or Y <= 0 then return "שנה לא תקפה" end
    local b = 38004 + 765433 * math.floor((235 * Y - 234) / 19)
    local d = math.floor(b / 25920)
    local i = b % 25920
    local f = 1 + (d % 7)
    local g = math.floor(((7 * Y + 13) % 19) / 12)
    local h = math.floor(((7 * Y + 6) % 19) / 12)

    if (i >= 16404 and f == 3 and g == 0) or (i >= 23269 and f == 2 and h == 1) then
        d = d + 1
        i = i - 25920
    end

    local j1 = d + ((d + 5) % 7) % 2

    b = i + 9516 + (39673 * g)
    d = d + math.floor(b / 25920) + 354 + 28 * g
    i = b % 25920
    f = 1 + (d % 7)
    h = math.floor(((7 * Y + 1) % 19) / 12)

    if (i >= 16404 and f == 3 and h == 0) or (i >= 23269 and f == 2 and g == 1) then
        d = d + 1
    end

    local j2 = d + ((d + 5) % 7) % 2

    local s = gim(j1 % 7 + 1)
           .. gim((j2 - j1) % 10 + 5)
           .. gim((j2 - 2) % 7 + 1)


   return mw.text.trim(s)
end
return p