יחידה:אנדרסן
ניתן ליצור תיעוד על היחידה הזאת בדף יחידה:אנדרסן/תיעוד
o = {}
local articleTitle = function(day, month, year)
heb = "נאום זלסקי"
return "[[" .. heb .. " (" .. day .. " ב" .. MonthGetName(month) .. " " .. year .. ")|" .. day .. "]]"
end
p = {}
p.isLeapYear = function (year) -- year MUST be an integer
return math.fmod(year,4) == 0 and (math.fmod(year,100) > 0 or math.fmod(year,400) == 0);
end
local Month = {
"Jan", "Feb", "Mar", "Apr",
"May", "Jun", "Jul", "Aug",
"Sep", "Oct", "Nov", "Dec"
}
local monthNumber = {}
local monthInit = function()
for i, name in ipairs(Month) do monthNumber[i] = name end -- working as a dict
end
MonthGetName = function (month)
if month == 1 then return "ינואר"
elseif month == 2 then return "פברואר"
elseif month == 3 then return "מרץ"
elseif month == 4 then return "אפריל"
elseif month == 5 then return "מאי"
elseif month == 6 then return "יוני"
elseif month == 7 then return "יולי"
elseif month == 8 then return "אוגוסט"
elseif month == 9 then return "ספטמבר"
elseif month == 10 then return "אוקטובר"
elseif month == 11 then return "נובמבר"
elseif month == 12 then return "דצמבר"
end
end
MonthGetNumberOfDays = function (month, year)
if month == 1 or month == 3 or month == 5 or month == 7 or month == 8 or month == 10 or month == 12 then return 31
elseif month == 4 or month == 6 or month == 9 or month == 11 then return 30 end
if p.isLeapYear(year) then return 29 else return 28 end
end
--Month.printM = function (month)
-- return "called";
-- return Month.printM(month, 1) -- default
--end
MonthPrintM = function (month, start)
local ans = ""
for i = start, MonthGetNumberOfDays(month), 1 do
ans = ans .. " " .. i
if math.fmod(i, 10) == 0 then ans = ans .. "\n" end
end
return ans;
end
local firstYear = 2022;
local firstMonth = Feb;
local firstDay = 24;
local years = p.years; -- years as an array
-- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
printDays = function(day, month, year)
local daysInMonth = MonthGetNumberOfDays(month, year)
local text = MonthGetName(month) .. " " .. year
text = "[[:w:he:" .. text .. "|" .. text .. "]]\t"
for d = day, daysInMonth, 1 do
text = text .. d
if d + 1 < daysInMonth - 1 then text = text .. " • " end
end
return text;
end
o.printDays = function(vars)
local day = tonumber(vars.args[1])
local month = tonumber(vars.args[2])
local year = tonumber(vars.args[3])
local daysInMonth = MonthGetNumberOfDays(month, year)
local text = ""--MonthGetName(month)
--text = text .. " " .. year
--text = "[[:w:he:" .. text .. "|" .. text .. "]]\t"
for d = day, daysInMonth, 1 do
text = text .. articleTitle(d, month, year)
if d ~= daysInMonth then text = text .. " • " end
end
return text;
end
p.main = function(main)
monthInit();
local text = ""
text = text .. printDays(24, 2, 2022) .. "<br>"
for i = 3, 12, 1 do
text = text .. printDays(1, i, 2022) .. "<br>"
end
for i = 1, 12, 1 do
text = text .. printDays(1, i, 2023) .. "<br>"
end
return text;
--return table.foreach(Month, Month.printM)
--for i = 1, i < 12
--local text = "";
--text = text ..
--return Month.printM(Month["Jan"], 1);
end
p.main2 = function()
line1 = "{{ניווט קבוצות"
line2 = "| כותרת = נאומי [[:w:he:וולודימיר זלנסקי|וולודימיר זלנסקי]] בעת [[:w:he:הפלישה הרוסית לאוקראינה|הפלישה הרוסית לאוקראינה]]"
line3 = "| תמונה = [[קובץ:Do everything you can for us to withstand together in this war for our freedom and independence - address by President of Ukraine Volodymyr Zelenskyy. (51977034742) (cropped).jpg|100px]]"
line4 = "| קבוצה1 = 2022"
line5 = "| רשימה1 ="
line6 = "}}"
return line1 .. line2 .. line3 .. line4 .. line5 .. line6
end
return o;