Modul:Kalender
Aus FürthWiki
p = {}
function p.IstJahrestag(frame)
-- #invoke wrapper
local args = frame.args
local title = mw.title.getCurrentTitle().text
local tag, monat = p.istJahrestag(title)
if tag and monat then
return frame.args[1] or "true"
else
return frame.args[2] or ""
end
end
function p.istJahrestag(s)
s = s or ""
-- Prüfe auf ein-/zweistellige Zahl durch Punkt gefolgt, opt. Leerzeichen
return s:match("^(%d%d?)%.%s*(%a+)$")
end
function p.IstJahreszahl(frame)
-- #invoke wrapper
local args = frame.args
local title = mw.title.getCurrentTitle().text
if p.istJahreszahl(title) then
return args[1] or "true"
else
return args[2] or ""
end
end
function p.istJahreszahl(s)
s = s or ""
-- Prüfe auf Formate wie: 2024, -44, 44 v. Chr., 800 n. Chr.
return s:match("^%-?%d+$") or s:match("^%d+%s+[vn]%.%s+Chr%.$")
end
function p.getMonthList()
-- Returns a numbered List of all monthnames
return {
[1] = "Januar",
[2] = "Februar",
[3] = "März",
[4] = "April",
[5] = "Mai",
[6] = "Juni",
[7] = "Juli",
[8] = "August",
[9] = "September",
[10] = "Oktober",
[11] = "November",
[12] = "Dezember"}
end
function p.getMonthnr(name)
-- Returns the number of the given monthname
local months = p.getMonthList()
for nr, mn in pairs(months) do
if mn == name then
return nr
end
end
end
function p.date2ISO(d)
end
return p