p.Kalender

Diese Funktion bildet einen Monatstage-Kasten ab und wird per #invoke: eingebunden. Der Monat wird dem Lemma entnommen, weshalb diese Funktion keine Attribute benötigt.

p.woche

Eine nur von p.Kalender genutzte Funktion, welche die Anzahl der Wochentage für den jeweiligen Monat berechnet.


local p = {}
local c = require( "Module:Common" )

function p.Kalender( frame )
	pf = frame:getParent()
	args = pf.args
	pt = mw.title.getCurrentTitle().text
	ma=split(pt, '.')
	day = rtrim(ma[0])
	month = ltrim(ma[1])
	
	months=getMonthList()
	for i, v in ipairs(months) do
		if v == month then
			month_nr = i
		end
	end
	
	t = '<table class="wikitable monatsbox">'..
		'<tr>'..
    	'<th>[['..day..'. '..months[month_nr-1]..'|◄]]</th>'..
    	'<th colspan="5">[[:Kategorie:'..month..'|'..month..']]</th>'..
    	'<th>[['..day..'. '..months[month_nr+1]..'|►]]</th>'..
		'</th>'
	
	t=t..Woche(1, month)..
		 Woche(8, month)..
		 Woche(15, month)..
		 Woche(22, month)..
		 Woche(29, month)
	
	t = t..'</table>'..month..tostring(md)
	return t
end 

function Woche(d, month)
	a=6
	if d == 29 then
		if contains({'April', 'Juni', 'September', 'November'}, month) then
			a=1
		elseif month == 'Februar' then
			a=0
		else 
			a=2
		end
	end
	
	t = '<tr>'
	for i=d, d+a do
    	t=t..'<td align="right">[['..i..'. '..month..']]</td>'
	end
	t = t..'</tr>'
	return t
end
return p