Modul:Jahrestag: Unterschied zwischen den Versionen

1.174 Bytes hinzugefügt ,  Gestern um 19:10
fix kal.month_names[
Keine Bearbeitungszusammenfassung
(fix kal.month_names[)
 
(34 dazwischenliegende Versionen von 3 Benutzern werden nicht angezeigt)
Zeile 1: Zeile 1:
local p = {}
local p = {}
local c = require( "Module:Common" )


function p.Kalender( frame )
local com = require("Modul:Common")
pf = frame:getParent()
local str = require("Modul:String")
args = pf.args
local arr = require("Modul:Array")
pt = mw.title.getCurrentTitle().text
local kal = require("Modul:Kalender")
ma=split(pt, '.')
 
day = rtrim(ma[0])
function p.Kalender(frame)
month = ltrim(ma[1])
local args = frame:getParent().args
local title = mw.title.getCurrentTitle().text
months=getMonthList()
local ma = str.split(title, '.')
for i, v in ipairs(months) do
local day, month, month_nr
if v == month then
local md, mu -- month down/month up
month_nr = i
if com.len(ma) == 1 then
end
day = 0
month = ma[1]
else
day = str.rstrip(ma[1])
month = str.lstrip(ma[2])
end
end
t = '<table class="wikitable monatsbox">'..
month_nr = kal.month_numbers[month]
'<tr>'..
 
    '<th>[['..day..'. '..months[month_nr-1]..'|◄]]</th>'..
local t='<table class="wikitable monatsbox">'..
    '<th colspan="5">[[:Kategorie:'..month..'|'..month..']]</th>'..
'<tr>'
    '<th>[['..day..'. '..months[month_nr+1]..'|►]]</th>'..
'</th>'
t=t..Woche(1)..
-- Von Januar aus wieder auf Dezember springen
Woche(8)..
md = month_nr - 1
Woche(15)..
if md == 0 then
Woche(22)
md = 12
end
if contains({'April', 'Juni', 'September', 'November'}, month) then
-- Der md (month-down-button) verlinkt zum nächsten Tag der existiert
md=30
    t=t..'<th>[['
elseif month == 'Februar' then
    if day ~= 0 then
md=29
    mds = day..'. '..kal.month_names[md]
else
    for i = 0, 2 do
md=31
      mds = tostring(day-i)..'. '..kal.month_names[md]
    if mw.title.new(mds).exists then
    break
    end
    end
    t=t..mds
    else
    t=t..':Kategorie:'..kal.month_names[md]
    end
    t=t..'|◄]]</th>'..
        '<th colspan="5">[[:Kategorie:'..month..'|'..month..']]</th>'
   
    -- Von Dezember aus wieder auf Januar springen
    mu = month_nr + 1
if mu == 13 then
mu = 1
end
end
t = t..'<tr>'
-- Der mu (month-up-button) verlinkt zum nächsten Tag der existiert
for i=29, md do
    t=t..'<th>[['
     t=t..'<td align="right">'..i..'</td>'
    if day ~= 0 then
end
    mus = day..'. '..kal.month_names[mu]
t = t..'</tr>'
    for i = 0, 2 do
    mus = tostring(day-i)..'. '..kal.month_names[mu]
    if mw.title.new(mus).exists then
    break
    end
    end
    t=t..mus
else
     t=t..':Kategorie:'..kal.month_names[mu]
    end
    t=t..'|►]]</th>'
t = t..'</table>'..month..tostring(md)
-- A weng ungampert, aber funktioniert ;-)
t=t..p.woche(1, month) ..
p.woche(8, month) ..
p.woche(15, month) ..
p.woche(22, month) ..
p.woche(29, month)
t=t..'</table>'
return t
return t
end  
end  


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