Modul:Liturgický kalendár

z Wikipédie, slobodnej encyklopédie


Túto dokumentáciu [vytvoriť] [obnoviť]
Dokumentácia Dokumentácia

Dokumentácia pre tento modul zatiaľ neexistuje. Môžete ju vytvoriť na Modul:Liturgický kalendár/Dokumentácia


Ak máte otázku k tomuto modulu, alebo potrebujete jeho rozšírenie a neviete ho správne naformátovať, pýtajte sa v diskusii k modulu. Pokiaľ je potrebné modul urgentne opraviť, obráťte sa na technickú podporu.

local M = {}

function eas(y)
	c = math.floor(y/100)
	n = y - 19*math.floor(y/19)
	k = math.floor((c - 17)/25)
	i = c - math.floor(c/4) - math.floor((c - k)/3) + 19*n + 15
	i = i - 30*math.floor(i/30)
	j = y + math.floor(y/4) + i + 2 - c + math.floor(c/4)
	j = j - 7*math.floor(j/7)
	l = i - j
	moea = 3 + math.floor((l + 40)/44)
	doea = l + 28 - 31*math.floor(moea/4)
	ea = os.time{year=y, month=moea, day=doea}
	
	return ea
end

function M.lit(frame)
	new_args = frame.args;
	ea = eas(new_args['y']);
	y = new_args['y'];
	m = new_args['m'];
	d = new_args['d'];
	edate = d .. '. ' .. m .. '.'
	wdate = os.date('%w', os.time{year=y, month=m, day=d})
	tdate = os.time{year=y, month=m, day=d}
	
	easters = {}
	for e = 1, 6 do
		easters[e] = os.date('%d. %m.', ea + e*7*24*60*60)
	end
	
	tChr = os.time{year=y, month=12, day=25}
	wChr = os.date('%w', tChr)
	if wChr == '0' then wChr = '7' end
	advent1 = tChr - (wChr + 21)*24*60*60
	advents = {}
	for a = 1, 4 do
		advents[a] = os.date('%d. %m.', advent1 + (a - 1)*7*24*60*60)
	end
	
	epip = os.time{year=y, month=1, day=6}
	bap = epip + (7 - os.date('%w', epip))*24*60*60
	bapt = os.date('%d. %m.', bap)
	
	quadr1 = ea - 42*24*60*60
	quadrs = {}
	for q = 1, 5 do
		quadrs[q] = os.date('%d. %m.', quadr1 + (q - 1)*7*24*60*60)
	end
	
	trin = ea + 56*24*60*60
	preQua = (quadr1 - bap)/(7*24*60*60) - 1
	perannum = {}
	for r = 1, preQua - 1 do
		perannum[r] = os.date('%d. %m.', bap + r*7*24*60*60)
	end
	perannump = {}
	for o = 1, (30 - preQua) do
		perannump[o] = os.date('%d. %m.', trin + o*7*24*60*60)
	end
	
	if wdate == '0' then
		if tdate <= ea + 49*24*60*60 then
			if edate == os.date('%d. %m.', ea) then text = 'Veľkonočná nedeľa Pánovho zmŕtvychvstania'
			elseif edate == os.date('%d. %m.', ea + 49*24*60*60) then text = 'Zoslanie Ducha Svätého'
			elseif edate == '01. 01.' then text = 'slávnosť Panny Márie Bohorodičky'
			elseif edate == '02. 01.' or edate == '03. 01.' or edate == '04. 01.' or edate == '05. 01.' then text = '2. nedeľa po narodení Pána'
			elseif edate == '06. 01.' then text = 'Zjavenie Pána'
			elseif edate == bapt then text = 'Krst Krista Pána'
			elseif edate == os.date('%d. %m.', ea - 7*24*60*60) then text = 'Kvetná nedeľa – nedeľa utrpenia Pána' end
			for i,v in ipairs(easters) do
				if edate == v then text = i + 1 .. '. veľkonočná nedeľa' end
			end
			for i,v in ipairs(perannum) do
				if edate == v then text = i + 1 .. '. nedeľa v Cezročnom období' end
			end
			for i,v in ipairs(quadrs) do
				if edate == v then text = i .. '. pôstna nedeľa' end
			end
		else
			for i,v in ipairs(advents) do
				if edate == v then text = i .. '. adventná nedeľa' end
			end
			for i,v in ipairs(perannump) do
				if edate == v then text = i + preQua + 3 .. '. nedeľa v Cezročnom období' end
			end
			if edate == os.date('%d. %m.', advent1 - 7*24*60*60) then text = 'slávnosť Krista Kráľa'
			elseif edate == '25. 12.' then text = 'slávnosť Narodenia Pána'
			elseif edate == '26. 12.' or edate == '27. 12.' or edate == '28. 12.' or edate == '29. 12.' or edate == '30. 12.' or edate == '31. 12.' then text = 'sviatok svätej rodiny Ježiša, Márie a Jozefa'
			elseif edate == os.date('%d. %m.', trin) then text = 'slávnosť Najsvätejšej Trojice'
			elseif edate == '24. 06.' then text = 'slávnosť narodenia svätého Jána Krstiteľa'
			elseif edate == '29. 06.' then text = 'slávnosť svätých Petra a Pavla, apoštolov'
			elseif edate == '05. 07.' then text = 'slávnosť svätých Cyrila a Metoda, slovanských vierozvestov'
			elseif edate == '06. 08.' then text = 'Premenenie Pána'
			elseif edate == '15. 08.' then text = 'Nanebovzatie Panny Márie'
			elseif edate == '14. 09.' then text = 'Povýšenie Svätého kríža'
			elseif edate == '15. 09.' then text = 'slávnosť Sedembolestnej Panny Márie, patrónky Slovenska'
			elseif edate == '01. 11.' then text = 'slávnosť všetkých svätých'
			elseif edate == '02. 11.' then text = 'pamiatka všetkých verných zosnulých' end
		end
	else
		if wdate == '1' then dies = 'pondelok'
		elseif wdate == '2' then dies = 'utorok'
		elseif wdate == '3' then dies = 'streda'
		elseif wdate == '4' then dies = 'štvrtok'
		elseif wdate == '5' then dies = 'piatok'
		elseif wdate == '6' then dies = 'sobota'
		end
		if edate == '22. 02.' then text = 'sviatok Katedry svätého Petra, apoštola'
		elseif tdate < ea and tdate > ea - 7*24*60*60 then
			if wdate == '1' then text = 'pondelok Veľkého týždňa'
			elseif wdate == '2' then text = 'utorok Veľkého týždňa'
			elseif wdate == '3' then text = 'streda Veľkého týždňa'
			elseif wdate == '4' then text = 'Zelený štvrtok Pánovej večere'
			elseif wdate == '5' then text = 'Veľký piatok – slávenie utrpenia a smrti Pána'
			elseif wdate == '6' then text = 'Biela sobota'
			end
		elseif tdate > ea and tdate < ea + 7*24*60*60 then text = dies .. ' vo Veľkonočnej oktáve'
		elseif tdate == ea - 46*24*60*60 then text = 'Popolcová streda'
		elseif tdate == ea - 8*24*60*60 and os.time{year=y, month=3, day=19} > ea - 8*24*60*60 or wdate == '1' and edate == '20. 03.' and tdate ~= ea - 6*24*60*60 or tdate < ea - 7*24*60*60 and edate == '19. 03.' then text='slávnosť svätého Jozefa, ženícha Panny Márie'
		elseif tdate == ea + 39*24*60*60 then text = 'slávnosť Nanebovstúpenia Pána'
		elseif wdate == '1' and edate == '26. 03.' and tdate < ea - 7*24*60*60 or edate == '25. 03.' and tdate < ea - 7*24*60*60 or tdate == ea + 8*24*60*60 and os.time{year=y, month=3, day=25} > ea - 8*24*60*60 and os.time{year=y, month=3, day=25} < ea + 8*24*60*60 then text = 'slávnosť Zvestovania Pána'
		elseif tdate == trin - 6*24*60*60 then text = 'spomienka Panny Márie, Matky Cirkvi'
		elseif tdate == trin - 3*24*60*60 then text = 'sviatok nášho Pána Ježiša Krista, najvyššieho a večného kňaza'
		elseif tdate == trin + 4*24*60*60 then text = 'slávnosť Najsvätejšieho Kristovho Tela a Krvi'
		elseif tdate == trin + 12*24*60*60 then text = 'slávnosť Najsvätejšieho Srdca Ježišovho'
		elseif edate == '25. 12.' then text = 'slávnosť Narodenia Pána'
		elseif edate == '26. 12.' then text = 'sviatok svätého Štefana, prvého mučeníka'
		elseif edate == '27. 12.' then text = 'sviatok svätého Jána, apoštola a evanjelistu'
		elseif edate == '28. 12.' then text = 'sviatok svätých Neviniatok, mučeníkov'
		elseif edate == '29. 12.' then text = 'piaty deň v oktáve narodenia Pána'
		elseif edate == '30. 12.' and wdate == '5' then text = 'sviatok svätej rodiny Ježiša, Márie a Jozefa'
		elseif edate == '30. 12.' then text = 'šiesty deň v oktáve narodenia Pána'
		elseif edate == '01. 01.' then text = 'slávnosť Panny Márie Bohorodičky'
		elseif edate == '06. 01.' then text = 'Zjavenie Pána'
		elseif edate == '24. 06.' then text = 'slávnosť narodenia svätého Jána Krstiteľa'
		elseif edate == '29. 06.' then text = 'slávnosť svätých Petra a Pavla, apoštolov'
		elseif edate == '05. 07.' then text = 'slávnosť svätých Cyrila a Metoda, slovanských vierozvestov'
		elseif edate == '06. 08.' then text = 'Premenenie Pána'
		elseif edate == '15. 08.' then text = 'Nanebovzatie Panny Márie'
		elseif edate == '14. 09.' then text = 'Povýšenie Svätého kríža'
		elseif edate == '15. 09.' then text = 'slávnosť Sedembolestnej Panny Márie, patrónky Slovenska'
		elseif edate == '01. 11.' then text = 'slávnosť všetkých svätých'
		elseif edate == '02. 11.' then text = 'pamiatka všetkých verných zosnulých'
		elseif edate == '08. 12.' or edate == '09. 12.' and wdate == '1' then text = 'slávnosť Nepoškvrneného počatia Panny Márie'
		elseif tdate < epip and tdate > os.time{year=y, month=1, day=1} then text = dies .. ' vo Vianočnom období'
		elseif tdate > epip and tdate < bap then text = dies .. ' po Zjavení Pána'
		elseif tdate > bap and tdate < ea - 46*24*60*60 then
			hebd = ((7 - wdate)*24*60*60 + tdate - bap)/(7*24*60*60)
			text = dies .. ' ' .. hebd .. '. týždňa v Cezročnom období'
		elseif tdate > ea - 46*24*60*60 and tdate < quadr1 then text = dies .. ' po Popolcovej strede'
		elseif tdate > quadr1 and tdate < ea - 7*24*60*60 then
			hebd = ((7 - wdate)*24*60*60 + tdate - quadr1)/(7*24*60*60)
			text = dies .. ' po ' .. hebd .. '. pôstnej nedeli'
		elseif tdate > ea + 7*24*60*60 and tdate < trin - 7*24*60*60 then
			hebd = ((7 - wdate)*24*60*60 + tdate - ea)/(7*24*60*60)
			text = dies .. ' po ' .. hebd .. '. veľkonočnej nedeli'
		elseif tdate > trin - 7*24*60*60 and tdate < advent1 then
			hebd = ((7 - wdate)*24*60*60 + tdate - bap - 13*7*24*60*60 - ((advent1 - bap)/(7*24*60*60) - 47)*7*24*60*60)/(7*24*60*60)
			text = dies .. ' ' .. hebd .. '. týždňa v Cezročnom období'
		elseif tdate > advent1 and tdate < tChr then
			hebd = ((7 - wdate)*24*60*60 + tdate - advent1)/(7*24*60*60)
			text = dies .. ' po ' .. hebd .. '. adventnej nedeli'
		end
	end
	
	return text
end

return M