Modul:Kalender

Die Dokumentation für dieses Modul kann unter Modul:Kalender/Doku erstellt werden

-- Modul für diverse Kalendervorlagen.
-- Grundlegende funktionen sind im Modul:DateTime zu finden.

-- trim: Entfernen aller Zeilenumbrüche, Austausch echter Tabulatoren durch Leerzeichen
-- anschließend Entfernung führender oder abschließender Leerzeichen.
local function trim(s)
	s = mw.ustring.gsub(s,"\n","");
	s = mw.ustring.gsub(s,"\t"," ");
	while mw.ustring.sub(s,1,1) == " " do
		s= mw.ustring.sub(s,2,-1);
	end
	while mw.ustring.sub(s,-1,-1) == " " do
		s= mw.ustring.sub(s,1,-2);
	end
	return s;
end

local Kalender = {};

function Kalender.Jahrhundertnavigation(frame)
	local jh = tonumber(frame.args[1] or "") or 21;
	local Text = '<table style="border:1px solid #000000; width:60ex; text-align:center; box-sizing: border-box; line-height:110%;">\n'
	local jahr = 0;
	local t = '';
	local n = 0;
	if jh > 0 and jh < 22 then
		jahr = (jh - 1) * 100;
		t = '<tr>'
		for i = 0, 4, 1 do
			t = t .. '<td colspan="2">&nbsp;[['.. tostring(jahr + i * 10) ..'er]]&nbsp;</td>'
		end
		t = t .. '</tr>\n'
		Text = Text .. t;
		if jh < 21 then
			t = '<tr>'
			for i = 5, 9, 1 do
				t = t .. '<td colspan="2">&nbsp;[['.. tostring(jahr + i * 10) ..'er]]&nbsp;</td>'
			end
			t = t .. '</tr>\n'
			Text = Text .. t;
		end
		for z = 0,4, 1 do
			t = '<tr>'
			for i = 1, 10, 1 do
				n = z * 10 + i
				t = t .. '<td>&nbsp;[['.. tostring(jahr + n) ..']]&nbsp;</td>';
			end
			t = t .. '</tr>\n'
			Text = Text .. t;
		end
		if jh < 21 then
			for z = 4,9, 1 do
				t = '<tr>'
				for i = 1, 10, 1 do
					n = z * 10 + i
					t = t .. '<td>&nbsp;[['.. tostring(jahr + n) ..']]&nbsp;</td>';
				end
				t = t .. '</tr>\n'
				Text = Text .. t;
			end
		end
		Text = Text .. '</table>\n'
	elseif jh < 0 and jh > -17 then
		jahr =  - (jh+1) * 100;
		t = '<tr>'
		for i = 9, 5, -1 do
			j =  tostring(jahr + i * 10)
			t = t .. '<td colspan="2">&nbsp;[['..j ..'er&nbsp;v.&nbsp;Chr.|'.. j .. 'er]]&nbsp;</td>'
		end
		t = t .. '</tr>\n'
		Text = Text .. t;
		t = '<tr>'
		for i = 4, 0, -1 do
			j =  tostring(jahr + i * 10)
			t = t .. '<td colspan="2">&nbsp;[['.. j ..'er&nbsp;v.&nbsp;Chr.|'.. j .. 'er]]&nbsp;</td>'
		end
		t = t .. '</tr>\n'
		Text = Text .. t;
		Text = Text ..'<tr><td colspan="10">v.&nbsp;Chr.</td></tr>\n'
		for z = 9,0, -1 do
			t = '<tr>'
			for i = 10, 1, -1 do
				n = z * 10 + i
				j =  tostring(jahr + n)
				t = t .. '<td>&nbsp;[['.. j ..'&nbsp;v.&nbsp;Chr.|'.. j .. ']]&nbsp;</td>';
			end
			t = t .. '</tr>\n'
			Text = Text .. t;
		end
		Text = Text .. '</table>\n'
	else
		Text = Text ..'<tr><td class="error">Fehler! Aufruf von [[Vorlage:Jahrhundertnavigation]] mit unerlaubtem Parameterwert!</td></tr></table>\n'
	end
	return Text;	
end

return Kalender

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.