Modul:Jahrestag: Unterschied zwischen den Versionen

Aus FürthWiki

Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
Zeile 24: Zeile 24:
'</th>'
'</th>'
t = t..'<tr>'
t=t..Woche(1)..
for i=1, 7 do
Woche(8)..
    t=t..'<td align="right">'..i..'</td>'
Woche(15)..
end
Woche(22)
t = t..'</tr>'
t = t..'<tr>'
for i=8, 14 do
    t=t..'<td align="right">'..i..'</td>'
end
t = t..'</tr>'
t = t..'<tr>'
for i=15, 21 do
    t=t..'<td align="right">'..i..'</td>'
end
t = t..'</tr>'
t = t..'<tr>'
for i=22, 28 do
    t=t..'<td align="right">'..i..'</td>'
end
t = t..'</tr>'
if contains({'April', 'Juni', 'September', 'November'}, month) then
if contains({'April', 'Juni', 'September', 'November'}, month) then
Zeile 66: Zeile 47:
end  
end  


function Jahrzehnt(year)
function Woche(d)
t = '[['..tostring(year-10)..'|◄]] | '..
t = t..'<tr>'
    'Jahrzehnt | '..
for i=d, d+7 do
'[['..tostring(year+10)..'|►]]<br>'
    t=t..'<td align="right">'..i..'</td>'
end
t = t..'</tr>'
return t
return t
end
end
return p
return p

Version vom 22. Januar 2025, 20:48 Uhr

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>[['..months[month_nr-1]..'|◄]]</th>'..
    	'<th colspan="5">[[:Kategorie:'..month..'|'..month..']]</th>'..
    	'<th>[['..months[month_nr+1]..'|►]]</th>'..
		'</th>'
	
	t=t..Woche(1)..
		 Woche(8)..
		 Woche(15)..
		 Woche(22)
	
	if contains({'April', 'Juni', 'September', 'November'}, month) then
		md=30
	elseif month == 'Februar' then
		md=29
	else 
		md=31
	end
	
	t = t..'<tr>'
	for i=29, md do
    	t=t..'<td align="right">'..i..'</td>'
	end
	t = t..'</tr>'
	
	t = t..'</table>'..month..tostring(md)
	return t
end 

function Woche(d)
	t = t..'<tr>'
	for i=d, d+7 do
    	t=t..'<td align="right">'..i..'</td>'
	end
	t = t..'</tr>'
	return t
end
return p