summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/lualatex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-10-21 21:41:06 +0000
committerKarl Berry <karl@freefriends.org>2017-10-21 21:41:06 +0000
commit5d45df405c5c7c0d8c715b38aa9892d8135e2d1e (patch)
tree590f9cb4ccb943618776f4b27ae15f98ba64d8cd /Master/texmf-dist/tex/lualatex
parent6bb8f06468e4c4b7717cce9e4227e7465431506d (diff)
wallcalendar (21oct17)
git-svn-id: svn://tug.org/texlive/trunk@45568 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/lualatex')
-rw-r--r--Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-czech.tex36
-rw-r--r--Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-dutch.tex36
-rw-r--r--Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-english.tex36
-rw-r--r--Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-french.tex36
-rw-r--r--Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-german.tex36
-rw-r--r--Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-hungarian.tex36
-rw-r--r--Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-italian.tex36
-rw-r--r--Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-japanese.tex35
-rw-r--r--Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-norwegian.tex36
-rw-r--r--Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-portuguese.tex35
-rw-r--r--Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-romanian.tex36
-rw-r--r--Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-serbian.tex36
-rw-r--r--Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-slovakian.tex36
-rw-r--r--Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-slovenian.tex36
-rw-r--r--Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-spanish.tex36
-rw-r--r--Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-swedish.tex36
-rw-r--r--Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-thai.tex36
-rw-r--r--Master/texmf-dist/tex/lualatex/wallcalendar/wallcalendar-csv.lua557
-rw-r--r--Master/texmf-dist/tex/lualatex/wallcalendar/wallcalendar-date.lua747
-rw-r--r--Master/texmf-dist/tex/lualatex/wallcalendar/wallcalendar-helpers.lua279
-rw-r--r--Master/texmf-dist/tex/lualatex/wallcalendar/wallcalendar.cls1714
21 files changed, 3907 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-czech.tex b/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-czech.tex
new file mode 100644
index 00000000000..91623f4e576
--- /dev/null
+++ b/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-czech.tex
@@ -0,0 +1,36 @@
+% Czech
+
+\def\xJanuary{Leden}
+\def\xFebruary{Únor}
+\def\xMarch{Březen}
+\def\xApril{Duben}
+\def\xMay{Květen}
+\def\xJune{Červen}
+\def\xJuly{Červenec}
+\def\xAugust{Srpen}
+\def\xSeptember{Září}
+\def\xOctober{Říjen}
+\def\xNovember{Listopad}
+\def\xDecember{Prosinec}
+
+\def\xJanShort{Led}
+\def\xFebShort{Úno}
+\def\xMarShort{Bře}
+\def\xAprShort{Dub}
+\def\xMayShort{Kvě}
+\def\xJunShort{Čer}
+\def\xJulShort{Čer}
+\def\xAugShort{Srp}
+\def\xSepShort{Zář}
+\def\xOctShort{Říj}
+\def\xNovShort{Lis}
+\def\xDecShort{Pro}
+
+\def\xMondayDayLetter{Po}
+\def\xTuesdayDayLetter{Út}
+\def\xWednesdayDayLetter{St}
+\def\xThursdayDayLetter{Čt}
+\def\xFridayDayLetter{Pá}
+\def\xSaturdayDayLetter{So}
+\def\xSundayDayLetter{Ne}
+
diff --git a/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-dutch.tex b/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-dutch.tex
new file mode 100644
index 00000000000..ceb14a52169
--- /dev/null
+++ b/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-dutch.tex
@@ -0,0 +1,36 @@
+% Dutch
+
+\def\xJanuary{Januari}
+\def\xFebruary{Februari}
+\def\xMarch{Maart}
+\def\xApril{April}
+\def\xMay{Mei}
+\def\xJune{Juni}
+\def\xJuly{Juli}
+\def\xAugust{Augustus}
+\def\xSeptember{September}
+\def\xOctober{Oktober}
+\def\xNovember{November}
+\def\xDecember{December}
+
+\def\xJanShort{Jan}
+\def\xFebShort{Feb}
+\def\xMarShort{Maa}
+\def\xAprShort{Apr}
+\def\xMayShort{Mei}
+\def\xJunShort{Jun}
+\def\xJulShort{Jul}
+\def\xAugShort{Aug}
+\def\xSepShort{Sep}
+\def\xOctShort{Okt}
+\def\xNovShort{Nov}
+\def\xDecShort{Dec}
+
+\def\xMondayDayLetter{ma}
+\def\xTuesdayDayLetter{di}
+\def\xWednesdayDayLetter{wo}
+\def\xThursdayDayLetter{do}
+\def\xFridayDayLetter{vr}
+\def\xSaturdayDayLetter{za}
+\def\xSundayDayLetter{zo}
+
diff --git a/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-english.tex b/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-english.tex
new file mode 100644
index 00000000000..55746a05e85
--- /dev/null
+++ b/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-english.tex
@@ -0,0 +1,36 @@
+% English
+
+\def\xJanuary{January}
+\def\xFebruary{February}
+\def\xMarch{March}
+\def\xApril{April}
+\def\xMay{May}
+\def\xJune{June}
+\def\xJuly{July}
+\def\xAugust{August}
+\def\xSeptember{September}
+\def\xOctober{October}
+\def\xNovember{November}
+\def\xDecember{December}
+
+\def\xJanShort{Jan}
+\def\xFebShort{Feb}
+\def\xMarShort{Mar}
+\def\xAprShort{Apr}
+\def\xMayShort{May}
+\def\xJunShort{Jun}
+\def\xJulShort{Jul}
+\def\xAugShort{Aug}
+\def\xSepShort{Sep}
+\def\xOctShort{Oct}
+\def\xNovShort{Nov}
+\def\xDecShort{Dec}
+
+\def\xMondayDayLetter{M}
+\def\xTuesdayDayLetter{T}
+\def\xWednesdayDayLetter{W}
+\def\xThursdayDayLetter{T}
+\def\xFridayDayLetter{F}
+\def\xSaturdayDayLetter{S}
+\def\xSundayDayLetter{S}
+
diff --git a/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-french.tex b/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-french.tex
new file mode 100644
index 00000000000..28e48f4540e
--- /dev/null
+++ b/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-french.tex
@@ -0,0 +1,36 @@
+% French
+
+\def\xJanuary{Janvier}
+\def\xFebruary{Février}
+\def\xMarch{Mars}
+\def\xApril{Avril}
+\def\xMay{Mai}
+\def\xJune{Juin}
+\def\xJuly{Juillet}
+\def\xAugust{Août}
+\def\xSeptember{Septembre}
+\def\xOctober{Octobre}
+\def\xNovember{Novembre}
+\def\xDecember{Décembre}
+
+\def\xJanShort{Jan}
+\def\xFebShort{Fév}
+\def\xMarShort{Mar}
+\def\xAprShort{Avr}
+\def\xMayShort{Mai}
+\def\xJunShort{Jui}
+\def\xJulShort{Jui}
+\def\xAugShort{Aoû}
+\def\xSepShort{Sep}
+\def\xOctShort{Oct}
+\def\xNovShort{Nov}
+\def\xDecShort{Déc}
+
+\def\xMondayDayLetter{L}
+\def\xTuesdayDayLetter{M}
+\def\xWednesdayDayLetter{M}
+\def\xThursdayDayLetter{J}
+\def\xFridayDayLetter{V}
+\def\xSaturdayDayLetter{S}
+\def\xSundayDayLetter{D}
+
diff --git a/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-german.tex b/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-german.tex
new file mode 100644
index 00000000000..fb8a51958fd
--- /dev/null
+++ b/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-german.tex
@@ -0,0 +1,36 @@
+% German
+
+\def\xJanuary{Januar}
+\def\xFebruary{Februar}
+\def\xMarch{März}
+\def\xApril{April}
+\def\xMay{Mai}
+\def\xJune{Juni}
+\def\xJuly{Juli}
+\def\xAugust{August}
+\def\xSeptember{September}
+\def\xOctober{Oktober}
+\def\xNovember{November}
+\def\xDecember{Dezember}
+
+\def\xJanShort{Jan}
+\def\xFebShort{Feb}
+\def\xMarShort{Mär}
+\def\xAprShort{Apr}
+\def\xMayShort{Mai}
+\def\xJunShort{Jun}
+\def\xJulShort{Jul}
+\def\xAugShort{Aug}
+\def\xSepShort{Sep}
+\def\xOctShort{Okt}
+\def\xNovShort{Nov}
+\def\xDecShort{Dez}
+
+\def\xMondayDayLetter{Mo}
+\def\xTuesdayDayLetter{Di}
+\def\xWednesdayDayLetter{Mi}
+\def\xThursdayDayLetter{Do}
+\def\xFridayDayLetter{Fr}
+\def\xSaturdayDayLetter{Sa}
+\def\xSundayDayLetter{So}
+
diff --git a/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-hungarian.tex b/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-hungarian.tex
new file mode 100644
index 00000000000..b0a8a45a4ae
--- /dev/null
+++ b/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-hungarian.tex
@@ -0,0 +1,36 @@
+% Hungarian
+
+\def\xJanuary{Január}
+\def\xFebruary{Február}
+\def\xMarch{Március}
+\def\xApril{Április}
+\def\xMay{Május}
+\def\xJune{Június}
+\def\xJuly{Július}
+\def\xAugust{Augusztus}
+\def\xSeptember{Szeptember}
+\def\xOctober{Október}
+\def\xNovember{November}
+\def\xDecember{December}
+
+\def\xJanShort{Jan}
+\def\xFebShort{Feb}
+\def\xMarShort{Már}
+\def\xAprShort{Ápr}
+\def\xMayShort{Máj}
+\def\xJunShort{Jún}
+\def\xJulShort{Júl}
+\def\xAugShort{Aug}
+\def\xSepShort{Szep}
+\def\xOctShort{Okt}
+\def\xNovShort{Nov}
+\def\xDecShort{Dec}
+
+\def\xMondayDayLetter{H}
+\def\xTuesdayDayLetter{K}
+\def\xWednesdayDayLetter{Sz}
+\def\xThursdayDayLetter{Cs}
+\def\xFridayDayLetter{P}
+\def\xSaturdayDayLetter{Sz}
+\def\xSundayDayLetter{V}
+
diff --git a/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-italian.tex b/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-italian.tex
new file mode 100644
index 00000000000..8de9bd9dae2
--- /dev/null
+++ b/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-italian.tex
@@ -0,0 +1,36 @@
+% Italian
+
+\def\xJanuary{Gennaio}
+\def\xFebruary{Febbraio}
+\def\xMarch{Marzo}
+\def\xApril{Aprile}
+\def\xMay{Maggio}
+\def\xJune{Giugno}
+\def\xJuly{Luglio}
+\def\xAugust{Agosto}
+\def\xSeptember{Settembre}
+\def\xOctober{Ottobre}
+\def\xNovember{Novembre}
+\def\xDecember{Dicembre}
+
+\def\xJanShort{Gen}
+\def\xFebShort{Feb}
+\def\xMarShort{Mar}
+\def\xAprShort{Apr}
+\def\xMayShort{Mag}
+\def\xJunShort{Giu}
+\def\xJulShort{Lug}
+\def\xAugShort{Ago}
+\def\xSepShort{Set}
+\def\xOctShort{Ott}
+\def\xNovShort{Nov}
+\def\xDecShort{Dic}
+
+\def\xMondayDayLetter{L}
+\def\xTuesdayDayLetter{M}
+\def\xWednesdayDayLetter{M}
+\def\xThursdayDayLetter{G}
+\def\xFridayDayLetter{V}
+\def\xSaturdayDayLetter{S}
+\def\xSundayDayLetter{D}
+
diff --git a/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-japanese.tex b/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-japanese.tex
new file mode 100644
index 00000000000..368265614ef
--- /dev/null
+++ b/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-japanese.tex
@@ -0,0 +1,35 @@
+% Japanese
+
+\def\xJanuary{一月}
+\def\xFebruary{二月}
+\def\xMarch{三月}
+\def\xApril{四月}
+\def\xMay{五月}
+\def\xJune{六月}
+\def\xJuly{七月}
+\def\xAugust{八月}
+\def\xSeptember{九月}
+\def\xOctober{十月}
+\def\xNovember{十一月}
+\def\xDecember{十二月}
+
+\def\xJanShort{1月}
+\def\xFebShort{2月}
+\def\xMarShort{3月}
+\def\xAprShort{4月}
+\def\xMayShort{5月}
+\def\xJunShort{6月}
+\def\xJulShort{7月}
+\def\xAugShort{8月}
+\def\xSepShort{9月}
+\def\xOctShort{10月}
+\def\xNovShort{11月}
+\def\xDecShort{12月}
+
+\def\xMondayDayLetter{げ}
+\def\xTuesdayDayLetter{か}
+\def\xWednesdayDayLetter{す}
+\def\xThursdayDayLetter{も}
+\def\xFridayDayLetter{き}
+\def\xSaturdayDayLetter{ど}
+\def\xSundayDayLetter{に}
diff --git a/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-norwegian.tex b/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-norwegian.tex
new file mode 100644
index 00000000000..c69b18ebee3
--- /dev/null
+++ b/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-norwegian.tex
@@ -0,0 +1,36 @@
+% Norwegian
+
+\def\xJanuary{Januar}
+\def\xFebruary{Februar}
+\def\xMarch{Mars}
+\def\xApril{April}
+\def\xMay{Mai}
+\def\xJune{Juni}
+\def\xJuly{Juli}
+\def\xAugust{August}
+\def\xSeptember{September}
+\def\xOctober{Oktober}
+\def\xNovember{November}
+\def\xDecember{Desember}
+
+\def\xJanShort{Jan}
+\def\xFebShort{Feb}
+\def\xMarShort{Mar}
+\def\xAprShort{Apr}
+\def\xMayShort{Mai}
+\def\xJunShort{Jun}
+\def\xJulShort{Jul}
+\def\xAugShort{Aug}
+\def\xSepShort{Sep}
+\def\xOctShort{Okt}
+\def\xNovShort{Nov}
+\def\xDecShort{Des}
+
+\def\xMondayDayLetter{M}
+\def\xTuesdayDayLetter{T}
+\def\xWednesdayDayLetter{O}
+\def\xThursdayDayLetter{T}
+\def\xFridayDayLetter{F}
+\def\xSaturdayDayLetter{L}
+\def\xSundayDayLetter{S}
+
diff --git a/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-portuguese.tex b/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-portuguese.tex
new file mode 100644
index 00000000000..d15f82f2def
--- /dev/null
+++ b/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-portuguese.tex
@@ -0,0 +1,35 @@
+% Portuguese
+
+\def\xJanuary{Janeiro}
+\def\xFebruary{Fevereiro}
+\def\xMarch{Março}
+\def\xApril{Abril}
+\def\xMay{Maio}
+\def\xJune{Junho}
+\def\xJuly{Julho}
+\def\xAugust{Agosto}
+\def\xSeptember{Setembro}
+\def\xOctober{Outubro}
+\def\xNovember{Novembro}
+\def\xDecember{Dezembro}
+
+\def\xJanShort{Jan}
+\def\xFebShort{Fev}
+\def\xMarShort{Mar}
+\def\xAprShort{Abr}
+\def\xMayShort{Mai}
+\def\xJunShort{Jun}
+\def\xJulShort{Jul}
+\def\xAugShort{Ago}
+\def\xSepShort{Set}
+\def\xOctShort{Out}
+\def\xNovShort{Nov}
+\def\xDecShort{Dez}
+
+\def\xMondayDayLetter{{2\textsuperscript{a}}}
+\def\xTuesdayDayLetter{{3\textsuperscript{a}}}
+\def\xWednesdayDayLetter{{4\textsuperscript{a}}}
+\def\xThursdayDayLetter{{5\textsuperscript{a}}}
+\def\xFridayDayLetter{{6\textsuperscript{a}}}
+\def\xSaturdayDayLetter{S}
+\def\xSundayDayLetter{D}
diff --git a/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-romanian.tex b/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-romanian.tex
new file mode 100644
index 00000000000..2bb1deba463
--- /dev/null
+++ b/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-romanian.tex
@@ -0,0 +1,36 @@
+% Romanian
+
+\def\xJanuary{Ianuarie}
+\def\xFebruary{Februarie}
+\def\xMarch{Martie}
+\def\xApril{Aprilie}
+\def\xMay{Mai}
+\def\xJune{Iunie}
+\def\xJuly{Iulie}
+\def\xAugust{August}
+\def\xSeptember{Septembrie}
+\def\xOctober{Octombrie}
+\def\xNovember{Noiembrie}
+\def\xDecember{Decembrie}
+
+\def\xJanShort{Ian}
+\def\xFebShort{Feb}
+\def\xMarShort{Mar}
+\def\xAprShort{Apr}
+\def\xMayShort{Mai}
+\def\xJunShort{Iun}
+\def\xJulShort{Iul}
+\def\xAugShort{Aug}
+\def\xSepShort{Sep}
+\def\xOctShort{Oct}
+\def\xNovShort{Noi}
+\def\xDecShort{Dec}
+
+\def\xMondayDayLetter{L}
+\def\xTuesdayDayLetter{M}
+\def\xWednesdayDayLetter{M}
+\def\xThursdayDayLetter{J}
+\def\xFridayDayLetter{V}
+\def\xSaturdayDayLetter{S}
+\def\xSundayDayLetter{D}
+
diff --git a/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-serbian.tex b/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-serbian.tex
new file mode 100644
index 00000000000..7a078e8c157
--- /dev/null
+++ b/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-serbian.tex
@@ -0,0 +1,36 @@
+% Serbian
+
+\def\xJanuary{Januar}
+\def\xFebruary{Februar}
+\def\xMarch{Mart}
+\def\xApril{April}
+\def\xMay{Maj}
+\def\xJune{Juni}
+\def\xJuly{Juli}
+\def\xAugust{Avgust}
+\def\xSeptember{Septembar}
+\def\xOctober{Oktobar}
+\def\xNovember{Novembar}
+\def\xDecember{Decembar}
+
+\def\xJanShort{Jan}
+\def\xFebShort{Feb}
+\def\xMarShort{Mar}
+\def\xAprShort{Apr}
+\def\xMayShort{Maj}
+\def\xJunShort{Jun}
+\def\xJulShort{Jul}
+\def\xAugShort{Avg}
+\def\xSepShort{Sep}
+\def\xOctShort{Okt}
+\def\xNovShort{Nov}
+\def\xDecShort{Dec}
+
+\def\xMondayDayLetter{Po}
+\def\xTuesdayDayLetter{Ut}
+\def\xWednesdayDayLetter{Sr}
+\def\xThursdayDayLetter{Če}
+\def\xFridayDayLetter{Pe}
+\def\xSaturdayDayLetter{Su}
+\def\xSundayDayLetter{Ne}
+
diff --git a/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-slovakian.tex b/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-slovakian.tex
new file mode 100644
index 00000000000..589e58d8a19
--- /dev/null
+++ b/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-slovakian.tex
@@ -0,0 +1,36 @@
+% Slovakian
+
+\def\xJanuary{Január}
+\def\xFebruary{Február}
+\def\xMarch{Marec}
+\def\xApril{Apríl}
+\def\xMay{Máj}
+\def\xJune{Jún}
+\def\xJuly{Júl}
+\def\xAugust{August}
+\def\xSeptember{September}
+\def\xOctober{Október}
+\def\xNovember{November}
+\def\xDecember{December}
+
+\def\xJanShort{Jan}
+\def\xFebShort{Feb}
+\def\xMarShort{Mar}
+\def\xAprShort{Apr}
+\def\xMayShort{Máj}
+\def\xJunShort{Jún}
+\def\xJulShort{Júl}
+\def\xAugShort{Aug}
+\def\xSepShort{Sep}
+\def\xOctShort{Okt}
+\def\xNovShort{Nov}
+\def\xDecShort{Dec}
+
+\def\xMondayDayLetter{P}
+\def\xTuesdayDayLetter{U}
+\def\xWednesdayDayLetter{S}
+\def\xThursdayDayLetter{Š}
+\def\xFridayDayLetter{P}
+\def\xSaturdayDayLetter{S}
+\def\xSundayDayLetter{N}
+
diff --git a/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-slovenian.tex b/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-slovenian.tex
new file mode 100644
index 00000000000..918a635dc5e
--- /dev/null
+++ b/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-slovenian.tex
@@ -0,0 +1,36 @@
+% Slovenian
+
+\def\xJanuary{Januar}
+\def\xFebruary{Februar}
+\def\xMarch{Marec}
+\def\xApril{April}
+\def\xMay{Maj}
+\def\xJune{Junij}
+\def\xJuly{Julij}
+\def\xAugust{Avgust}
+\def\xSeptember{September}
+\def\xOctober{Oktober}
+\def\xNovember{November}
+\def\xDecember{December}
+
+\def\xJanShort{Jan}
+\def\xFebShort{Feb}
+\def\xMarShort{Mar}
+\def\xAprShort{Apr}
+\def\xMayShort{Maj}
+\def\xJunShort{Jun}
+\def\xJulShort{Jul}
+\def\xAugShort{Avg}
+\def\xSepShort{Sep}
+\def\xOctShort{Okt}
+\def\xNovShort{Nov}
+\def\xDecShort{Dec}
+
+\def\xMondayDayLetter{Po}
+\def\xTuesdayDayLetter{To}
+\def\xWednesdayDayLetter{Sr}
+\def\xThursdayDayLetter{Če}
+\def\xFridayDayLetter{Pe}
+\def\xSaturdayDayLetter{So}
+\def\xSundayDayLetter{Ne}
+
diff --git a/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-spanish.tex b/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-spanish.tex
new file mode 100644
index 00000000000..36370da3d4b
--- /dev/null
+++ b/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-spanish.tex
@@ -0,0 +1,36 @@
+% Spanish
+
+\def\xJanuary{Enero}
+\def\xFebruary{Febrero}
+\def\xMarch{Marzo}
+\def\xApril{Abril}
+\def\xMay{Mayo}
+\def\xJune{Junio}
+\def\xJuly{Julio}
+\def\xAugust{Agosto}
+\def\xSeptember{Septiembre}
+\def\xOctober{Octubre}
+\def\xNovember{Noviembre}
+\def\xDecember{Diciembre}
+
+\def\xJanShort{Ene}
+\def\xFebShort{Feb}
+\def\xMarShort{Mar}
+\def\xAprShort{Abr}
+\def\xMayShort{May}
+\def\xJunShort{Jun}
+\def\xJulShort{Jul}
+\def\xAugShort{Ago}
+\def\xSepShort{Sep}
+\def\xOctShort{Oct}
+\def\xNovShort{Nov}
+\def\xDecShort{Dic}
+
+\def\xMondayDayLetter{Lu}
+\def\xTuesdayDayLetter{Ma}
+\def\xWednesdayDayLetter{Mi}
+\def\xThursdayDayLetter{Ju}
+\def\xFridayDayLetter{Vi}
+\def\xSaturdayDayLetter{Sá}
+\def\xSundayDayLetter{Do}
+
diff --git a/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-swedish.tex b/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-swedish.tex
new file mode 100644
index 00000000000..c6c687f8f50
--- /dev/null
+++ b/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-swedish.tex
@@ -0,0 +1,36 @@
+% Swedish
+
+\def\xJanuary{Januari}
+\def\xFebruary{Februari}
+\def\xMarch{Mars}
+\def\xApril{April}
+\def\xMay{Maj}
+\def\xJune{Juni}
+\def\xJuly{Juli}
+\def\xAugust{Augusti}
+\def\xSeptember{September}
+\def\xOctober{Oktober}
+\def\xNovember{November}
+\def\xDecember{December}
+
+\def\xJanShort{Jan}
+\def\xFebShort{Feb}
+\def\xMarShort{Mar}
+\def\xAprShort{Apr}
+\def\xMayShort{Maj}
+\def\xJunShort{Jun}
+\def\xJulShort{Jul}
+\def\xAugShort{Aug}
+\def\xSepShort{Sep}
+\def\xOctShort{Okt}
+\def\xNovShort{Nov}
+\def\xDecShort{Dec}
+
+\def\xMondayDayLetter{Må}
+\def\xTuesdayDayLetter{Ti}
+\def\xWednesdayDayLetter{On}
+\def\xThursdayDayLetter{To}
+\def\xFridayDayLetter{Fr}
+\def\xSaturdayDayLetter{Lö}
+\def\xSundayDayLetter{Sö}
+
diff --git a/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-thai.tex b/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-thai.tex
new file mode 100644
index 00000000000..56297b7be7a
--- /dev/null
+++ b/Master/texmf-dist/tex/lualatex/wallcalendar/i18n/wallcalendar-thai.tex
@@ -0,0 +1,36 @@
+% Thai
+
+\def\xJanuary{มกราคม}
+\def\xFebruary{กุมภาพันธ์}
+\def\xMarch{มีนาคม}
+\def\xApril{เมษายน}
+\def\xMay{พฤษภาคม}
+\def\xJune{มิถุนายน}
+\def\xJuly{กรกฎาคม}
+\def\xAugust{สิงหาคม}
+\def\xSeptember{กันยายน}
+\def\xOctober{ตุลาคม}
+\def\xNovember{พฤศจิกายน}
+\def\xDecember{ธันวาคม}
+
+\def\xJanShort{มกร}
+\def\xFebShort{กุมภ}
+\def\xMarShort{มีนา}
+\def\xAprShort{เมษ}
+\def\xMayShort{พฤษ}
+\def\xJunShort{มิถุน}
+\def\xJulShort{กรก}
+\def\xAugShort{สิงห}
+\def\xSepShort{กันย}
+\def\xOctShort{ตุลา}
+\def\xNovShort{พฤศ}
+\def\xDecShort{ธันว}
+
+\def\xMondayDayLetter{จ}
+\def\xTuesdayDayLetter{อ}
+\def\xWednesdayDayLetter{พ}
+\def\xThursdayDayLetter{พฤ}
+\def\xFridayDayLetter{ศ}
+\def\xSaturdayDayLetter{ส}
+\def\xSundayDayLetter{อา}
+
diff --git a/Master/texmf-dist/tex/lualatex/wallcalendar/wallcalendar-csv.lua b/Master/texmf-dist/tex/lualatex/wallcalendar/wallcalendar-csv.lua
new file mode 100644
index 00000000000..64196c07dac
--- /dev/null
+++ b/Master/texmf-dist/tex/lualatex/wallcalendar/wallcalendar-csv.lua
@@ -0,0 +1,557 @@
+--- Read a comma or tab (or other delimiter) separated file.
+-- This version of a CSV reader differs from others I've seen in that it
+--
+-- + handles embedded newlines in fields (if they're delimited with double
+-- quotes)
+-- + is line-ending agnostic
+-- + reads the file line-by-line, so it can potientially handle large
+-- files.
+--
+-- Of course, for such a simple format, CSV is horribly complicated, so it
+-- likely gets something wrong.
+
+-- (c) Copyright 2013-2014 Incremental IP Limited.
+-- (c) Copyright 2014 Kevin Martin
+-- Available under the MIT licence. See LICENSE for more information.
+
+local DEFAULT_BUFFER_BLOCK_SIZE = 1024 * 1024
+
+
+------------------------------------------------------------------------------
+
+local function trim_space(s)
+ return s:match("^%s*(.-)%s*$")
+end
+
+
+local function fix_quotes(s)
+ -- the sub(..., -2) is to strip the trailing quote
+ return string.sub(s:gsub('""', '"'), 1, -2)
+end
+
+
+------------------------------------------------------------------------------
+
+local column_map = {}
+column_map.__index = column_map
+
+
+local function normalise_string(s)
+ return (s:lower():gsub("[^%w%d]+", " "):gsub("^ *(.-) *$", "%1"))
+end
+
+
+--- Parse a list of columns.
+-- The main job here is normalising column names and dealing with columns
+-- for which we have more than one possible name in the header.
+function column_map:new(columns)
+ local name_map = {}
+ for n, v in pairs(columns) do
+ local names
+ local t
+ if type(v) == "table" then
+ t = { transform = v.transform, default = v.default }
+ if v.name then
+ names = { normalise_string(v.name) }
+ elseif v.names then
+ names = v.names
+ for i, n in ipairs(names) do names[i] = normalise_string(n) end
+ end
+ else
+ if type(v) == "function" then
+ t = { transform = v }
+ else
+ t = {}
+ if type(v) == "string" then
+ names = { normalise_string(v) }
+ end
+ end
+ end
+
+ if not names then
+ names = { (n:lower():gsub("[^%w%d]+", " ")) }
+ end
+
+ t.name = n
+ for _, n in ipairs(names) do
+ name_map[n:lower()] = t
+ end
+ end
+
+ return setmetatable({ name_map = name_map }, column_map)
+end
+
+
+--- Map "virtual" columns to file columns.
+-- Once we've read the header, work out which columns we're interested in and
+-- what to do with them. Mostly this is about checking we've got the columns
+-- we need and writing a nice complaint if we haven't.
+function column_map:read_header(header)
+ local index_map = {}
+
+ -- Match the columns in the file to the columns in the name map
+ local found = {}
+ local found_any
+ for i, word in ipairs(header) do
+ word = normalise_string(word)
+ local r = self.name_map[word]
+ if r then
+ index_map[i] = r
+ found[r.name] = true
+ found_any = true
+ end
+ end
+
+ if not found_any then return end
+
+ -- check we found all the columns we need
+ local not_found = {}
+ for name, r in pairs(self.name_map) do
+ if not found[r.name] then
+ local nf = not_found[r.name]
+ if nf then
+ nf[#nf+1] = name
+ else
+ not_found[r.name] = { name }
+ end
+ end
+ end
+ -- If any columns are missing, assemble an error message
+ if next(not_found) then
+ local problems = {}
+ for k, v in pairs(not_found) do
+ local missing
+ if #v == 1 then
+ missing = "'"..v[1].."'"
+ else
+ missing = v[1]
+ for i = 2, #v - 1 do
+ missing = missing..", '"..v[i].."'"
+ end
+ missing = missing.." or '"..v[#v].."'"
+ end
+ problems[#problems+1] = "Couldn't find a column named "..missing
+ end
+ error(table.concat(problems, "\n"), 0)
+ end
+
+ self.index_map = index_map
+ return true
+end
+
+
+function column_map:transform(value, index)
+ local field = self.index_map[index]
+ if field then
+ if field.transform then
+ local ok
+ ok, value = pcall(field.transform, value)
+ if not ok then
+ error(("Error reading field '%s': %s"):format(field.name, value), 0)
+ end
+ end
+ return value or field.default, field.name
+ end
+end
+
+
+------------------------------------------------------------------------------
+
+local file_buffer = {}
+file_buffer.__index = file_buffer
+
+function file_buffer:new(file, buffer_block_size)
+ return setmetatable({
+ file = file,
+ buffer_block_size = buffer_block_size or DEFAULT_BUFFER_BLOCK_SIZE,
+ buffer_start = 0,
+ buffer = "",
+ }, file_buffer)
+end
+
+
+--- Cut the front off the buffer if we've already read it
+function file_buffer:truncate(p)
+ p = p - self.buffer_start
+ if p > self.buffer_block_size then
+ local remove = self.buffer_block_size *
+ math.floor((p-1) / self.buffer_block_size)
+ self.buffer = self.buffer:sub(remove + 1)
+ self.buffer_start = self.buffer_start + remove
+ end
+end
+
+
+--- Find something in the buffer, extending it if necessary
+function file_buffer:find(pattern, init)
+ while true do
+ local first, last, capture =
+ self.buffer:find(pattern, init - self.buffer_start)
+ -- if we found nothing, or the last character is at the end of the
+ -- buffer (and the match could potentially be longer) then read some
+ -- more.
+ if not first or last == #self.buffer then
+ local s = self.file:read(self.buffer_block_size)
+ if not s then
+ if not first then
+ return
+ else
+ return first + self.buffer_start, last + self.buffer_start, capture
+ end
+ end
+ self.buffer = self.buffer..s
+ else
+ return first + self.buffer_start, last + self.buffer_start, capture
+ end
+ end
+end
+
+
+--- Extend the buffer so we can see more
+function file_buffer:extend(offset)
+ local extra = offset - #self.buffer - self.buffer_start
+ if extra > 0 then
+ local size = self.buffer_block_size *
+ math.ceil(extra / self.buffer_block_size)
+ local s = self.file:read(size)
+ if not s then return end
+ self.buffer = self.buffer..s
+ end
+end
+
+
+--- Get a substring from the buffer, extending it if necessary
+function file_buffer:sub(a, b)
+ self:extend(b)
+ b = b == -1 and b or b - self.buffer_start
+ return self.buffer:sub(a - self.buffer_start, b)
+end
+
+
+--- Close a file buffer
+function file_buffer:close()
+ self.file:close()
+ self.file = nil
+end
+
+
+------------------------------------------------------------------------------
+
+local separator_candidates = { ",", "\t", "|" }
+local guess_separator_params = { record_limit = 8; }
+
+
+local function try_separator(buffer, sep, f)
+ guess_separator_params.separator = sep
+ local min, max = math.huge, 0
+ local lines, split_lines = 0, 0
+ local iterator = coroutine.wrap(function() f(buffer, guess_separator_params) end)
+ for t in iterator do
+ min = math.min(min, #t)
+ max = math.max(max, #t)
+ split_lines = split_lines + (t[2] and 1 or 0)
+ lines = lines + 1
+ end
+ if split_lines / lines > 0.75 then
+ return max - min
+ else
+ return math.huge
+ end
+end
+
+
+--- If the user hasn't specified a separator, try to work out what it is.
+function guess_separator(buffer, f)
+ local best_separator, lowest_diff = "", math.huge
+ for _, s in ipairs(separator_candidates) do
+ local ok, diff = pcall(function() return try_separator(buffer, s, f) end)
+ if ok and diff < lowest_diff then
+ best_separator = s
+ lowest_diff = diff
+ end
+ end
+
+ return best_separator
+end
+
+
+local unicode_BOMS =
+{
+ {
+ length = 2,
+ BOMS =
+ {
+ ["\254\255"] = true, -- UTF-16 big-endian
+ ["\255\254"] = true, -- UTF-16 little-endian
+ }
+ },
+ {
+ length = 3,
+ BOMS =
+ {
+ ["\239\187\191"] = true, -- UTF-8
+ }
+ }
+}
+
+
+local function find_unicode_BOM(sub)
+ for _, x in ipairs(unicode_BOMS) do
+ local code = sub(1, x.length)
+ if x.BOMS[code] then
+ return x.length
+ end
+ end
+ return 0
+end
+
+
+--- Iterate through the records in a file
+-- Since records might be more than one line (if there's a newline in quotes)
+-- and line-endings might not be native, we read the file in chunks of
+-- we read the file in chunks using a file_buffer, rather than line-by-line
+-- using io.lines.
+local function separated_values_iterator(buffer, parameters)
+ local field_start = 1
+
+ local advance
+ if buffer.truncate then
+ advance = function(n)
+ field_start = field_start + n
+ buffer:truncate(field_start)
+ end
+ else
+ advance = function(n)
+ field_start = field_start + n
+ end
+ end
+
+
+ local function field_sub(a, b)
+ b = b == -1 and b or b + field_start - 1
+ return buffer:sub(a + field_start - 1, b)
+ end
+
+
+ local function field_find(pattern, init)
+ init = init or 1
+ local f, l, c = buffer:find(pattern, init + field_start - 1)
+ if not f then return end
+ return f - field_start + 1, l - field_start + 1, c
+ end
+
+
+ -- Is there some kind of Unicode BOM here?
+ advance(find_unicode_BOM(field_sub))
+
+
+ -- Start reading the file
+ local sep = "(["..(parameters.separator or
+ guess_separator(buffer, separated_values_iterator)).."\n\r])"
+ local line_start = 1
+ local line = 1
+ local field_count, fields, starts, nonblanks = 0, {}, {}
+ local header, header_read
+ local field_start_line, field_start_column
+ local record_count = 0
+
+
+ local function problem(message)
+ error(("%s:%d:%d: %s"):
+ format(parameters.filename, field_start_line, field_start_column,
+ message), 0)
+ end
+
+
+ while true do
+ local field_end, sep_end, this_sep
+ local tidy
+ field_start_line = line
+ field_start_column = field_start - line_start + 1
+
+ -- If the field is quoted, go find the other quote
+ if field_sub(1, 1) == '"' then
+ advance(1)
+ local current_pos = 0
+ repeat
+ local a, b, c = field_find('"("?)', current_pos + 1)
+ current_pos = b
+ until c ~= '"'
+ if not current_pos then problem("unmatched quote") end
+ tidy = fix_quotes
+ field_end, sep_end, this_sep = field_find(" *([^ ])", current_pos+1)
+ if this_sep and not this_sep:match(sep) then problem("unmatched quote") end
+ else
+ field_end, sep_end, this_sep = field_find(sep, 1)
+ tidy = trim_space
+ end
+
+ -- Look for the separator or a newline or the end of the file
+ field_end = (field_end or 0) - 1
+
+ -- Read the field, then convert all the line endings to \n, and
+ -- count any embedded line endings
+ local value = field_sub(1, field_end)
+ value = value:gsub("\r\n", "\n"):gsub("\r", "\n")
+ for nl in value:gmatch("\n()") do
+ line = line + 1
+ line_start = nl + field_start
+ end
+
+ value = tidy(value)
+ if #value > 0 then nonblanks = true end
+ field_count = field_count + 1
+
+ -- Insert the value into the table for this "line"
+ local key
+ if parameters.column_map and header_read then
+ local ok
+ ok, value, key = pcall(parameters.column_map.transform,
+ parameters.column_map, value, field_count)
+ if not ok then problem(value) end
+ elseif header then
+ key = header[field_count]
+ else
+ key = field_count
+ end
+ if key then
+ fields[key] = value
+ starts[key] = { line=field_start_line, column=field_start_column }
+ end
+
+ -- if we ended on a newline then yield the fields on this line.
+ if not this_sep or this_sep == "\r" or this_sep == "\n" then
+ if parameters.column_map and not header_read then
+ header_read = parameters.column_map:read_header(fields)
+ elseif parameters.header and not header_read then
+ if nonblanks or field_count > 1 then -- ignore blank lines
+ header = fields
+ header_read = true
+ end
+ else
+ if nonblanks or field_count > 1 then -- ignore blank lines
+ coroutine.yield(fields, starts)
+ record_count = record_count + 1
+ if parameters.record_limit and
+ record_count >= parameters.record_limit then
+ break
+ end
+ end
+ end
+ field_count, fields, starts, nonblanks = 0, {}, {}
+ end
+
+ -- If we *really* didn't find a separator then we're done.
+ if not sep_end then break end
+
+ -- If we ended on a newline then count it.
+ if this_sep == "\r" or this_sep == "\n" then
+ if this_sep == "\r" and field_sub(sep_end+1, sep_end+1) == "\n" then
+ sep_end = sep_end + 1
+ end
+ line = line + 1
+ line_start = field_start + sep_end
+ end
+
+ advance(sep_end)
+ end
+end
+
+
+------------------------------------------------------------------------------
+
+local buffer_mt =
+{
+ lines = function(t)
+ return coroutine.wrap(function()
+ separated_values_iterator(t.buffer, t.parameters)
+ end)
+ end,
+ close = function(t)
+ if t.buffer.close then t.buffer:close() end
+ end,
+ name = function(t)
+ return t.parameters.filename
+ end,
+}
+buffer_mt.__index = buffer_mt
+
+
+--- Use an existing file or buffer as a stream to read csv from.
+-- (A buffer is just something that looks like a string in that we can do
+-- `buffer:sub()` and `buffer:find()`)
+-- @return a file object
+local function use(
+ buffer, -- ?string|file|buffer: the buffer to read from. If it's:
+ -- - a string, read from that;
+ -- - a file, turn it into a file_buffer;
+ -- - nil, read from stdin
+ -- otherwise assume it's already a a buffer.
+ parameters) -- ?table: parameters controlling reading the file.
+ -- See README.md
+ parameters = parameters or {}
+ parameters.filename = parameters.filename or "<unknown>"
+ parameters.column_map = parameters.columns and
+ column_map:new(parameters.columns)
+
+ if not buffer then
+ buffer = file_buffer:new(io.stdin)
+ elseif io.type(buffer) == "file" then
+ buffer = file_buffer:new(buffer)
+ end
+
+ local f = { buffer = buffer, parameters = parameters }
+ return setmetatable(f, buffer_mt)
+end
+
+
+------------------------------------------------------------------------------
+
+--- Open a file for reading as a delimited file
+-- @return a file object
+local function open(
+ filename, -- string: name of the file to open
+ parameters) -- ?table: parameters controlling reading the file.
+ -- See README.md
+ local file, message = io.open(filename, "r")
+ if not file then return nil, message end
+
+ parameters = parameters or {}
+ parameters.filename = filename
+ return use(file_buffer:new(file), parameters)
+end
+
+
+------------------------------------------------------------------------------
+
+local function makename(s)
+ local t = {}
+ t[#t+1] = "<(String) "
+ t[#t+1] = (s:gmatch("[^\n]+")() or ""):sub(1,15)
+ if #t[#t] > 14 then t[#t+1] = "..." end
+ t[#t+1] = " >"
+ return table.concat(t)
+end
+
+
+--- Open a string for reading as a delimited file
+-- @return a file object
+local function openstring(
+ filecontents, -- string: The contents of the delimited file
+ parameters) -- ?table: parameters controlling reading the file.
+ -- See README.md
+
+ parameters = parameters or {}
+
+
+ parameters.filename = parameters.filename or makename(filecontents)
+ parameters.buffer_size = parameters.buffer_size or #filecontents
+ return use(filecontents, parameters)
+end
+
+
+------------------------------------------------------------------------------
+
+return { open = open, openstring = openstring, use = use }
+
+------------------------------------------------------------------------------
diff --git a/Master/texmf-dist/tex/lualatex/wallcalendar/wallcalendar-date.lua b/Master/texmf-dist/tex/lualatex/wallcalendar/wallcalendar-date.lua
new file mode 100644
index 00000000000..14aa47577fe
--- /dev/null
+++ b/Master/texmf-dist/tex/lualatex/wallcalendar/wallcalendar-date.lua
@@ -0,0 +1,747 @@
+---------------------------------------------------------------------------------------
+-- Module for date and time calculations
+--
+-- Version 2.1.1
+-- Copyright (C) 2006, by Jas Latrix (jastejada@yahoo.com)
+-- Copyright (C) 2013-2014, by Thijs Schreijer
+-- Licensed under MIT, http://opensource.org/licenses/MIT
+
+--[[ CONSTANTS ]]--
+ local HOURPERDAY = 24
+ local MINPERHOUR = 60
+ local MINPERDAY = 1440 -- 24*60
+ local SECPERMIN = 60
+ local SECPERHOUR = 3600 -- 60*60
+ local SECPERDAY = 86400 -- 24*60*60
+ local TICKSPERSEC = 1000000
+ local TICKSPERDAY = 86400000000
+ local TICKSPERHOUR = 3600000000
+ local TICKSPERMIN = 60000000
+ local DAYNUM_MAX = 365242500 -- Sat Jan 01 1000000 00:00:00
+ local DAYNUM_MIN = -365242500 -- Mon Jan 01 1000000 BCE 00:00:00
+ local DAYNUM_DEF = 0 -- Mon Jan 01 0001 00:00:00
+ local _;
+--[[ LOCAL ARE FASTER ]]--
+ local type = type
+ local pairs = pairs
+ local error = error
+ local assert = assert
+ local tonumber = tonumber
+ local tostring = tostring
+ local string = string
+ local math = math
+ local os = os
+ local unpack = unpack or table.unpack
+ local pack = table.pack or function(...) return { n = select('#', ...), ... } end
+ local setmetatable = setmetatable
+ local getmetatable = getmetatable
+--[[ EXTRA FUNCTIONS ]]--
+ local fmt = string.format
+ local lwr = string.lower
+ local upr = string.upper
+ local rep = string.rep
+ local len = string.len
+ local sub = string.sub
+ local gsub = string.gsub
+ local gmatch = string.gmatch or string.gfind
+ local find = string.find
+ local ostime = os.time
+ local osdate = os.date
+ local floor = math.floor
+ local ceil = math.ceil
+ local abs = math.abs
+ -- removes the decimal part of a number
+ local function fix(n) n = tonumber(n) return n and ((n > 0 and floor or ceil)(n)) end
+ -- returns the modulo n % d;
+ local function mod(n,d) return n - d*floor(n/d) end
+ -- rounds a number;
+ local function round(n, d) d=d^10 return floor((n*d)+.5)/d end
+ -- rounds a number to whole;
+ local function whole(n)return floor(n+.5)end
+ -- is `str` in string list `tbl`, `ml` is the minimun len
+ local function inlist(str, tbl, ml, tn)
+ local sl = len(str)
+ if sl < (ml or 0) then return nil end
+ str = lwr(str)
+ for k, v in pairs(tbl) do
+ if str == lwr(sub(v, 1, sl)) then
+ if tn then tn[0] = k end
+ return k
+ end
+ end
+ end
+ local function fnil() end
+ local function fret(x)return x;end
+--[[ DATE FUNCTIONS ]]--
+ local DATE_EPOCH -- to be set later
+ local sl_weekdays = {
+ [0]="Sunday",[1]="Monday",[2]="Tuesday",[3]="Wednesday",[4]="Thursday",[5]="Friday",[6]="Saturday",
+ [7]="Sun",[8]="Mon",[9]="Tue",[10]="Wed",[11]="Thu",[12]="Fri",[13]="Sat",
+ }
+ local sl_meridian = {[-1]="AM", [1]="PM"}
+ local sl_months = {
+ [00]="January", [01]="February", [02]="March",
+ [03]="April", [04]="May", [05]="June",
+ [06]="July", [07]="August", [08]="September",
+ [09]="October", [10]="November", [11]="December",
+ [12]="Jan", [13]="Feb", [14]="Mar",
+ [15]="Apr", [16]="May", [17]="Jun",
+ [18]="Jul", [19]="Aug", [20]="Sep",
+ [21]="Oct", [22]="Nov", [23]="Dec",
+ }
+ -- added the '.2' to avoid collision, use `fix` to remove
+ local sl_timezone = {
+ [000]="utc", [0.2]="gmt",
+ [300]="est", [240]="edt",
+ [360]="cst", [300.2]="cdt",
+ [420]="mst", [360.2]="mdt",
+ [480]="pst", [420.2]="pdt",
+ }
+ -- set the day fraction resolution
+ local function setticks(t)
+ TICKSPERSEC = t;
+ TICKSPERDAY = SECPERDAY*TICKSPERSEC
+ TICKSPERHOUR= SECPERHOUR*TICKSPERSEC
+ TICKSPERMIN = SECPERMIN*TICKSPERSEC
+ end
+ -- is year y leap year?
+ local function isleapyear(y) -- y must be int!
+ return (mod(y, 4) == 0 and (mod(y, 100) ~= 0 or mod(y, 400) == 0))
+ end
+ -- day since year 0
+ local function dayfromyear(y) -- y must be int!
+ return 365*y + floor(y/4) - floor(y/100) + floor(y/400)
+ end
+ -- day number from date, month is zero base
+ local function makedaynum(y, m, d)
+ local mm = mod(mod(m,12) + 10, 12)
+ return dayfromyear(y + floor(m/12) - floor(mm/10)) + floor((mm*306 + 5)/10) + d - 307
+ --local yy = y + floor(m/12) - floor(mm/10)
+ --return dayfromyear(yy) + floor((mm*306 + 5)/10) + (d - 1)
+ end
+ -- date from day number, month is zero base
+ local function breakdaynum(g)
+ local g = g + 306
+ local y = floor((10000*g + 14780)/3652425)
+ local d = g - dayfromyear(y)
+ if d < 0 then y = y - 1; d = g - dayfromyear(y) end
+ local mi = floor((100*d + 52)/3060)
+ return (floor((mi + 2)/12) + y), mod(mi + 2,12), (d - floor((mi*306 + 5)/10) + 1)
+ end
+ --[[ for floats or int32 Lua Number data type
+ local function breakdaynum2(g)
+ local g, n = g + 306;
+ local n400 = floor(g/DI400Y);n = mod(g,DI400Y);
+ local n100 = floor(n/DI100Y);n = mod(n,DI100Y);
+ local n004 = floor(n/DI4Y); n = mod(n,DI4Y);
+ local n001 = floor(n/365); n = mod(n,365);
+ local y = (n400*400) + (n100*100) + (n004*4) + n001 - ((n001 == 4 or n100 == 4) and 1 or 0)
+ local d = g - dayfromyear(y)
+ local mi = floor((100*d + 52)/3060)
+ return (floor((mi + 2)/12) + y), mod(mi + 2,12), (d - floor((mi*306 + 5)/10) + 1)
+ end
+ ]]
+ -- day fraction from time
+ local function makedayfrc(h,r,s,t)
+ return ((h*60 + r)*60 + s)*TICKSPERSEC + t
+ end
+ -- time from day fraction
+ local function breakdayfrc(df)
+ return
+ mod(floor(df/TICKSPERHOUR),HOURPERDAY),
+ mod(floor(df/TICKSPERMIN ),MINPERHOUR),
+ mod(floor(df/TICKSPERSEC ),SECPERMIN),
+ mod(df,TICKSPERSEC)
+ end
+ -- weekday sunday = 0, monday = 1 ...
+ local function weekday(dn) return mod(dn + 1, 7) end
+ -- yearday 0 based ...
+ local function yearday(dn)
+ return dn - dayfromyear((breakdaynum(dn))-1)
+ end
+ -- parse v as a month
+ local function getmontharg(v)
+ local m = tonumber(v);
+ return (m and fix(m - 1)) or inlist(tostring(v) or "", sl_months, 2)
+ end
+ -- get daynum of isoweek one of year y
+ local function isow1(y)
+ local f = makedaynum(y, 0, 4) -- get the date for the 4-Jan of year `y`
+ local d = weekday(f)
+ d = d == 0 and 7 or d -- get the ISO day number, 1 == Monday, 7 == Sunday
+ return f + (1 - d)
+ end
+ local function isowy(dn)
+ local w1;
+ local y = (breakdaynum(dn))
+ if dn >= makedaynum(y, 11, 29) then
+ w1 = isow1(y + 1);
+ if dn < w1 then
+ w1 = isow1(y);
+ else
+ y = y + 1;
+ end
+ else
+ w1 = isow1(y);
+ if dn < w1 then
+ w1 = isow1(y-1)
+ y = y - 1
+ end
+ end
+ return floor((dn-w1)/7)+1, y
+ end
+ local function isoy(dn)
+ local y = (breakdaynum(dn))
+ return y + (((dn >= makedaynum(y, 11, 29)) and (dn >= isow1(y + 1))) and 1 or (dn < isow1(y) and -1 or 0))
+ end
+ local function makedaynum_isoywd(y,w,d)
+ return isow1(y) + 7*w + d - 8 -- simplified: isow1(y) + ((w-1)*7) + (d-1)
+ end
+--[[ THE DATE MODULE ]]--
+ local fmtstr = "%x %X";
+--#if not DATE_OBJECT_AFX then
+ local date = {}
+ setmetatable(date, date)
+-- Version: VMMMRRRR; V-Major, M-Minor, R-Revision; e.g. 5.45.321 == 50450321
+ date.version = 20010001 -- 2.1.1
+--#end -- not DATE_OBJECT_AFX
+--[[ THE DATE OBJECT ]]--
+ local dobj = {}
+ dobj.__index = dobj
+ dobj.__metatable = dobj
+ -- shout invalid arg
+ local function date_error_arg() return error("invalid argument(s)",0) end
+ -- create new date object
+ local function date_new(dn, df)
+ return setmetatable({daynum=dn, dayfrc=df}, dobj)
+ end
+ -- is `v` a date object?
+ local function date_isdobj(v)
+ return (type(v) == 'table' and getmetatable(v) == dobj) and v
+ end
+
+--#if not NO_LOCAL_TIME_SUPPORT then
+ -- magic year table
+ local date_epoch, yt;
+ local function getequivyear(y)
+ assert(not yt)
+ yt = {}
+ local de, dw, dy = date_epoch:copy()
+ for i = 0, 3000 do
+ de:setyear(de:getyear() + 1, 1, 1)
+ dy = de:getyear()
+ dw = de:getweekday() * (isleapyear(dy) and -1 or 1)
+ if not yt[dw] then yt[dw] = dy end --print(de)
+ if yt[1] and yt[2] and yt[3] and yt[4] and yt[5] and yt[6] and yt[7] and yt[-1] and yt[-2] and yt[-3] and yt[-4] and yt[-5] and yt[-6] and yt[-7] then
+ getequivyear = function(y) return yt[ (weekday(makedaynum(y, 0, 1)) + 1) * (isleapyear(y) and -1 or 1) ] end
+ return getequivyear(y)
+ end
+ end
+ end
+ -- TimeValue from daynum and dayfrc
+ local function dvtotv(dn, df)
+ return fix(dn - DATE_EPOCH) * SECPERDAY + (df/1000)
+ end
+ -- TimeValue from date and time
+ local function totv(y,m,d,h,r,s)
+ return (makedaynum(y, m, d) - DATE_EPOCH) * SECPERDAY + ((h*60 + r)*60 + s)
+ end
+ -- TimeValue from TimeTable
+ local function tmtotv(tm)
+ return tm and totv(tm.year, tm.month - 1, tm.day, tm.hour, tm.min, tm.sec)
+ end
+ -- Returns the bias in seconds of utc time daynum and dayfrc
+ local function getbiasutc2(self)
+ local y,m,d = breakdaynum(self.daynum)
+ local h,r,s = breakdayfrc(self.dayfrc)
+ local tvu = totv(y,m,d,h,r,s) -- get the utc TimeValue of date and time
+ local tml = osdate("*t", tvu) -- get the local TimeTable of tvu
+ if (not tml) or (tml.year > (y+1) or tml.year < (y-1)) then -- failed try the magic
+ y = getequivyear(y)
+ tvu = totv(y,m,d,h,r,s)
+ tml = osdate("*t", tvu)
+ end
+ local tvl = tmtotv(tml)
+ if tvu and tvl then
+ return tvu - tvl, tvu, tvl
+ else
+ return error("failed to get bias from utc time")
+ end
+ end
+ -- Returns the bias in seconds of local time daynum and dayfrc
+ local function getbiasloc2(daynum, dayfrc)
+ local tvu
+ -- extract date and time
+ local y,m,d = breakdaynum(daynum)
+ local h,r,s = breakdayfrc(dayfrc)
+ -- get equivalent TimeTable
+ local tml = {year=y, month=m+1, day=d, hour=h, min=r, sec=s}
+ -- get equivalent TimeValue
+ local tvl = tmtotv(tml)
+
+ local function chkutc()
+ tml.isdst = nil; local tvug = ostime(tml) if tvug and (tvl == tmtotv(osdate("*t", tvug))) then tvu = tvug return end
+ tml.isdst = true; local tvud = ostime(tml) if tvud and (tvl == tmtotv(osdate("*t", tvud))) then tvu = tvud return end
+ tvu = tvud or tvug
+ end
+ chkutc()
+ if not tvu then
+ tml.year = getequivyear(y)
+ tvl = tmtotv(tml)
+ chkutc()
+ end
+ return ((tvu and tvl) and (tvu - tvl)) or error("failed to get bias from local time"), tvu, tvl
+ end
+--#end -- not NO_LOCAL_TIME_SUPPORT
+
+--#if not DATE_OBJECT_AFX then
+ -- the date parser
+ local strwalker = {} -- ^Lua regular expression is not as powerful as Perl$
+ strwalker.__index = strwalker
+ local function newstrwalker(s)return setmetatable({s=s, i=1, e=1, c=len(s)}, strwalker) end
+ function strwalker:aimchr() return "\n" .. self.s .. "\n" .. rep(".",self.e-1) .. "^" end
+ function strwalker:finish() return self.i > self.c end
+ function strwalker:back() self.i = self.e return self end
+ function strwalker:restart() self.i, self.e = 1, 1 return self end
+ function strwalker:match(s) return (find(self.s, s, self.i)) end
+ function strwalker:__call(s, f)-- print("strwalker:__call "..s..self:aimchr())
+ local is, ie; is, ie, self[1], self[2], self[3], self[4], self[5] = find(self.s, s, self.i)
+ if is then self.e, self.i = self.i, 1+ie; if f then f(unpack(self)) end return self end
+ end
+ local function date_parse(str)
+ local y,m,d, h,r,s, z, w,u, j, e, k, x,v,c, chkfin, dn,df;
+ local sw = newstrwalker(gsub(gsub(str, "(%b())", ""),"^(%s*)","")) -- remove comment, trim leading space
+ --local function error_out() print(y,m,d,h,r,s) end
+ local function error_dup(q) --[[error_out()]] error("duplicate value: " .. (q or "") .. sw:aimchr()) end
+ local function error_syn(q) --[[error_out()]] error("syntax error: " .. (q or "") .. sw:aimchr()) end
+ local function error_inv(q) --[[error_out()]] error("invalid date: " .. (q or "") .. sw:aimchr()) end
+ local function sety(q) y = y and error_dup() or tonumber(q); end
+ local function setm(q) m = (m or w or j) and error_dup(m or w or j) or tonumber(q) end
+ local function setd(q) d = d and error_dup() or tonumber(q) end
+ local function seth(q) h = h and error_dup() or tonumber(q) end
+ local function setr(q) r = r and error_dup() or tonumber(q) end
+ local function sets(q) s = s and error_dup() or tonumber(q) end
+ local function adds(q) s = s + tonumber(q) end
+ local function setj(q) j = (m or w or j) and error_dup() or tonumber(q); end
+ local function setz(q) z = (z ~= 0 and z) and error_dup() or q end
+ local function setzn(zs,zn) zn = tonumber(zn); setz( ((zn<24) and (zn*60) or (mod(zn,100) + floor(zn/100) * 60))*( zs=='+' and -1 or 1) ) end
+ local function setzc(zs,zh,zm) setz( ((tonumber(zh)*60) + tonumber(zm))*( zs=='+' and -1 or 1) ) end
+
+ if not (sw("^(%d%d%d%d)",sety) and (sw("^(%-?)(%d%d)%1(%d%d)",function(_,a,b) setm(tonumber(a)); setd(tonumber(b)) end) or sw("^(%-?)[Ww](%d%d)%1(%d?)",function(_,a,b) w, u = tonumber(a), tonumber(b or 1) end) or sw("^%-?(%d%d%d)",setj) or sw("^%-?(%d%d)",function(a) setm(a);setd(1) end))
+ and ((sw("^%s*[Tt]?(%d%d):?",seth) and sw("^(%d%d):?",setr) and sw("^(%d%d)",sets) and sw("^(%.%d+)",adds))
+ or sw:finish() or (sw"^%s*$" or sw"^%s*[Zz]%s*$" or sw("^%s-([%+%-])(%d%d):?(%d%d)%s*$",setzc) or sw("^%s*([%+%-])(%d%d)%s*$",setzn))
+ ) )
+ then --print(y,m,d,h,r,s,z,w,u,j)
+ sw:restart(); y,m,d,h,r,s,z,w,u,j = nil;
+ repeat -- print(sw:aimchr())
+ if sw("^[tT:]?%s*(%d%d?):",seth) then --print("$Time")
+ _ = sw("^%s*(%d%d?)",setr) and sw("^%s*:%s*(%d%d?)",sets) and sw("^(%.%d+)",adds)
+ elseif sw("^(%d+)[/\\%s,-]?%s*") then --print("$Digits")
+ x, c = tonumber(sw[1]), len(sw[1])
+ if (x >= 70) or (m and d and (not y)) or (c > 3) then
+ sety( x + ((x >= 100 or c>3)and 0 or 1900) )
+ else
+ if m then setd(x) else m = x end
+ end
+ elseif sw("^(%a+)[/\\%s,-]?%s*") then --print("$Words")
+ x = sw[1]
+ if inlist(x, sl_months, 2, sw) then
+ if m and (not d) and (not y) then d, m = m, false end
+ setm(mod(sw[0],12)+1)
+ elseif inlist(x, sl_timezone, 2, sw) then
+ c = fix(sw[0]) -- ignore gmt and utc
+ if c ~= 0 then setz(c, x) end
+ elseif inlist(x, sl_weekdays, 2, sw) then
+ k = sw[0]
+ else
+ sw:back()
+ -- am pm bce ad ce bc
+ if sw("^([bB])%s*(%.?)%s*[Cc]%s*(%2)%s*[Ee]%s*(%2)%s*") or sw("^([bB])%s*(%.?)%s*[Cc]%s*(%2)%s*") then
+ e = e and error_dup() or -1
+ elseif sw("^([aA])%s*(%.?)%s*[Dd]%s*(%2)%s*") or sw("^([cC])%s*(%.?)%s*[Ee]%s*(%2)%s*") then
+ e = e and error_dup() or 1
+ elseif sw("^([PApa])%s*(%.?)%s*[Mm]?%s*(%2)%s*") then
+ x = lwr(sw[1]) -- there should be hour and it must be correct
+ if (not h) or (h > 12) or (h < 0) then return error_inv() end
+ if x == 'a' and h == 12 then h = 0 end -- am
+ if x == 'p' and h ~= 12 then h = h + 12 end -- pm
+ else error_syn() end
+ end
+ elseif not(sw("^([+-])(%d%d?):(%d%d)",setzc) or sw("^([+-])(%d+)",setzn) or sw("^[Zz]%s*$")) then -- sw{"([+-])",{"(%d%d?):(%d%d)","(%d+)"}}
+ error_syn("?")
+ end
+ sw("^%s*") until sw:finish()
+ --else print("$Iso(Date|Time|Zone)")
+ end
+ -- if date is given, it must be complete year, month & day
+ if (not y and not h) or ((m and not d) or (d and not m)) or ((m and w) or (m and j) or (j and w)) then return error_inv("!") end
+ -- fix month
+ if m then m = m - 1 end
+ -- fix year if we are on BCE
+ if e and e < 0 and y > 0 then y = 1 - y end
+ -- create date object
+ dn = (y and ((w and makedaynum_isoywd(y,w,u)) or (j and makedaynum(y, 0, j)) or makedaynum(y, m, d))) or DAYNUM_DEF
+ df = makedayfrc(h or 0, r or 0, s or 0, 0) + ((z or 0)*TICKSPERMIN)
+ --print("Zone",h,r,s,z,m,d,y,df)
+ return date_new(dn, df) -- no need to :normalize();
+ end
+ local function date_fromtable(v)
+ local y, m, d = fix(v.year), getmontharg(v.month), fix(v.day)
+ local h, r, s, t = tonumber(v.hour), tonumber(v.min), tonumber(v.sec), tonumber(v.ticks)
+ -- atleast there is time or complete date
+ if (y or m or d) and (not(y and m and d)) then return error("incomplete table") end
+ return (y or h or r or s or t) and date_new(y and makedaynum(y, m, d) or DAYNUM_DEF, makedayfrc(h or 0, r or 0, s or 0, t or 0))
+ end
+ local tmap = {
+ ['number'] = function(v) return date_epoch:copy():addseconds(v) end,
+ ['string'] = function(v) return date_parse(v) end,
+ ['boolean']= function(v) return date_fromtable(osdate(v and "!*t" or "*t")) end,
+ ['table'] = function(v) local ref = getmetatable(v) == dobj; return ref and v or date_fromtable(v), ref end
+ }
+ local function date_getdobj(v)
+ local o, r = (tmap[type(v)] or fnil)(v);
+ return (o and o:normalize() or error"invalid date time value"), r -- if r is true then o is a reference to a date obj
+ end
+--#end -- not DATE_OBJECT_AFX
+ local function date_from(...)
+ local arg = pack(...)
+ local y, m, d = fix(arg[1]), getmontharg(arg[2]), fix(arg[3])
+ local h, r, s, t = tonumber(arg[4] or 0), tonumber(arg[5] or 0), tonumber(arg[6] or 0), tonumber(arg[7] or 0)
+ if y and m and d and h and r and s and t then
+ return date_new(makedaynum(y, m, d), makedayfrc(h, r, s, t)):normalize()
+ else
+ return date_error_arg()
+ end
+ end
+
+ --[[ THE DATE OBJECT METHODS ]]--
+ function dobj:normalize()
+ local dn, df = fix(self.daynum), self.dayfrc
+ self.daynum, self.dayfrc = dn + floor(df/TICKSPERDAY), mod(df, TICKSPERDAY)
+ return (dn >= DAYNUM_MIN and dn <= DAYNUM_MAX) and self or error("date beyond imposed limits:"..self)
+ end
+
+ function dobj:getdate() local y, m, d = breakdaynum(self.daynum) return y, m+1, d end
+ function dobj:gettime() return breakdayfrc(self.dayfrc) end
+
+ function dobj:getclockhour() local h = self:gethours() return h>12 and mod(h,12) or (h==0 and 12 or h) end
+
+ function dobj:getyearday() return yearday(self.daynum) + 1 end
+ function dobj:getweekday() return weekday(self.daynum) + 1 end -- in lua weekday is sunday = 1, monday = 2 ...
+
+ function dobj:getyear() local r,_,_ = breakdaynum(self.daynum) return r end
+ function dobj:getmonth() local _,r,_ = breakdaynum(self.daynum) return r+1 end-- in lua month is 1 base
+ function dobj:getday() local _,_,r = breakdaynum(self.daynum) return r end
+ function dobj:gethours() return mod(floor(self.dayfrc/TICKSPERHOUR),HOURPERDAY) end
+ function dobj:getminutes() return mod(floor(self.dayfrc/TICKSPERMIN), MINPERHOUR) end
+ function dobj:getseconds() return mod(floor(self.dayfrc/TICKSPERSEC ),SECPERMIN) end
+ function dobj:getfracsec() return mod(floor(self.dayfrc/TICKSPERSEC ),SECPERMIN)+(mod(self.dayfrc,TICKSPERSEC)/TICKSPERSEC) end
+ function dobj:getticks(u) local x = mod(self.dayfrc,TICKSPERSEC) return u and ((x*u)/TICKSPERSEC) or x end
+
+ function dobj:getweeknumber(wdb)
+ local wd, yd = weekday(self.daynum), yearday(self.daynum)
+ if wdb then
+ wdb = tonumber(wdb)
+ if wdb then
+ wd = mod(wd-(wdb-1),7)-- shift the week day base
+ else
+ return date_error_arg()
+ end
+ end
+ return (yd < wd and 0) or (floor(yd/7) + ((mod(yd, 7)>=wd) and 1 or 0))
+ end
+
+ function dobj:getisoweekday() return mod(weekday(self.daynum)-1,7)+1 end -- sunday = 7, monday = 1 ...
+ function dobj:getisoweeknumber() return (isowy(self.daynum)) end
+ function dobj:getisoyear() return isoy(self.daynum) end
+ function dobj:getisodate()
+ local w, y = isowy(self.daynum)
+ return y, w, self:getisoweekday()
+ end
+ function dobj:setisoyear(y, w, d)
+ local cy, cw, cd = self:getisodate()
+ if y then cy = fix(tonumber(y))end
+ if w then cw = fix(tonumber(w))end
+ if d then cd = fix(tonumber(d))end
+ if cy and cw and cd then
+ self.daynum = makedaynum_isoywd(cy, cw, cd)
+ return self:normalize()
+ else
+ return date_error_arg()
+ end
+ end
+
+ function dobj:setisoweekday(d) return self:setisoyear(nil, nil, d) end
+ function dobj:setisoweeknumber(w,d) return self:setisoyear(nil, w, d) end
+
+ function dobj:setyear(y, m, d)
+ local cy, cm, cd = breakdaynum(self.daynum)
+ if y then cy = fix(tonumber(y))end
+ if m then cm = getmontharg(m) end
+ if d then cd = fix(tonumber(d))end
+ if cy and cm and cd then
+ self.daynum = makedaynum(cy, cm, cd)
+ return self:normalize()
+ else
+ return date_error_arg()
+ end
+ end
+
+ function dobj:setmonth(m, d)return self:setyear(nil, m, d) end
+ function dobj:setday(d) return self:setyear(nil, nil, d) end
+
+ function dobj:sethours(h, m, s, t)
+ local ch,cm,cs,ck = breakdayfrc(self.dayfrc)
+ ch, cm, cs, ck = tonumber(h or ch), tonumber(m or cm), tonumber(s or cs), tonumber(t or ck)
+ if ch and cm and cs and ck then
+ self.dayfrc = makedayfrc(ch, cm, cs, ck)
+ return self:normalize()
+ else
+ return date_error_arg()
+ end
+ end
+
+ function dobj:setminutes(m,s,t) return self:sethours(nil, m, s, t) end
+ function dobj:setseconds(s, t) return self:sethours(nil, nil, s, t) end
+ function dobj:setticks(t) return self:sethours(nil, nil, nil, t) end
+
+ function dobj:spanticks() return (self.daynum*TICKSPERDAY + self.dayfrc) end
+ function dobj:spanseconds() return (self.daynum*TICKSPERDAY + self.dayfrc)/TICKSPERSEC end
+ function dobj:spanminutes() return (self.daynum*TICKSPERDAY + self.dayfrc)/TICKSPERMIN end
+ function dobj:spanhours() return (self.daynum*TICKSPERDAY + self.dayfrc)/TICKSPERHOUR end
+ function dobj:spandays() return (self.daynum*TICKSPERDAY + self.dayfrc)/TICKSPERDAY end
+
+ function dobj:addyears(y, m, d)
+ local cy, cm, cd = breakdaynum(self.daynum)
+ if y then y = fix(tonumber(y))else y = 0 end
+ if m then m = fix(tonumber(m))else m = 0 end
+ if d then d = fix(tonumber(d))else d = 0 end
+ if y and m and d then
+ self.daynum = makedaynum(cy+y, cm+m, cd+d)
+ return self:normalize()
+ else
+ return date_error_arg()
+ end
+ end
+
+ function dobj:addmonths(m, d)
+ return self:addyears(nil, m, d)
+ end
+
+ local function dobj_adddayfrc(self,n,pt,pd)
+ n = tonumber(n)
+ if n then
+ local x = floor(n/pd);
+ self.daynum = self.daynum + x;
+ self.dayfrc = self.dayfrc + (n-x*pd)*pt;
+ return self:normalize()
+ else
+ return date_error_arg()
+ end
+ end
+ function dobj:adddays(n) return dobj_adddayfrc(self,n,TICKSPERDAY,1) end
+ function dobj:addhours(n) return dobj_adddayfrc(self,n,TICKSPERHOUR,HOURPERDAY) end
+ function dobj:addminutes(n) return dobj_adddayfrc(self,n,TICKSPERMIN,MINPERDAY) end
+ function dobj:addseconds(n) return dobj_adddayfrc(self,n,TICKSPERSEC,SECPERDAY) end
+ function dobj:addticks(n) return dobj_adddayfrc(self,n,1,TICKSPERDAY) end
+ local tvspec = {
+ -- Abbreviated weekday name (Sun)
+ ['%a']=function(self) return sl_weekdays[weekday(self.daynum) + 7] end,
+ -- Full weekday name (Sunday)
+ ['%A']=function(self) return sl_weekdays[weekday(self.daynum)] end,
+ -- Abbreviated month name (Dec)
+ ['%b']=function(self) return sl_months[self:getmonth() - 1 + 12] end,
+ -- Full month name (December)
+ ['%B']=function(self) return sl_months[self:getmonth() - 1] end,
+ -- Year/100 (19, 20, 30)
+ ['%C']=function(self) return fmt("%.2d", fix(self:getyear()/100)) end,
+ -- The day of the month as a number (range 1 - 31)
+ ['%d']=function(self) return fmt("%.2d", self:getday()) end,
+ -- year for ISO 8601 week, from 00 (79)
+ ['%g']=function(self) return fmt("%.2d", mod(self:getisoyear() ,100)) end,
+ -- year for ISO 8601 week, from 0000 (1979)
+ ['%G']=function(self) return fmt("%.4d", self:getisoyear()) end,
+ -- same as %b
+ ['%h']=function(self) return self:fmt0("%b") end,
+ -- hour of the 24-hour day, from 00 (06)
+ ['%H']=function(self) return fmt("%.2d", self:gethours()) end,
+ -- The hour as a number using a 12-hour clock (01 - 12)
+ ['%I']=function(self) return fmt("%.2d", self:getclockhour()) end,
+ -- The day of the year as a number (001 - 366)
+ ['%j']=function(self) return fmt("%.3d", self:getyearday()) end,
+ -- Month of the year, from 01 to 12
+ ['%m']=function(self) return fmt("%.2d", self:getmonth()) end,
+ -- Minutes after the hour 55
+ ['%M']=function(self) return fmt("%.2d", self:getminutes())end,
+ -- AM/PM indicator (AM)
+ ['%p']=function(self) return sl_meridian[self:gethours() > 11 and 1 or -1] end, --AM/PM indicator (AM)
+ -- The second as a number (59, 20 , 01)
+ ['%S']=function(self) return fmt("%.2d", self:getseconds()) end,
+ -- ISO 8601 day of the week, to 7 for Sunday (7, 1)
+ ['%u']=function(self) return self:getisoweekday() end,
+ -- Sunday week of the year, from 00 (48)
+ ['%U']=function(self) return fmt("%.2d", self:getweeknumber()) end,
+ -- ISO 8601 week of the year, from 01 (48)
+ ['%V']=function(self) return fmt("%.2d", self:getisoweeknumber()) end,
+ -- The day of the week as a decimal, Sunday being 0
+ ['%w']=function(self) return self:getweekday() - 1 end,
+ -- Monday week of the year, from 00 (48)
+ ['%W']=function(self) return fmt("%.2d", self:getweeknumber(2)) end,
+ -- The year as a number without a century (range 00 to 99)
+ ['%y']=function(self) return fmt("%.2d", mod(self:getyear() ,100)) end,
+ -- Year with century (2000, 1914, 0325, 0001)
+ ['%Y']=function(self) return fmt("%.4d", self:getyear()) end,
+ -- Time zone offset, the date object is assumed local time (+1000, -0230)
+ ['%z']=function(self) local b = -self:getbias(); local x = abs(b); return fmt("%s%.4d", b < 0 and "-" or "+", fix(x/60)*100 + floor(mod(x,60))) end,
+ -- Time zone name, the date object is assumed local time
+ ['%Z']=function(self) return self:gettzname() end,
+ -- Misc --
+ -- Year, if year is in BCE, prints the BCE Year representation, otherwise result is similar to "%Y" (1 BCE, 40 BCE)
+ ['%\b']=function(self) local x = self:getyear() return fmt("%.4d%s", x>0 and x or (-x+1), x>0 and "" or " BCE") end,
+ -- Seconds including fraction (59.998, 01.123)
+ ['%\f']=function(self) local x = self:getfracsec() return fmt("%s%.9f",x >= 10 and "" or "0", x) end,
+ -- percent character %
+ ['%%']=function(self) return "%" end,
+ -- Group Spec --
+ -- 12-hour time, from 01:00:00 AM (06:55:15 AM); same as "%I:%M:%S %p"
+ ['%r']=function(self) return self:fmt0("%I:%M:%S %p") end,
+ -- hour:minute, from 01:00 (06:55); same as "%I:%M"
+ ['%R']=function(self) return self:fmt0("%I:%M") end,
+ -- 24-hour time, from 00:00:00 (06:55:15); same as "%H:%M:%S"
+ ['%T']=function(self) return self:fmt0("%H:%M:%S") end,
+ -- month/day/year from 01/01/00 (12/02/79); same as "%m/%d/%y"
+ ['%D']=function(self) return self:fmt0("%m/%d/%y") end,
+ -- year-month-day (1979-12-02); same as "%Y-%m-%d"
+ ['%F']=function(self) return self:fmt0("%Y-%m-%d") end,
+ -- The preferred date and time representation; same as "%x %X"
+ ['%c']=function(self) return self:fmt0("%x %X") end,
+ -- The preferred date representation, same as "%a %b %d %\b"
+ ['%x']=function(self) return self:fmt0("%a %b %d %\b") end,
+ -- The preferred time representation, same as "%H:%M:%\f"
+ ['%X']=function(self) return self:fmt0("%H:%M:%\f") end,
+ -- GroupSpec --
+ -- Iso format, same as "%Y-%m-%dT%T"
+ ['${iso}'] = function(self) return self:fmt0("%Y-%m-%dT%T") end,
+ -- http format, same as "%a, %d %b %Y %T GMT"
+ ['${http}'] = function(self) return self:fmt0("%a, %d %b %Y %T GMT") end,
+ -- ctime format, same as "%a %b %d %T GMT %Y"
+ ['${ctime}'] = function(self) return self:fmt0("%a %b %d %T GMT %Y") end,
+ -- RFC850 format, same as "%A, %d-%b-%y %T GMT"
+ ['${rfc850}'] = function(self) return self:fmt0("%A, %d-%b-%y %T GMT") end,
+ -- RFC1123 format, same as "%a, %d %b %Y %T GMT"
+ ['${rfc1123}'] = function(self) return self:fmt0("%a, %d %b %Y %T GMT") end,
+ -- asctime format, same as "%a %b %d %T %Y"
+ ['${asctime}'] = function(self) return self:fmt0("%a %b %d %T %Y") end,
+ }
+ function dobj:fmt0(str) return (gsub(str, "%%[%a%%\b\f]", function(x) local f = tvspec[x];return (f and f(self)) or x end)) end
+ function dobj:fmt(str)
+ str = str or self.fmtstr or fmtstr
+ return self:fmt0((gmatch(str, "${%w+}")) and (gsub(str, "${%w+}", function(x)local f=tvspec[x];return (f and f(self)) or x end)) or str)
+ end
+
+ function dobj.__lt(a, b) if (a.daynum == b.daynum) then return (a.dayfrc < b.dayfrc) else return (a.daynum < b.daynum) end end
+ function dobj.__le(a, b) if (a.daynum == b.daynum) then return (a.dayfrc <= b.dayfrc) else return (a.daynum <= b.daynum) end end
+ function dobj.__eq(a, b)return (a.daynum == b.daynum) and (a.dayfrc == b.dayfrc) end
+ function dobj.__sub(a,b)
+ local d1, d2 = date_getdobj(a), date_getdobj(b)
+ local d0 = d1 and d2 and date_new(d1.daynum - d2.daynum, d1.dayfrc - d2.dayfrc)
+ return d0 and d0:normalize()
+ end
+ function dobj.__add(a,b)
+ local d1, d2 = date_getdobj(a), date_getdobj(b)
+ local d0 = d1 and d2 and date_new(d1.daynum + d2.daynum, d1.dayfrc + d2.dayfrc)
+ return d0 and d0:normalize()
+ end
+ function dobj.__concat(a, b) return tostring(a) .. tostring(b) end
+ function dobj:__tostring() return self:fmt() end
+
+ function dobj:copy() return date_new(self.daynum, self.dayfrc) end
+
+--[[ THE LOCAL DATE OBJECT METHODS ]]--
+ function dobj:tolocal()
+ local dn,df = self.daynum, self.dayfrc
+ local bias = getbiasutc2(self)
+ if bias then
+ -- utc = local + bias; local = utc - bias
+ self.daynum = dn
+ self.dayfrc = df - bias*TICKSPERSEC
+ return self:normalize()
+ else
+ return nil
+ end
+ end
+
+ function dobj:toutc()
+ local dn,df = self.daynum, self.dayfrc
+ local bias = getbiasloc2(dn, df)
+ if bias then
+ -- utc = local + bias;
+ self.daynum = dn
+ self.dayfrc = df + bias*TICKSPERSEC
+ return self:normalize()
+ else
+ return nil
+ end
+ end
+
+ function dobj:getbias() return (getbiasloc2(self.daynum, self.dayfrc))/SECPERMIN end
+
+ function dobj:gettzname()
+ local _, tvu, _ = getbiasloc2(self.daynum, self.dayfrc)
+ return tvu and osdate("%Z",tvu) or ""
+ end
+
+--#if not DATE_OBJECT_AFX then
+ function date.time(h, r, s, t)
+ h, r, s, t = tonumber(h or 0), tonumber(r or 0), tonumber(s or 0), tonumber(t or 0)
+ if h and r and s and t then
+ return date_new(DAYNUM_DEF, makedayfrc(h, r, s, t))
+ else
+ return date_error_arg()
+ end
+ end
+
+ function date:__call(...)
+ local arg = pack(...)
+ if arg.n > 1 then return (date_from(...))
+ elseif arg.n == 0 then return (date_getdobj(false))
+ else local o, r = date_getdobj(arg[1]); return r and o:copy() or o end
+ end
+
+ date.diff = dobj.__sub
+
+ function date.isleapyear(v)
+ local y = fix(v);
+ if not y then
+ y = date_getdobj(v)
+ y = y and y:getyear()
+ end
+ return isleapyear(y+0)
+ end
+
+ function date.epoch() return date_epoch:copy() end
+
+ function date.isodate(y,w,d) return date_new(makedaynum_isoywd(y + 0, w and (w+0) or 1, d and (d+0) or 1), 0) end
+
+-- Internal functions
+ function date.fmt(str) if str then fmtstr = str end; return fmtstr end
+ function date.daynummin(n) DAYNUM_MIN = (n and n < DAYNUM_MAX) and n or DAYNUM_MIN return n and DAYNUM_MIN or date_new(DAYNUM_MIN, 0):normalize()end
+ function date.daynummax(n) DAYNUM_MAX = (n and n > DAYNUM_MIN) and n or DAYNUM_MAX return n and DAYNUM_MAX or date_new(DAYNUM_MAX, 0):normalize()end
+ function date.ticks(t) if t then setticks(t) end return TICKSPERSEC end
+--#end -- not DATE_OBJECT_AFX
+
+ local tm = osdate("!*t", 0);
+ if tm then
+ date_epoch = date_new(makedaynum(tm.year, tm.month - 1, tm.day), makedayfrc(tm.hour, tm.min, tm.sec, 0))
+ -- the distance from our epoch to os epoch in daynum
+ DATE_EPOCH = date_epoch and date_epoch:spandays()
+ else -- error will be raise only if called!
+ date_epoch = setmetatable({},{__index = function() error("failed to get the epoch date") end})
+ end
+
+--#if not DATE_OBJECT_AFX then
+return date
+--#else
+--$return date_from
+--#end
+
diff --git a/Master/texmf-dist/tex/lualatex/wallcalendar/wallcalendar-helpers.lua b/Master/texmf-dist/tex/lualatex/wallcalendar/wallcalendar-helpers.lua
new file mode 100644
index 00000000000..99314dd0bfe
--- /dev/null
+++ b/Master/texmf-dist/tex/lualatex/wallcalendar/wallcalendar-helpers.lua
@@ -0,0 +1,279 @@
+-- paths are relative to wallcalendar.cls
+local csv = require("wallcalendar-csv.lua")
+local date = require("wallcalendar-date.lua")
+local tp = tex.print
+local tsp = tex.sprint
+
+function loadCsv(csv_path)
+ local f = csv.open(csv_path, {separator = ";", header = true})
+ local data = {}
+ for fields in f:lines() do
+ data[#data + 1] = fields
+ end
+ return data
+end
+
+function ok(x)
+ return x ~= nil and x ~= ""
+end
+
+function hasNote(event)
+ return ok(event.note)
+end
+
+function monthNameToNum(monthName)
+ local months = {january = 1, february = 2, march = 3, april = 4, may = 5, june = 6, july = 7, august = 8, september = 9, october = 10, november = 11, december = 12}
+ return months[string.lower(monthName)]
+end
+
+function getMark(idx, events, markDefaults, isNote)
+ local event = events[idx]
+ local default_mark = {}
+ default_mark.number = {}
+ default_mark.day_text = {}
+ default_mark.note = {}
+
+ default_mark.number.symbol = idx
+ default_mark.number.above_offset = "\\markNumberAbove"
+ default_mark.number.right_offset = "\\markNumberRight"
+
+ default_mark.day_text.symbol = idx
+ default_mark.day_text.above_offset = "\\markDayTextAbove"
+ default_mark.day_text.right_offset = "\\markDayTextRight"
+
+ default_mark.note.symbol = idx
+ default_mark.note.above_offset = "" -- placeholder, not used for note
+ default_mark.note.right_offset = "" -- placeholder, not used for note
+
+ local mark = {}
+
+ for k,v in pairs(default_mark.number) do
+ local m = {}
+ local mark_key = ""
+ local csv_key = ""
+
+ if ok(isNote) then
+ mark_key = "note"
+ elseif ok(event.day_text) then
+ mark_key = "day_text"
+ else
+ mark_key = "number"
+ end
+
+ m = default_mark[mark_key]
+ csv_key = mark_key .. "_" .. k
+
+ if not ok(markDefaults) or not ok(markDefaults[idx]) or not ok(markDefaults[idx][csv_key]) then
+ mark[k] = m[k]
+ else
+ mark[k] = markDefaults[idx][csv_key]
+ end
+ end
+
+ return mark
+end
+
+function getCombinedMark(idx, events, markDefaults, isNote)
+ local event = events[idx]
+ local mark = getMark(idx, events, markDefaults, isNote)
+
+ mark.symbol = ""
+ for i,e in pairs(events) do
+ if e.date == event.date then
+ local m = getMark(i, events, markDefaults, isNote)
+ if mark.symbol == "" then
+ mark.symbol = m.symbol
+ else
+ mark.symbol = mark.symbol .. "\\symbolSeparator " .. m.symbol
+ end
+ end
+ end
+
+ return mark
+end
+
+function collectEvents(byWhat, events, byValue, filterPred)
+ local data = {}
+ for idx,row in pairs(events) do
+ d = date(row.date)
+
+ if filterPred ~= nil then
+ if byWhat == 'month' then
+ if d:getmonth() == byValue and filterPred(row) then
+ data[#data + 1] = row
+ end
+ elseif byWhat == 'year' then
+ if d:getyear() == byValue and filterPred(row) then
+ data[#data + 1] = row
+ end
+ end
+ else
+ if byWhat == 'month' then
+ if d:getmonth() == byValue then
+ data[#data + 1] = row
+ end
+ elseif byWhat == 'year' then
+ if d:getyear() == byValue then
+ data[#data + 1] = row
+ end
+ end
+ end
+
+ end
+ return data
+end
+
+function eventsInMonth(events, month, filterPred)
+ return collectEvents('month', events, month, filterPred)
+end
+
+function eventsInYear(events, year, filterPred)
+ return collectEvents('year', events, year, filterPred)
+end
+
+function formatEvents(events, formatFunc, formatCmd, markDefaultsCsv, minEvents)
+ if ok(minEvents) and #events < minEvents then
+ d = minEvents - #events
+ for i=0,d,1 do
+ events[#events + 1] = {}
+ end
+ end
+
+ local markDefaults = nil
+ if ok(markDefaultsCsv) then
+ markDefaults = loadCsv(markDefaultsCsv)
+ end
+
+ for idx,event in pairs(events) do
+ local mark = {}
+ local d = {}
+
+ if ok(event.date) then
+ -- don't use getCombinedMark here, events on the same day will be printed one after the other
+ mark = getMark(idx, events, markDefaults, true)
+ d = date(event.date)
+ end
+
+ if formatFunc then
+
+ formatFunc(idx, #events, event, d, mark)
+
+ else
+
+ tsp("\\def\\eIdx{"..idx .."}") -- \def\eIdx{1}
+ tsp("\\def\\eMaxIdx{"..#events .."}") -- \def\eMaxIdx{8}
+ tsp("\\def\\eMark{"..mark.symbol .."}") -- \def\eMark{\kiteMark}
+ tsp("\\def\\eIsoDate{"..event.date .."}") -- \def\eIsoDate{2018-01-12}
+ tsp("\\def\\eYear{"..d:getyear() .."}") -- \def\eYear{2018}
+ tsp("\\def\\eMonth{\\x"..d:fmt("%B") .."}") -- \def\eMonth\xJanuary
+ tsp("\\def\\eMonthShort{\\x"..d:fmt("%b").."Short" .."}") -- \def\eMonthShort\xJanShort
+ tsp("\\def\\eDay{"..d:getday() .."}") -- \def\eDay{12}
+ if ok(event.day_text) then
+ tsp("\\def\\eDayText{"..event.day_text .."}") -- \def\eDayText{\dejaVuSans\char"263C}
+ else
+ tsp("\\def\\eDayText{}")
+ end
+ if ok(event.note) then
+ tsp("\\def\\eNote{"..event.note .."}") -- \def\eNote{Anniversary Day}
+ else
+ tsp("\\def\\eNote{}")
+ end
+
+ tsp(formatCmd)
+
+ end
+ end
+end
+
+-- It's better to call it with the name of the month than its number because it
+-- fits the wrapper commands better.
+function monthEvents(monthName, filterPred, formatFunc, formatCmd, eventsCsv, markDefaultsCsv, minEvents)
+ local monthNum = monthNameToNum(monthName)
+ local events = eventsInMonth(loadCsv(eventsCsv), monthNum, filterPred)
+
+ formatEvents(events, formatFunc, formatCmd, markDefaultsCsv, minEvents)
+end
+
+function yearEvents(yearNum, filterPred, formatFunc, formatCmd, eventsCsv, markDefaultsCsv, minEvents)
+ local events = eventsInYear(loadCsv(eventsCsv), yearNum, filterPred)
+
+ formatEvents(events, formatFunc, formatCmd, markDefaultsCsv, minEvents)
+end
+
+-- monthName is better for argument than monthNum
+function monthMarksDayText(monthName, filterPred, eventsCsv)
+ local monthNum = monthNameToNum(monthName)
+ local events = eventsInMonth(loadCsv(eventsCsv), monthNum, filterPred);
+
+ for idx,event in pairs(events) do
+ if ok(event.day_text) then
+ tsp(string.format(" if (equals=%s) [day text={%s}, xshift=\\dayTextXshift, yshift=\\dayTextYshift] ", event.date, event.day_text))
+ end
+ end
+end
+
+function yearMarksDayText(yearNum, filterPred, eventsCsv)
+ local events = eventsInYear(loadCsv(eventsCsv), yearNum, filterPred);
+
+ for idx,event in pairs(events) do
+ if ok(event.day_text) then
+ tsp(string.format(" if (equals=%s) [day text={%s}, xshift=\\dayTextXshift, yshift=\\dayTextYshift] ", event.date, event.day_text))
+ end
+ end
+end
+
+function formatMarksNote(events, filterPred, markDefaultsCsv, isOneCalendar)
+ local markDefaults = nil
+ if ok(markDefaultsCsv) then
+ markDefaults = loadCsv(markDefaultsCsv)
+ end
+
+ local alreadyMarkedDates = {}
+
+ for idx,event in pairs(events) do
+ if ok(event.note) and alreadyMarkedDates[event.date] == nil then
+ alreadyMarkedDates[event.date] = true
+ local d = date(event.date)
+
+ local mark = getCombinedMark(idx, events, markDefaults)
+
+ if ok(isOneCalendar) and isOneCalendar == true then
+ tsp(string.format(" \\draw node [above right=%s and %s of cal-%s.north east] {\\monthMarkFmt %s}; ",
+ mark.above_offset,
+ mark.right_offset,
+ event.date,
+ mark.symbol))
+ else
+ tsp(string.format(" \\draw node [above right=%s and %s of cal%s-%s.north east] {\\monthMarkFmt %s}; ",
+ mark.above_offset,
+ mark.right_offset,
+ d:fmt("%m"),
+ event.date,
+ mark.symbol))
+ end
+ end
+ end
+end
+
+-- monthName is better for argument than monthNum
+function monthMarksNote(monthName, filterPred, eventsCsv, markDefaultsCsv)
+ local monthNum = monthNameToNum(monthName)
+
+ if not ok(filterPred) then
+ filterPred = function(e) return ok(e.note) end
+ end
+
+ local events = eventsInMonth(loadCsv(eventsCsv), monthNum, filterPred);
+
+ formatMarksNote(events, filterPred, markDefaultsCsv, false)
+end
+
+function yearMarksNote(yearNum, filterPred, eventsCsv, markDefaultsCsv, isOneCalendar)
+ if not ok(filterPred) then
+ filterPred = function(e) return ok(e.note) end
+ end
+
+ local events = eventsInYear(loadCsv(eventsCsv), yearNum, filterPred);
+
+ formatMarksNote(events, filterPred, markDefaultsCsv, isOneCalendar)
+end
diff --git a/Master/texmf-dist/tex/lualatex/wallcalendar/wallcalendar.cls b/Master/texmf-dist/tex/lualatex/wallcalendar/wallcalendar.cls
new file mode 100644
index 00000000000..be0cc5ef962
--- /dev/null
+++ b/Master/texmf-dist/tex/lualatex/wallcalendar/wallcalendar.cls
@@ -0,0 +1,1714 @@
+% wallcalendar.cls; Don't edit this file. Edit wallcalendar-code.org with emacs org-mode and call 'org-babel-tangle'.
+%
+% Wall Calendar
+%
+% A wall calendar document class with custom layouts and support for internationalization.
+%
+% (c) Gambhiro Bhikkhu, 2017
+% gambhiro.bhikkhu.85@gmail.com
+%
+% LPPL LaTeX Public Project License
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesClass{wallcalendar}[2017/10/21 v1.3.1 A wall calendar class with custom layouts and support for internationalization.]
+
+\RequirePackage{pgfopts}
+\RequirePackage{calc}
+
+\newlength\calPaperWidth
+\newlength\calPaperHeight
+\newlength\@wall@leftMargin
+\newlength\@wall@rightMargin
+\newlength\@wall@topMargin
+\newlength\@wall@bottomMargin
+
+\def\@wall@eventsCsv{}
+\def\@wall@markDefaultsCsv{}
+\def\@wall@translationsInputFile{}
+
+\newcommand*\theMonthName{}
+
+\newif\ifvarnishmask
+\newif\ifshowframe
+\newif\iftranslationsAutoload
+\newif\ifloadBabel
+
+\pgfkeys{
+ /wall/.is family, /wall,
+ defaults/.style = {
+ year = \the\year,
+ altyear = \empty,
+ loadBabel = false,
+ language = english,
+ translationsAutoload = true,
+ imageFolder = {./src-images},
+ choralOctavoPaper,
+ hMargin = 17mm,
+ topMargin = 20.5mm,
+ bottomMargin = 10mm,
+ },
+ year/.store in = \CalendarYear,
+ year/.initial = \the\year,
+ altyear/.store in = \CalendarAltYear,
+ altyear/.initial = \empty,
+ language/.store in = \@wall@calendarLanguage,
+ loadBabel/.is if = loadBabel,
+ translationsInputFile/.store in = \@wall@translationsInputFile,
+ translationsInputFile/.initial = {},
+ translationsAutoload/.is if = translationsAutoload,
+ eventsCsv/.store in = \@wall@eventsCsv,
+ eventsCsv/.initial = {},
+ markDefaultsCsv/.store in = \@wall@markDefaultsCsv,
+ markDefaultsCsv/.initial = {},
+ varnishmask/.is if = varnishmask,
+ showframe/.is if = showframe,
+ imageFolder/.store in = \@wall@imageFolder,
+ paperWidth/.code = {\setlength{\calPaperWidth}{#1}},
+ paperHeight/.code = {\setlength{\calPaperHeight}{#1}},
+ hMargin/.code = {\setlength{\@wall@leftMargin}{#1}%
+ \setlength{\@wall@rightMargin}{#1}},
+ leftMargin/.code = {\setlength{\@wall@leftMargin}{#1}},
+ rightMargin/.code = {\setlength{\@wall@rightMargin}{#1}},
+ topMargin/.code = {\setlength{\@wall@topMargin}{#1}},
+ bottomMargin/.code = {\setlength{\@wall@bottomMargin}{#1}},
+ % Paper sizes
+ choralOctavoPaper/.style = {paperWidth = 6.75in, paperHeight = 10.5in},
+ a2Paper/.style = {paperWidth = 420mm, paperHeight = 594mm},
+ a2PaperLandscape/.style = {paperWidth = 594mm, paperHeight = 420mm},
+ a3Paper/.style = {paperWidth = 297mm, paperHeight = 420mm},
+ a3PaperLandscape/.style = {paperWidth = 420mm, paperHeight = 297mm},
+ a4Paper/.style = {paperWidth = 210mm, paperHeight = 297mm},
+ a4PaperLandscape/.style = {paperWidth = 297mm, paperHeight = 210mm},
+ a5Paper/.style = {paperWidth = 148mm, paperHeight = 210mm},% r = 1.4142 = sqrt(2)
+ prevPaper/.style = {paperWidth = 170mm, paperHeight = 250mm},% r = 1.4705
+}
+
+% Debug with: \wlog{YEA: \the\@wall@bottomMargin}
+
+\DeclareOption*{%
+ \PassOptionsToClass{\CurrentOption}{memoir}
+}
+
+\pgfkeys{/wall, defaults}
+\ProcessPgfOptions{/wall}
+\ProcessOptions\relax
+
+\LoadClass[11pt,oneside]{memoir}
+
+\newlength\@tmp@a
+\newlength\@tmp@b
+\newlength\@tmp@c
+\newlength\@tmp@width
+\newlength\@tmp@height
+
+\ifloadBabel
+\RequirePackage[\@wall@calendarLanguage]{babel}
+\fi
+
+\RequirePackage{nag}
+%\RequirePackage{textcomp}
+\RequirePackage[cmyk]{xcolor}
+\RequirePackage{graphicx}
+\DeclareGraphicsExtensions{.pdf,.png,.jpg}
+\graphicspath{{\@wall@imageFolder}}
+
+\RequirePackage{eso-pic}
+\RequirePackage{ccicons}
+\RequirePackage{multicol}
+\RequirePackage{wasysym}
+
+\RequirePackage{pdftexcmds}
+\RequirePackage{etoolbox}
+\RequirePackage{luacode}
+
+\RequirePackage{xcoffins}
+%\RequirePackage{xstring}
+%\RequirePackage{stringstrings}
+
+\ifloadBabel
+\RequirePackage[final,babel=true]{microtype}
+\else
+\RequirePackage[final]{microtype}
+\fi
+
+\RequirePackage{tikz}
+\usetikzlibrary{calendar}
+\usetikzlibrary{positioning}
+\usetikzlibrary{fit}
+\usetikzlibrary{shapes.geometric}
+
+% http://tex.stackexchange.com/a/20426/831
+\pgfdeclarelayer{one}
+\pgfdeclarelayer{two}
+\pgfsetlayers{main,one,two}
+
+\pgfkeys{%
+ /tikz/on layer/.code={
+ \pgfonlayer{#1}\begingroup
+ \aftergroup\endpgfonlayer
+ \aftergroup\endgroup
+ }
+}
+
+\definecolor{textbody}{gray}{0.15}
+
+% pantone 1245C, RGB 191,145,12 HEX: #BF910C
+% pantone 1255C, CMYK 0,27.5,100,34
+\definecolor{gold}{cmyk}{0,0.275,1,0.34}
+\definecolor{darkgold}{cmyk}{0.27,0.53,1,0.09}
+%\definecolor{orangegold}{cmyk}{0,0.31,0.89,0}
+\colorlet{orangegold}{darkgold}
+
+\colorlet{gridcolor}{black!30}
+\colorlet{weekday}{black}
+\colorlet{weekend}{black!50}
+\colorlet{mooncolor}{textbody}
+
+\definecolor{datenum}{gray}{0.3}
+\definecolor{plannerdatenum}{gray}{0.15}
+\definecolor{quote}{gray}{0.3}
+\definecolor{notes}{gray}{0.3}
+
+\definecolor{gridcolor}{gray}{0.5}
+\colorlet{pagebgcolor}{gridcolor!60}
+
+\colorlet{photo-frame}{blue}
+\colorlet{quote-frame}{red}
+\colorlet{heading-frame}{brown}
+\colorlet{calendar-frame}{orange}
+\colorlet{events-frame}{green}
+
+\ifshowframe
+ \colorlet{calendarbg}{black!50}
+\else
+ \colorlet{calendarbg}{white}
+\fi
+
+\ifshowtrims
+ \setstocksize{\calPaperHeight + 35mm}{\calPaperWidth + 35mm}
+ \setlength{\paperheight}{\calPaperHeight}
+ \setlength{\paperwidth}{\calPaperWidth}
+ \trimXmarks
+ \trimLmarks
+ \quarkmarks
+ \settrims{0.5\stockheight - 0.5\paperheight}{0.5\stockwidth - 0.5\paperwidth}
+ \settrimmedsize{\calPaperHeight}{\calPaperWidth}{*}
+\else\relax
+ \setstocksize{\calPaperHeight}{\calPaperWidth}
+ \settrims{0pt}{0pt}
+ \settrimmedsize{\stockheight}{\stockwidth}{*}
+\fi
+
+%\settypeblocksize{\stockheight}{\stockwidth}{*}
+% TODO: calculate margins by ratios to paper size
+\setlrmarginsandblock{\@wall@leftMargin}{\@wall@rightMargin}{*}
+\setulmarginsandblock{\@wall@topMargin}{\@wall@bottomMargin}{*}
+\setheadfoot{0pt}{0pt}
+\setheaderspaces{0pt}{*}{*}
+
+\checkandfixthelayout% This will typeout values in pt.
+\settypeoutlayoutunit{mm}% It is useful to see layout values in mm too.
+\typeoutlayout
+
+\def\@wall@fontSize{11}
+\def\@wall@lineHeight{13.6}
+
+\renewcommand{\normalsize}{%
+ \@setfontsize\normalsize\@wall@fontSize\@wall@lineHeight
+ \abovedisplayskip 11\p@ \@plus3\p@ \@minus6\p@
+ \abovedisplayshortskip \z@ \@plus3\p@
+ \belowdisplayshortskip 6.5\p@ \@plus3.5\p@ \@minus3\p@
+ \belowdisplayskip \abovedisplayskip
+ \color{textbody}
+ \let\@listi\@listI}
+\normalsize
+
+\setlength{\vgap}{1.5em}
+\setlength{\vindent}{\vgap}
+\setlength{\vleftmargin}{2em}
+
+\setlength{\parskip}{0pt}
+\setlength{\parindent}{0pt}
+
+\setlength{\fboxsep}{0pt}
+
+\definecolor{varnishmask}{gray}{0}
+
+% http://tex.stackexchange.com/a/59571/831
+\newcommand*{\strcmpblank}[3]{%
+ \ifnum\pdf@strcmp{#1}{}=\z@ #2\else #3\fi
+}
+
+\newcommand\@placeholder@pre[1]{%
+ \settowidth{\@tmp@width}{#1}%
+ \settototalheight{\@tmp@height}{#1}%
+ \def\@spacer{\rule{\@tmp@width}{0pt}\rule{0pt}{\@tmp@height}}%
+}
+
+\newcommand\placeholder[3][]{%
+ \ifvarnishmask%
+ \ifstrequal{#2}{hasvarnish}{%
+ \@placeholder@pre{#3}%
+ \tikz\node[fill=varnishmask, inner sep=0pt]{\@spacer};%
+ }{}%
+ \else%
+ \ifshowframe%
+ \@placeholder@pre{#3}%
+ \tikz\node[inner sep=0pt, opacity=0.6, #1]{\@spacer};%
+ \else%
+ #3%
+ \fi%
+ \fi%
+}
+
+\def\@wall@photo@putPhoto#1{#1}
+\def\@wall@photo@setYOffset{}
+
+\pgfkeys{
+ /put photo/.is family, /put photo,
+ simple/.code = {%
+ \def\@wall@photo@putPhoto##1{%
+ \includegraphics{##1}%
+ }%
+ \def\@wall@photo@setYOffset{}%
+ },
+ full page/.code = {%
+ \def\@wall@photo@putPhoto##1{%
+ \includegraphics[%
+ keepaspectratio,%
+ width={\calPaperWidth + 2\@t@bleed},%
+ ]{##1}%
+ }%
+ \def\@wall@photo@setYOffset{}%
+ },
+ full width above calendar/.code = {%
+ \def\@wall@photo@putPhoto##1{%
+ \includegraphics[%
+ keepaspectratio,%
+ width={\calPaperWidth + 2\@t@bleed},%
+ ]{##1}%
+ }%
+ \def\@wall@photo@setYOffset{%
+ \setlength{\@t@yOffset}{\@t@calendar@height + \@t@bleed + 1pt}%
+ }%
+ },
+ full width/.code = {%
+ \def\@wall@photo@putPhoto##1{%
+ \includegraphics[%
+ keepaspectratio,%
+ width={\calPaperWidth + 2\@t@bleed},%
+ ]{##1}%
+ }%
+ \def\@wall@photo@setYOffset{%
+ \setlength{\@t@yOffset}{\@t@calendar@height + \@t@bleed}%
+ }%
+ },
+}
+
+\pgfkeys{
+ /Photo/.is family, /Photo,
+ init/.style = {
+ defaults/.style = {file = {}, thumbFile = {}, caption = {}, bleed = 0pt, xOffset=0pt, yOffset=0pt},
+ file/.initial = {},
+ thumbFile/.initial = {},
+ caption/.initial = {},
+ bleed/.initial = 0pt,
+ xOffset/.initial = 0pt,
+ yOffset/.initial = 0pt,
+ },
+}
+
+\pgfkeys{
+ /Quote/.is family, /Quote,
+ init/.style = {
+ defaults/.style = {position=center, text={}, xOffset=0pt, yOffset=0pt},
+ position/.initial = {},
+ text/.initial = {},
+ xOffset/.initial = 0pt,
+ yOffset/.initial = 0pt,
+ },
+}
+
+\pgfkeys{
+ /Calendar/.is family, /Calendar,
+ init/.style = {
+ defaults/.style = {bg/.style={opacity=0.5}},
+ bg/.style = {},
+ minimum height/.initial = {},
+ },
+}
+
+\pgfkeys{
+ /Events/.is family, /Events,
+ init/.style = {
+ defaults/.style = {day code = {}, marks = {}, text = {}},
+ day code/.initial = {},
+ marks/.initial = {},
+ text/.initial = {},
+ },
+}
+
+\pgfkeys{
+ /Txt/.is family, /Txt,
+ init/.style = {
+ defaults/.style = {text = {}},
+ text/.initial = {},
+ },
+}
+
+\def\eIdx{}
+\def\eMaxIdx{}
+\def\eMark{}
+\def\eIsoDate{}
+\def\eYear{}
+\def\eMonth{}
+\def\eMonthShort{}
+\def\eDay{}
+\def\eDayText{}
+\def\eNote{}
+
+\pgfkeys{
+ /parseMonthEvents/.is family, /parseMonthEvents,
+ month/.initial = {},
+ filter pred/.initial = nil,
+ format func/.initial = nil,
+ format cmd/.initial = {},
+ events csv/.initial = {},
+ mark defaults csv/.initial = {},
+ min events/.initial = {},
+ defaults/.style = {
+ month = \theMonthName,
+ filter pred = nil,
+ format func = nil,
+ format cmd = {\textsuperscript{\eIdx}~\eMonthShort~\eDay:~\eNote\par},
+ events csv = \@wall@eventsCsv,
+ mark defaults csv = \@wall@markDefaultsCsv,
+ min events = nil,
+ },
+}
+
+\pgfkeys{
+ /parseYearEvents/.is family, /parseYearEvents,
+ year/.initial = {},
+ filter pred/.initial = nil,
+ format func/.initial = nil,
+ format cmd/.initial = {},
+ events csv/.initial = {},
+ mark defaults csv/.initial = {},
+ min events/.initial = {},
+ defaults/.style = {
+ year = \CalendarYear,
+ filter pred = nil,
+ format func = nil,
+ format cmd = {\textsuperscript{\eIdx}~\eMonthShort~\eDay:~\eNote\ifnumless{\eIdx}{\eMaxIdx}{,\space}{.}},
+ events csv = \@wall@eventsCsv,
+ mark defaults csv = \@wall@markDefaultsCsv,
+ min events = nil,
+ },
+}
+
+\newcommand\StarMark{*}
+
+\newcommand\NoteStarMark{*}
+
+\newlength\@wall@starHeight
+
+% Measure the star's height here, so that we are measuring with the current typeface.
+\newcommand\KiteMark{%
+\setlength{\@wall@starHeight}{\totalheightof{*}}%
+\begin{tikzpicture}
+ \node (box) [
+ rectangle, minimum height=\@wall@starHeight, minimum width=3.4pt,
+ inner sep=0pt, line width=0pt,
+ ] {};
+ \node[
+ kite, draw, textbody, fill=textbody,
+ scale=0.15, kite vertex angles=60,
+ above=0pt of box.north, anchor=north,
+ ] {};%
+\end{tikzpicture}%
+}
+
+% Same as \KiteMark but with scale=0.2
+\newcommand\NoteKiteMark{\raisebox{1pt}{%
+\setlength{\@wall@starHeight}{\totalheightof{*}}%
+\begin{tikzpicture}
+ \node (box) [
+ rectangle, minimum height=\@wall@starHeight, minimum width=3.4pt,
+ inner sep=0pt, line width=0pt,
+ ] {};
+ \node[
+ kite, draw, textbody, fill=textbody,
+ scale=0.2, kite vertex angles=60,
+ above=0pt of box.north, anchor=north,
+ ] {};%
+\end{tikzpicture}%
+}}
+
+\tikzstyle{moon circle}=[
+ circle,
+ inner sep=0pt,
+ line width=0pt,
+ minimum height=8pt,
+]
+
+\newlength\@wall@moonRaise
+\setlength{\@wall@moonRaise}{-0.7pt}
+
+\newcommand\NewMoon{}
+\newcommand\FirstQuarter{}
+\newcommand\FullMoon{}
+\newcommand\LastQuarter{}
+
+\newcommand\@wall@NewMoon{%
+\raisebox{\@wall@moonRaise}{%
+ \tikz\node[moon circle, fill=mooncolor] {};%
+}}
+
+\newcommand\@wall@FullMoon{%
+\raisebox{\@wall@moonRaise}{%
+ \tikz\node[moon circle, draw, mooncolor, line width=0.3pt] {};%
+}}
+
+\newcommand\@wall@FirstQuarter{%
+\raisebox{\@wall@moonRaise}{%
+\begin{tikzpicture}
+\node [moon circle, name=waxing] {};
+\path[fill=mooncolor]
+ (waxing.north) --
+ (waxing.south) to[out=-180,in=-90]
+ (waxing.west) to[out=90,in=-180]
+ (waxing.north);
+\end{tikzpicture}%
+}}
+
+\newcommand\@wall@LastQuarter{%
+\raisebox{\@wall@moonRaise}{%
+\begin{tikzpicture}
+\node [moon circle, name=waning] {};
+\path[fill=mooncolor]
+ (waning.north) --
+ (waning.south) to[out=0,in=-90]
+ (waning.east) to[out=90,in=0]
+ (waning.north);
+\end{tikzpicture}%
+}}
+
+\newcommand\@wall@useDefaultMoons{%
+\renewcommand\NewMoon{\@wall@NewMoon}%
+\renewcommand\FirstQuarter{\@wall@FirstQuarter}%
+\renewcommand\FullMoon{\@wall@FullMoon}%
+\renewcommand\LastQuarter{\@wall@LastQuarter}%
+}
+
+\newcommand\plannerMoonSize{\@setfontsize\plannerMoonSize{14}{14}}
+\newcommand*\plannerMoonFormat[1]{{\plannerMoonSize #1}}
+
+\newcommand\@wall@planner@NewMoon{\plannerMoonFormat{\CIRCLE}}
+\newcommand\@wall@planner@FirstQuarter{\plannerMoonFormat{\LEFTcircle}}
+\newcommand\@wall@planner@FullMoon{\plannerMoonFormat{\Circle}}
+\newcommand\@wall@planner@LastQuarter{\plannerMoonFormat{\RIGHTcircle}}
+
+\newcommand\@wall@usePlannerMoons{%
+\renewcommand\NewMoon{\@wall@planner@NewMoon}%
+\renewcommand\FirstQuarter{\@wall@planner@FirstQuarter}%
+\renewcommand\FullMoon{\@wall@planner@FullMoon}%
+\renewcommand\LastQuarter{\@wall@planner@LastQuarter}%
+}
+
+\@wall@useDefaultMoons
+
+\newcommand\SetPhoto[2][]{%
+ \pgfkeys{%
+ /Photo/#2/.is family, /Photo/#2,
+ /Photo/init,
+ defaults, file={#2},
+ #1%
+ }%
+}
+
+\newcommand\SetCalendar[2][]{%
+ \pgfkeys{%
+ /Calendar/#2/.is family, /Calendar/#2,
+ /Calendar/init,
+ defaults,
+ #1%
+ }%
+}
+
+\newcommand\SetQuote[3][]{%
+ \pgfkeys{%
+ /Quote/#2/.is family, /Quote/#2,
+ /Quote/init,
+ defaults, text={#3},
+ #1%
+ }%
+}
+
+\newcommand\SetEvents[4][]{%
+ \pgfkeys{%
+ /Events/#2/.is family, /Events/#2,
+ /Events/init,
+ defaults, marks={#3}, text={#4},
+ #1%
+ }%
+}
+
+\pgfkeys{
+ /MonthPage/.is family, /MonthPage,
+ layout/.style = {layout handlers/#1/.get = \@wall@month@doLayout},
+ put photo/.style = {/put photo/#1},
+ defaults/.style = {layout = small landscape, put photo = simple},
+ layout handlers/.cd,
+ full page/.initial = \@wall@fullPageLayout,
+ small landscape/.initial = \@wall@smallLandscapeLayout,
+}
+
+\newcommand\MonthPage[2][]{%
+ \pgfkeys{/MonthPage, defaults, #1}%
+ \@wall@month@doLayout{#2}%
+}
+
+\newcommand\SetTxt[2]{%
+ \pgfkeys{%
+ /Txt/#1/.is family, /Txt/#1,
+ /Txt/init,
+ defaults, text={#2},
+ }%
+}
+
+\newcommand\txt[1]{%
+\pgfkeys{/Txt/#1/text/.get=\@val}%
+\@val%
+}
+
+\def\@t@monthName{}
+\def\@t@eventsCsv{}
+\def\@t@markDefaultsCsv{}
+\def\@t@filterPred{}
+\def\@t@formatFunc{}
+\def\@t@formatCmd{}
+\def\@t@minEvents{}
+
+\newcommand\monthMarkFmt{\color{textbody}}
+
+\newcommand\symbolSpace{\thinspace}
+\newcommand\symbolSeparator{,\symbolSpace}
+
+% #1 = option keys
+\newcommand*\parseMonthEvents[1][]{%
+\pgfkeys{/parseMonthEvents, defaults, #1,
+ month/.get=\@t@monthName,
+ filter pred/.get=\@t@filterPred,
+ format func/.get=\@t@formatFunc,
+ format cmd/.get=\@t@formatCmd,
+ events csv/.get=\@t@eventsCsv,
+ mark defaults csv/.get=\@t@markDefaultsCsv,
+ min events/.get=\@t@minEvents,
+}%
+\luadirect{
+require("wallcalendar-helpers.lua")
+monthEvents(
+ \luastring{\@t@monthName},
+ \@t@filterPred,
+ \@t@formatFunc,
+ \luastringO{\@t@formatCmd},
+ \luastring{\@t@eventsCsv},
+ \luastring{\@t@markDefaultsCsv},
+ \@t@minEvents
+)}}
+
+\def\@t@yearNum{}
+
+% #1 = option keys
+\newcommand*\parseYearEvents[1][]{%
+\pgfkeys{/parseYearEvents, defaults, #1,
+ year/.get=\@t@year,
+ filter pred/.get=\@t@filterPred,
+ format func/.get=\@t@formatFunc,
+ format cmd/.get=\@t@formatCmd,
+ events csv/.get=\@t@eventsCsv,
+ mark defaults csv/.get=\@t@markDefaultsCsv,
+ min events/.get=\@t@minEvents,
+}%
+\luadirect{
+require("wallcalendar-helpers.lua")
+yearEvents(
+ tonumber(\@t@year),
+ \@t@filterPred,
+ \@t@formatFunc,
+ \luastringO{\@t@formatCmd},
+ \luastring{\@t@eventsCsv},
+ \luastring{\@t@markDefaultsCsv},
+ \@t@minEvents
+)}}
+
+\newlength\dayTextXshift
+\newlength\dayTextYshift
+\setlength{\dayTextXshift}{0pt}
+\setlength{\dayTextYshift}{0pt}
+
+\newlength\markNumberAbove
+\newlength\markNumberRight
+\setlength{\markNumberAbove}{-10pt}
+\setlength{\markNumberRight}{-3pt}
+
+\newlength\markDayTextAbove
+\newlength\markDayTextRight
+\setlength{\markDayTextAbove}{-10pt}
+\setlength{\markDayTextRight}{-3pt}
+
+\newcommand\parseMonthMarksDayText{%
+\luadirect{
+require("wallcalendar-helpers.lua")
+monthMarksDayText(\luastring{\theMonthName}, nil, \luastring{\@wall@eventsCsv})
+tex.sprint(';')
+}}
+
+\newcommand\parseMonthMarksDayTextMonth[1]{%
+\luadirect{
+require("wallcalendar-helpers.lua")
+monthMarksDayText(\luastring{#1}, nil, \luastring{\@wall@eventsCsv})
+tex.sprint(';')
+}}
+
+\newcommand*\parseMonthMarksDayTextUsing[1]{%
+\luadirect{
+require("wallcalendar-helpers.lua")
+monthMarksDayText(\luastring{\theMonthName}, nil, \luastring{#1})
+}}
+
+\newcommand\parseMonthMarksDayTextMonthUsing[2]{%
+\luadirect{
+require("wallcalendar-helpers.lua")
+monthMarksDayText(\luastring{#1}, nil, \luastring{#2})
+}}
+
+\newcommand*\parseMonthMarksNote{%
+\luadirect{
+require("wallcalendar-helpers.lua")
+monthMarksNote(\luastring{\theMonthName}, nil, \luastring{\@wall@eventsCsv}, \luastring{\@wall@markDefaultsCsv})
+}}
+
+\newcommand*\parseMonthMarksNoteUsing[1]{%
+\luadirect{
+require("wallcalendar-helpers.lua")
+monthMarksNote(\luastring{\theMonthName}, nil, \luastring{#1}, \luastring{\@wall@markDefaultsCsv})
+}}
+
+\makepagestyle{month}
+\makeoddhead{month}{}{}{}
+\makeevenhead{month}{}{}{}
+\makeoddfoot{month}{}{}{}
+\makeevenfoot{month}{}{}{}
+
+\pagestyle{month}
+
+\NewCoffin\@wall@pageWrap
+\NewCoffin\@wall@photo
+\NewCoffin\@wall@quote
+\NewCoffin\@wall@calendar
+\NewCoffin\@wall@events
+
+\newlength\@t@bleed
+\newlength\@t@rightOffset
+\newlength\@t@minipageWidth
+\newlength\@t@calendar@height
+\newlength\@t@calendar@hmargin
+\newlength\@t@calendar@dayYshift
+\newlength\@t@calendar@dayXshift
+\newlength\@t@calendar@gridHeight
+\newlength\@t@calendar@gridHeightFiveRows
+\newlength\@t@calendar@gridHeightSixRows
+\newlength\@t@xOffset
+\newlength\@t@yOffset
+\def\@t@file{}
+
+\newcommand*\monthFmt{}%
+\newcommand*\yearFmt{}%
+\newcommand*\dayLetterColor{}%
+\newcommand*\dayLetterFmt{}%
+\newcommand*\dayTextFmt{}%
+\newcommand*\quoteFmt{}%
+\newcommand*\headingFmt{}%
+\newcommand*\calendarFmt{}%
+\newcommand*\eventsFmt{}%
+
+\newcommand\@wall@layout@reset{%
+ \renewcommand*\monthFmt{}%
+ \renewcommand*\yearFmt{}%
+ \renewcommand*\dayLetterColor{}%
+ \renewcommand*\dayLetterFmt{}%
+ \renewcommand*\dayTextFmt{}%
+ \renewcommand*\quoteFmt{}%
+ \renewcommand*\headingFmt{}%
+ \renewcommand*\calendarFmt{}%
+ \renewcommand*\eventsFmt{}%
+ \def\@t@file{}%
+ \setlength{\@t@calendar@height}{0pt}%
+ \setlength{\@t@calendar@hmargin}{0pt}%
+ \setlength{\@t@calendar@dayYshift}{0pt}%
+ \setlength{\@t@calendar@dayXshift}{0pt}%
+ \setlength{\@t@bleed}{0pt}%
+ \setlength{\@t@rightOffset}{0pt}%
+ \setlength{\@t@minipageWidth}{0pt}%
+ \setlength{\@t@xOffset}{0pt}%
+ \setlength{\@t@yOffset}{0pt}%
+ \setlength{\@t@calendar@gridHeight}{0pt}%
+ \setlength{\@t@calendar@gridHeightFiveRows}{0pt}%
+ \setlength{\@t@calendar@gridHeightSixRows}{0pt}%
+}
+
+\newcommand\fullPageFmt{%
+ \renewcommand*\monthFmt{\LARGE}%
+ \renewcommand*\yearFmt{\LARGE}%
+ \renewcommand*\dayLetterColor{}%
+ \renewcommand*\dayLetterFmt{\tiny}%
+ \renewcommand*\dayTextFmt{\small}%
+ \renewcommand*\quoteFmt{}%
+ \renewcommand*\headingFmt{\centering}%
+ \renewcommand*\calendarFmt{\centering}%
+ \renewcommand*\eventsFmt{\setlength{\parindent}{0pt}\raggedleft\footnotesize}%
+}
+
+\newcommand\@wall@fullPageLayout[2][]{%
+\makeatletter
+\renewcommand*\theMonthName{#2}
+\@wall@layout@reset
+\fullPageFmt
+
+\colorlet{weekday}{black}
+\colorlet{weekend}{black!70}
+
+\pgfkeys{/Photo/#2/bleed/.get=\@val}
+\setlength{\@t@bleed}{\@val}
+
+\def\@t@monthnum{\monthToNum{#2}}
+
+% 40mm = 1.5748 inch
+% 43mm = 1.6929 inch
+\setlength{\@t@calendar@height}{40mm + \@t@bleed}
+
+% See if there was a height given in the options
+\pgfkeys{/Calendar/#2/minimum height/.get=\@val}
+\ifx\@val\empty \relax
+\else
+ \setlength{\@t@calendar@height}{\@val + \@t@bleed}
+\fi
+
+\setlength{\@t@calendar@hmargin}{20pt}
+
+% NOTE: the -4pt and -2pt offset is somehow necessary for the sides to align
+% with the edges
+\setlength{\@t@rightOffset}{\@t@bleed +\@t@calendar@hmargin -4pt}
+\setlength{\@t@minipageWidth}{\calPaperWidth -2\@t@calendar@hmargin -2pt}
+
+\SetHorizontalCoffin\@wall@pageWrap{%
+ \color{white}%
+ \rule{\textwidth}{0pt}%
+ \rule{0pt}{\textheight}%
+}
+
+\pgfkeys{/Photo/#2/file/.get=\@t@file}
+
+\SetHorizontalCoffin\@wall@photo{%
+ \placeholder[fill=photo-frame]{hasvarnish}{%
+ \@wall@photo@putPhoto{\@t@file}%
+ }%
+}
+
+\SetHorizontalCoffin\@wall@quote{%
+ \placeholder[fill=quote-frame]{}{%
+ \begin{minipage}{\linewidth}%
+ \quoteFmt
+ \pgfkeys{/Quote/#2/text/.get=\@val}%
+ \@val%
+ \end{minipage}%
+ }%
+}
+
+\SetHorizontalCoffin\@wall@calendar{%
+\ifvarnishmask\relax
+\else
+\begin{tikzpicture}
+
+\node (bg) [
+ fill = calendarbg,
+ opacity = 0.5,
+ minimum width = {\calPaperWidth + 2\@t@bleed},
+ anchor=north west,
+ /Calendar/#2/bg,
+ % override the style, in case bleed was set above
+ minimum height = {\@t@calendar@height},
+] at (0,0) {};
+
+\node (heading) [
+ below right=10pt and {\@t@rightOffset} of bg.north west,
+ anchor=north west,
+] {%
+\placeholder[fill=heading-frame]{}{%
+\begin{minipage}{\@t@minipageWidth}%
+\headingFmt
+{\monthFmt\@tr@monthNumName{\@t@monthnum}}
+\hfill
+\strcmpblank{\CalendarAltYear}{%
+ {\yearFmt\CalendarYear}%
+}{%
+ {\yearFmt\CalendarYear/\CalendarAltYear}%
+}%
+\end{minipage}%
+}%
+};
+
+\node (calendar) [
+ below right=35pt and {\@t@rightOffset} of bg.north west,
+ anchor=north west,
+] {%
+\placeholder[fill=calendar-frame]{}{%
+\begin{minipage}{\@t@minipageWidth}%
+\calendarFmt
+\tikz{\tikzMonthCalendar@fullpage{\@t@monthnum};}%
+\end{minipage}%
+}%
+};
+
+\node (events) [
+ below=0pt of calendar.south west,
+ anchor=north west,
+] {%
+\placeholder[fill=events-frame]{}{%
+\begin{minipage}{\@t@minipageWidth}%
+\eventsFmt
+\pgfkeys{/Events/#2/text/.get=\@val}%
+\@val%
+\end{minipage}%
+}%
+};
+
+\end{tikzpicture}%
+\fi
+}% \SetHorizontalCoffin
+
+\@wall@photo@setYOffset
+
+\pgfkeys{/Photo/#2/xOffset/.get=\@val}
+\addtolength{\@t@xOffset}{\@val}
+\pgfkeys{/Photo/#2/yOffset/.get=\@val}
+\addtolength{\@t@yOffset}{\@val}
+
+% NOTE: a small whitespace is visible on the left edge of the page when bleed is 0pt, a space must be getting in somewhere.
+\JoinCoffins*\@wall@pageWrap[l,t]\@wall@photo[l,t](-\spinemargin -\@t@bleed + \@t@xOffset, \uppermargin + \@t@bleed + \@t@yOffset)
+
+\pgfkeys{/Quote/#2/xOffset/.get=\@val}
+\setlength{\@t@xOffset}{\@val}
+\pgfkeys{/Quote/#2/yOffset/.get=\@val}
+\setlength{\@t@yOffset}{\@val}
+
+\JoinCoffins*\@wall@pageWrap[l,t]\@wall@quote[l,t](\@t@xOffset, \@t@yOffset)
+
+\JoinCoffins*\@wall@pageWrap[l,b]\@wall@calendar[l,b](-\spinemargin -\@t@bleed, \textheight +\uppermargin -\paperheight -\@t@bleed)
+
+\makeatother
+
+\clearpage
+\TypesetCoffin\@wall@pageWrap%
+}% \@wall@fullPageLayout
+
+\newcommand*{\tikzMonthCalendar@fullpage}[1]{%
+\pgfkeys{/Events/\monthName{#1}/marks/.get=\@eventmarks}%
+\calendar (cal#1) [alnitak, dates=\CalendarYear-#1-01 to \CalendarYear-#1-last] \@eventmarks;%
+}
+
+\newcommand\smallLandscapeFmt{%
+ \renewcommand*\monthFmt{\LARGE}%
+ \renewcommand*\yearFmt{\LARGE}%
+ \renewcommand*\dayLetterColor{}%
+ \renewcommand*\dayLetterFmt{\tiny}%
+ \renewcommand*\dayTextFmt{\small}%
+ \renewcommand*\quoteFmt{\centering}%
+ \renewcommand*\headingFmt{\centering}%
+ \renewcommand*\calendarFmt{\centering}%
+ \renewcommand*\eventsFmt{\setlength{\parindent}{0pt}\raggedright\footnotesize}%
+}
+
+\newcommand\@wall@smallLandscapeLayout[2][]{%
+\makeatletter
+\renewcommand*\theMonthName{#2}
+\@wall@layout@reset
+\smallLandscapeFmt
+
+\colorlet{weekday}{black}
+\colorlet{weekend}{black!70}
+
+\pgfkeys{/Photo/#2/bleed/.get=\@val}
+\setlength{\@t@bleed}{\@val}
+
+\def\@t@monthnum{\monthToNum{#2}}
+
+\setlength{\@t@calendar@height}{85mm + \@t@bleed}
+
+% See if there was a height given in the options
+\pgfkeys{/Calendar/#2/minimum height/.get=\@val}
+\ifx\@val\empty \relax
+\else
+ \setlength{\@t@calendar@height}{\@val + \@t@bleed}
+\fi
+
+\setlength{\@t@calendar@hmargin}{20pt}
+
+% 5mm: day headings
+% 20mm: events
+% 6.5mm: vertical spacing
+\setlength{\@tmp@a}{20mm + 5mm + 6.5mm}
+\setlength{\@tmp@b}{\@t@calendar@height -\@tmp@a}
+\setlength{\@t@calendar@dayYshift}{0.1666\@tmp@b}% 1/6 = 0.1666
+
+\setlength{\@t@calendar@gridHeightSixRows}{\@tmp@b}
+\setlength{\@t@calendar@gridHeightFiveRows}{\@tmp@b -0.1666\@tmp@b}
+
+% NOTE: the -4pt and -2pt offset is somehow necessary for the sides to align
+% with the edges
+\setlength{\@t@rightOffset}{\@t@bleed +\@t@calendar@hmargin -4pt}
+\setlength{\@t@minipageWidth}{\calPaperWidth -2\@t@calendar@hmargin -2pt}
+
+\setlength{\@t@calendar@dayXshift}{0.1428\@t@minipageWidth}% 1/7 = 0.1428
+
+\SetHorizontalCoffin\@wall@pageWrap{%
+ \color{white}%
+ \rule{\textwidth}{0pt}%
+ \rule{0pt}{\textheight}%
+}
+
+\pgfkeys{/Photo/#2/file/.get=\@t@file}
+
+\SetHorizontalCoffin\@wall@photo{%
+ \placeholder[fill=photo-frame]{hasvarnish}{%
+ \@wall@photo@putPhoto{\@t@file}%
+ }%
+}
+
+\SetHorizontalCoffin\@wall@quote{%
+ \placeholder[fill=quote-frame]{}{%
+ \begin{minipage}{\linewidth}%
+ \quoteFmt
+ \pgfkeys{/Quote/#2/text/.get=\@val}%
+ \@val%
+ \end{minipage}%
+ }%
+}
+
+\SetHorizontalCoffin\@wall@calendar{%
+\ifvarnishmask\relax
+\else
+\begin{tikzpicture}
+
+\node (bg) [
+ fill = calendarbg,
+ opacity = 1,
+ minimum width = {\calPaperWidth + 2\@t@bleed},
+ anchor=north west,
+ /Calendar/#2/bg,
+ % override the style, in case bleed was set above
+ minimum height = {\@t@calendar@height},
+] at (0,0) {};
+
+\node (heading) [
+ below right=10pt and {\@t@rightOffset} of bg.north west,
+ anchor=north west,
+] {%
+\placeholder[fill=heading-frame]{}{%
+\begin{minipage}{\@t@minipageWidth}%
+\headingFmt
+{\monthFmt\@tr@monthNumName{\@t@monthnum}}
+\hfill
+\strcmpblank{\CalendarAltYear}{%
+ {\yearFmt\CalendarYear}%
+}{%
+ {\yearFmt\CalendarYear/\CalendarAltYear}%
+}%
+\end{minipage}%
+}%
+};
+
+\node (calendar) [
+ below right=35pt and {\@t@rightOffset} of bg.north west,
+ anchor=north west,
+] {%
+\placeholder[fill=calendar-frame]{}{%
+\begin{minipage}{\@t@minipageWidth}%
+\calendarFmt
+\hspace*{-5pt}% FIXME
+\tikz{\tikzMonthCalendar@smallLandscape{\@t@monthnum};}%
+\end{minipage}%
+}%
+};
+
+\node (events) [
+ above right=10mm and {\@t@rightOffset} of bg.south west,
+ anchor=south west,
+] {%
+\placeholder[fill=events-frame]{}{%
+\begin{minipage}{\@t@minipageWidth}%
+\eventsFmt
+\pgfkeys{/Events/#2/text/.get=\@val}%
+\@val%
+\end{minipage}%
+}%
+};
+
+\end{tikzpicture}%
+\fi
+}% \SetHorizontalCoffin
+
+% The quote has to be centered betweeen the photo and the calendar with manual tweaking.
+% The height of the quote is not known, the height of the calendar plus its heading is not known.
+
+% TODO move the photo with /Photo/#2/xOffset and yOffset as at the full page layout
+
+\pgfkeys{/Quote/#2/yOffset/.get=\@val}
+\setlength{\@t@yOffset}{\@val}
+
+\JoinCoffins*\@wall@photo[hc,b]\@wall@quote[hc,t](0pt, \@t@yOffset)
+
+\pgfkeys{/Photo/#2/yOffset/.get=\@val}
+\setlength{\@t@yOffset}{\@val}
+
+% NOTE: Taking the bottom edge of the photo as fixed.
+% yOffset must be set to pull the photo down into position
+
+\JoinCoffins*\@wall@pageWrap[hc,t]\@wall@photo[hc,b](0pt, \uppermargin + \@t@yOffset)
+
+% Calendar is aligned to the bottom of the page.
+
+\JoinCoffins*\@wall@pageWrap[hc,b]\@wall@calendar[hc,b](0pt, \textheight +\uppermargin -\paperheight -\@t@bleed)
+
+\makeatother
+
+\clearpage
+\TypesetCoffin\@wall@pageWrap%
+}% \@wall@smallLandscapeLayout
+
+\newcommand*{\tikzMonthCalendar@smallLandscape}[1]{%
+\pgfkeys{/Events/\monthName{#1}/marks/.get=\@eventmarks}%
+\calendar (cal#1) [betelgeuse, dates=\CalendarYear-#1-01 to \CalendarYear-#1-last] \@eventmarks;%
+}
+
+\tikzstyle{day letter headings}=[%
+ day heading/.style={black!90},
+ execute before day scope={%
+ \ifdate{day of month=1}{%
+ \pgfmathsetlength\pgf@xa{\tikz@lib@cal@xshift}%
+ \pgfmathsetlength\pgf@ya{\tikz@lib@cal@yshift}%
+ \foreach \d in {0,1,2,3,4,5,6} {%
+ \pgf@xa=\d\pgf@xa%
+ \pgftransformxshift{\pgf@xa}%
+ \pgftransformyshift{\pgf@ya}%
+ \node (d\d) [anchor=south, day heading] {\dayLetterFmt\@tr@dayLetter{\d}};%
+ };%
+ }{}%
+ },%
+]
+
+\newcount\gridRows
+\newcount\gridLines
+\newcount\n
+
+\newif\ifGridNoSurround
+\GridNoSurroundfalse
+
+\tikzstyle{no grid surround}=[execute before day scope={\GridNoSurroundtrue}]
+\tikzstyle{grid surround}=[execute before day scope={\GridNoSurroundfalse}]
+
+\tikzstyle{days grid}=[%
+ execute before day scope={%
+ \ifdate{day of month=1}{%
+ %
+ % Determine if the grid is five or six rows
+ %
+ % 31 day months
+ \ifdate{between=01-01 and 01-31, between=03-01 and 03-31, between=05-01 and 05-31, between=07-01 and 07-31, between=08-01 and 08-31, between=10-01 and 10-31, between=12-01 and 12-31}{%
+ \ifdate{Saturday,Sunday}{%
+ \gridRows=6%
+ \setlength\@t@calendar@gridHeight{\@t@calendar@gridHeightSixRows}%
+ }{%
+ \gridRows=5%
+ \setlength\@t@calendar@gridHeight{\@t@calendar@gridHeightFiveRows}%
+ }
+ }{
+ % 30 day months and February
+ \ifdate{between=02-01 and 02-last}{%
+ \gridRows=5%
+ \setlength\@t@calendar@gridHeight{\@t@calendar@gridHeightFiveRows}%
+ }{%
+ \ifdate{Sunday}{%
+ \gridRows=6%
+ \setlength\@t@calendar@gridHeight{\@t@calendar@gridHeightSixRows}%
+ }{%
+ \gridRows=5%
+ \setlength\@t@calendar@gridHeight{\@t@calendar@gridHeightFiveRows}%
+ }
+ }
+ }
+ %
+ % Horizontal lines
+ %
+ \gridLines=\gridRows
+ \ifGridNoSurround\relax
+ \else
+ \advance\gridLines by 1
+ \n=0
+ \draw [
+ gridcolor,
+ line width=0.3pt,
+ xshift=-0.5\@t@calendar@dayXshift,
+ yshift=0.5\@t@calendar@dayYshift,
+ ] (0,{-\n\@t@calendar@dayYshift}) -- (7\@t@calendar@dayXshift,{-\n\@t@calendar@dayYshift});
+ \fi
+ \foreach \n in {1,2,3,4,5,6} {
+ \ifnum\n<\gridLines
+ \draw [
+ gridcolor,
+ line width=0.3pt,
+ xshift=-0.5\@t@calendar@dayXshift,
+ yshift=0.5\@t@calendar@dayYshift,
+ ] (0,{-\n\@t@calendar@dayYshift}) -- (7\@t@calendar@dayXshift,{-\n\@t@calendar@dayYshift});
+ \fi
+ }
+ %
+ % Vertical lines
+ %
+ \gridLines=7
+ \ifGridNoSurround\relax
+ \else
+ \advance\gridLines by 1
+ \n=0
+ \draw [
+ gridcolor,
+ line width=0.3pt,
+ xshift=-0.5\@t@calendar@dayXshift,
+ yshift=0.5\@t@calendar@dayYshift,
+ ] ({\n\@t@calendar@dayXshift},0) -- ({\n\@t@calendar@dayXshift},{-\gridRows\@t@calendar@dayYshift});
+ \fi
+ \foreach \n in {1,2,3,4,5,6,7} {
+ \ifnum\n<\gridLines
+ \draw [
+ gridcolor,
+ line width=0.3pt,
+ xshift=-0.5\@t@calendar@dayXshift,
+ yshift=0.5\@t@calendar@dayYshift,
+ ] ({\n\@t@calendar@dayXshift},0) -- ({\n\@t@calendar@dayXshift},{-\gridRows\@t@calendar@dayYshift});
+ \fi
+ }
+ %
+ % If we are not drawing the surrounding lines, it looks better to hide
+ % some of the top and bottom edges
+ %
+ \ifGridNoSurround
+ \draw [
+ color=white,
+ line width=6pt,
+ xshift=-0.5\@t@calendar@dayXshift,
+ yshift={0.5\@t@calendar@dayYshift -1pt},
+ ] (0,0) -- (7\@t@calendar@dayXshift,0);
+ \draw [
+ color=white,
+ line width=6pt,
+ xshift=-0.5\@t@calendar@dayXshift,
+ yshift={0.5\@t@calendar@dayYshift +1pt},
+ ] (0,-\gridRows\@t@calendar@dayYshift) -- (7\@t@calendar@dayXshift,-\gridRows\@t@calendar@dayYshift);
+ \fi
+ }{}%
+ }
+]
+
+\tikzstyle{headings background rule}=[
+ background rule/.style={black!90, line width=0.3pt, yshift={0.3\@t@calendar@dayYshift -3pt}},
+ execute before day scope={%
+ \ifdate{day of month=1}{%
+ \draw [
+ xshift=-0.5\@t@calendar@dayXshift,
+ yshift=0.5\@t@calendar@dayYshift,
+ background rule,
+ ] (0,0) -- (7\@t@calendar@dayXshift,0);
+ }{}%
+ }
+]
+
+\tikzstyle{headings background bar}=[
+ headings background rule,
+ background rule/.style={black!20, line width=10pt, yshift={0.3\@t@calendar@dayYshift +3.5pt}},
+]
+
+\tikzstyle{betelgeuse}=[
+ no grid surround,
+ days grid,
+ week list,
+ day xshift=\@t@calendar@dayXshift,
+ day yshift=\@t@calendar@dayYshift,
+ headings background bar,
+ day letter headings,
+ day heading/.style={black!90, yshift={-0.3\@t@calendar@dayYshift}},
+ every day/.append style={anchor=base, inner xsep=0pt, yshift={-0.25\baselineskip}},
+ day text={\dayTextFmt\%d-},
+]
+
+\tikzstyle{alnitak}=[
+ day list right,
+ day xshift={0pt},
+ every month/.append style={anchor=base, inner xsep=0pt, yshift=4mm, xshift=-\widthof{\space}},
+ day text={\dayTextFmt\%d-},
+ every day/.append style={anchor=base, inner xsep=0pt},
+ execute before day scope={
+ %
+ % === Moving the day number ===
+ %
+ % A small offset seems to improve the result, the last day gets closer to the end of the linewidth
+ \pgftransformxshift{0.01em}
+ \pgfcalendarjuliantodate{\pgfcalendarendjulian}{\currentyear}{\currentmonth}{\lastday}
+ % Width of month day digits from 1 - 28
+ \setlength{\@tmp@a}{\widthof{12345678910111213141516171819202122232425262728}}
+ \setlength{\@tmp@b}{\widthof{30}}
+ \pgfmathparse{(\linewidth - \@tmp@a - \@tmp@b * (\lastday-28)) / \lastday}
+ \pgftransformxshift{\pgfmathresult}
+ \let\%=\pgfcalendarshorthand
+ \setlength{\@tmp@a}{\widthof{\%d-}}
+ \pgftransformxshift{\@tmp@a}
+ %
+ % === Weekday letter above the day ===
+ %
+ \ifdate{weekend}{\def\dayLetterColor{\color{weekend}}}{\def\dayLetterColor{\color{weekday}}}%
+ \node[anchor=south,yshift=5mm,inner sep=0pt]{%
+ \dayLetterColor\dayLetterFmt\@tr@dayLetter{\pgfcalendarcurrentweekday}%
+ };%
+ },
+]
+
+\newcommand\plannerPortraitMonthFmt{\fontsize{11}{11}\selectfont\color{darkgold}}
+\newcommand\plannerPortraitDayFmt{\fontsize{8}{8}\selectfont\color{plannerdatenum}}
+
+\tikzstyle{year planner portrait}=[
+ week list,
+ month text={\plannerPortraitMonthFmt\@tr@monthNumName{\pgfcalendarcurrentmonth}},
+ day text={\plannerPortraitDayFmt\%d-},
+ every month/.append style={%
+ anchor=south,
+ inner xsep=0pt,
+ yshift=5mm,
+ xshift=2.5mm,
+ },
+ day letter headings,
+ day heading/.style={gray, xshift=0pt, scale=0.85},
+ month label above centered,
+ every day/.style={anchor=mid},
+]
+
+\newcommand\plannerLandscapeDateDayFont{}
+\newcommand\plannerLandscapeDayFont{}
+\newcommand\plannerLandscapeMonthFont{}
+
+\newcommand\plannerLandscapeMonthFmt{%
+ \plannerLandscapeMonthFont%
+ \fontsize{15}{18}\selectfont%
+ \color{gold}\bfseries%
+}
+
+\newcommand\plannerLandscapeDayFmt{%
+ \plannerLandscapeDayFont%
+ \fontsize{10}{12}\selectfont%
+}
+
+\newcommand*\plannerLandscapeDateDayFormat[1]{%
+ \plannerLandscapeDateDayFont%
+ \fontsize{8}{11}\selectfont%
+ #1%
+}
+
+\newcommand\plannerLandscapeBeginDayScopeHook{%
+ \ifdate{weekend}{\color{black!60}}{}
+}
+
+\newlength\plannerLandscapeDayXShift
+\newlength\plannerLandscapeMonthYShift
+
+% Assuming 25mm to fit 'September'
+\setlength{\@tmp@a}{\calPaperWidth - \@wall@leftMargin - \@wall@rightMargin - 25mm}
+% Max week shift is 6 = Sunday. 31 days + 6 = 37. 1/37 = 0.027
+\setlength{\plannerLandscapeDayXShift}{0.027\@tmp@a}
+
+% Assuming 10mm for day headings (M T W...) and some padding
+\setlength{\@tmp@a}{\calPaperHeight - \@wall@topMargin - \@wall@bottomMargin - 10mm}
+% 1/12 = 0.0833
+\setlength{\plannerLandscapeMonthYShift}{0.0833\@tmp@a}
+
+\tikzstyle{year planner landscape}=[
+ month list,
+ day xshift=\plannerLandscapeDayXShift,
+ month yshift=\plannerLandscapeMonthYShift,
+ every month/.append style={anchor=base, inner xsep=0pt},
+ month text={\plannerLandscapeMonthFmt \%mt},
+ day text={\plannerLandscapeDayFmt \%d-},
+ every day/.append style={anchor=base, inner xsep=0pt},
+ month label left,
+ execute at begin day scope={
+ \plannerLandscapeBeginDayScopeHook
+ % Weekday headers in January
+ \ifdate{between=01-01 and 01-31}{
+ \def\l{\ifcase\pgfcalendarcurrentweekday M\or T\or W\or T\or F\or S\or S\fi}%
+ \ifdate{weekend}{\def\daylabelcolor{gold}}{\def\daylabelcolor{black}}%
+ \node[anchor=south,yshift=5mm,inner sep=0pt]{\color{\daylabelcolor}\plannerLandscapeDateDayFormat{\l}};%
+ }{}
+ % Weekday headers in December
+ \ifdate{between=12-01 and 12-31}{
+ \pgftransformyshift{-3mm}%
+ \def\l{\ifcase\pgfcalendarcurrentweekday M\or T\or W\or T\or F\or S\or S\fi}%
+ \ifdate{weekend}{\def\daylabelcolor{gold}}{\def\daylabelcolor{black}}%
+ \node[anchor=south,yshift=5mm,inner sep=0pt]{\color{\daylabelcolor}\plannerLandscapeDateDayFormat{\l}};%
+ }{}
+ }
+]
+
+\newcommand\plannerGridMonthFont{}
+\newcommand\plannerGridDateDayFont{}
+\newcommand\plannerGridNotesFont{}
+\newcommand\plannerGridDayFont{}
+\newcommand\plannerGridYearNumberFont{}
+
+\newcommand\plannerGridYearNumberFmt{%
+ \plannerGridYearNumberFont%
+ \fontsize{11}{11}\selectfont%
+ \color{white}%
+}
+
+\newcommand\plannerGridMonthFmt{%
+ \plannerGridMonthFont%
+ \fontsize{13}{13}\selectfont%
+ \color{white}%
+}
+
+\newcommand\plannerGridDayFmt{%
+ \plannerGridDayFont%
+ \fontsize{11}{11}\selectfont%
+}
+
+\newcommand\plannerGridDateDayFmt{%
+ \plannerGridDateDayFont%
+ \fontsize{9}{9}\selectfont%
+ \color{black!80}%
+}
+
+\newcommand{\plannerGridNotesFmt}{%
+ \plannerGridNotesFont%
+ \fontsize{11}{11}\selectfont%
+}
+
+\newcommand\plannerGridBeginDayScopeHook{%
+ \ifdate{weekend}{\color{black!60}}{}
+}
+
+\newlength\plannerGridColXShift
+\newlength\plannerGridRowYShift
+
+\newlength\plannerGridCalendarWidth
+\newlength\plannerGridCalendarHeight
+
+\newlength\plannerGridDayHeadingsHeight
+\newlength\plannerGridMonthNamesWidth
+
+\newlength\plannerGridNotesHeight
+\setlength{\plannerGridNotesHeight}{10mm}
+
+\setlength{\plannerGridCalendarWidth}{\calPaperWidth - \@wall@leftMargin - \@wall@rightMargin}
+\setlength{\plannerGridCalendarHeight}{\calPaperHeight - \@wall@topMargin - \@wall@bottomMargin - \plannerGridNotesHeight}
+
+\setlength{\plannerGridDayHeadingsHeight}{10mm}
+\setlength{\plannerGridMonthNamesWidth}{10mm}
+
+\setlength{\@tmp@a}{\plannerGridCalendarWidth - \plannerGridMonthNamesWidth}
+% 37 columns. 1/37 = 0.027. Max week shift is 6 = Sunday. 31 days + 6 = 37.
+\setlength{\plannerGridColXShift}{0.027\@tmp@a}
+
+\setlength{\@tmp@a}{\plannerGridCalendarHeight - 2\plannerGridDayHeadingsHeight}
+% 12 rows. 1/12 = 0.0833
+\setlength{\plannerGridRowYShift}{0.0833\@tmp@a}
+
+\newcounter{verticalCount}
+
+\tikzstyle{year planner landscape grid days}=[
+ month list,
+ day xshift=\plannerGridColXShift,
+ month yshift=\plannerGridRowYShift,
+ day text={\plannerGridDayFmt \%d-},
+ every day/.append style={anchor=base, yshift=-12pt, inner xsep=0pt},
+ execute at begin day scope={%
+ % White fill to cover the page background color
+ \node (cell) [
+ rectangle,
+ fill = white,
+ minimum height = \plannerGridRowYShift - 1pt,
+ minimum width = \plannerGridColXShift - 1pt,
+ xshift = -0.5\plannerGridColXShift,
+ yshift = 4.5pt,
+ ] {};%
+ %
+ \ifdate{Monday}{%
+ \node (a) [above left = 15pt and -3.5pt of cell.west] {};
+ \node (b) [below left = 15pt and -3.5pt of cell.west] {};
+ \node (c) [right = 10pt of cell.west] {};
+ \path [on layer = one, fill = pagebgcolor] (a.south) -- (b.north) -- (c.west) -- (a.south);%
+ }{}%
+ %
+ \ifdate{Sunday}{%
+ \node (a) [above left = 15pt and {-3.5pt + 1pt} of cell.east] {};
+ \node (b) [below left = 15pt and {-3.5pt + 1pt} of cell.east] {};
+ \node (c) [right = {10pt - 1pt} of cell.east] {};
+ \path [on layer = two, fill = white] (a.south) -- (b.north) -- (c.west) -- (a.south);%
+ }{}%
+ %
+ \plannerGridBeginDayScopeHook%
+ },
+]
+
+\newcommand\plannerMarksDayTextCSV{\@wall@eventsCsv}
+\newcommand\plannerMarksNoteCSV{\@wall@eventsCsv}
+\newcommand\plannerMarkDefaultsCsv{}
+
+\newcommand\@wall@plm[1]{%
+\luadirect{
+require("wallcalendar-helpers.lua")
+monthMarksDayText(\luastring{#1}, nil, \luastring{\plannerMarksDayTextCSV})
+tex.sprint(';')
+}}
+
+\newcommand\@wall@plmYear{%
+\luadirect{
+require("wallcalendar-helpers.lua")
+yearMarksDayText(tonumber(\CalendarYear), nil, \luastring{\plannerMarksDayTextCSV})
+tex.sprint(';')
+}}
+
+\newcommand\@wall@plNotes{%
+\luadirect{
+require("wallcalendar-helpers.lua")
+yearMarksNote(tonumber(\CalendarYear), nil, \luastring{\plannerMarksNoteCSV}, \luastring{\plannerMarkDefaultsCsv}, false)
+}}
+
+\newcommand\@wall@plNotesOneCalendar{%
+\luadirect{
+require("wallcalendar-helpers.lua")
+yearMarksNote(tonumber(\CalendarYear), nil, \luastring{\plannerMarksNoteCSV}, \luastring{\plannerMarkDefaultsCsv}, true)
+}}
+
+\newcommand\plannerEvents{%
+\parseYearEvents[filter pred = hasNote]%
+}
+
+\newcommand\YearPlannerPortrait{%
+\@wall@useDefaultMoons%
+\begin{tikzpicture}[every calendar/.style={year planner portrait}]%
+ \matrix[column sep=1.5em, row sep=5mm] {
+ \calendar(cal01)[dates=\CalendarYear-01-01 to \CalendarYear-01-last] \@wall@plm{January}; \pgfmatrixnextcell
+ \calendar(cal02)[dates=\CalendarYear-02-01 to \CalendarYear-02-last] \@wall@plm{February}; \pgfmatrixnextcell
+ \calendar(cal03)[dates=\CalendarYear-03-01 to \CalendarYear-03-last] \@wall@plm{March}; \\
+ \calendar(cal04)[dates=\CalendarYear-04-01 to \CalendarYear-04-last] \@wall@plm{April}; \pgfmatrixnextcell
+ \calendar(cal05)[dates=\CalendarYear-05-01 to \CalendarYear-05-last] \@wall@plm{May}; \pgfmatrixnextcell
+ \calendar(cal06)[dates=\CalendarYear-06-01 to \CalendarYear-06-last] \@wall@plm{June}; \\
+ \calendar(cal07)[dates=\CalendarYear-07-01 to \CalendarYear-07-last] \@wall@plm{July}; \pgfmatrixnextcell
+ \calendar(cal08)[dates=\CalendarYear-08-01 to \CalendarYear-08-last] \@wall@plm{August}; \pgfmatrixnextcell
+ \calendar(cal09)[dates=\CalendarYear-09-01 to \CalendarYear-09-last] \@wall@plm{September}; \\
+ \calendar(cal10)[dates=\CalendarYear-10-01 to \CalendarYear-10-last] \@wall@plm{October}; \pgfmatrixnextcell
+ \calendar(cal11)[dates=\CalendarYear-11-01 to \CalendarYear-11-last] \@wall@plm{November}; \pgfmatrixnextcell
+ \calendar(cal12)[dates=\CalendarYear-12-01 to \CalendarYear-12-last] \@wall@plm{December}; \\
+ };
+ \@wall@plNotes
+\end{tikzpicture}%
+}
+
+\newcommand\YearPlannerLandscape{%
+\@wall@usePlannerMoons%
+\begin{tikzpicture}%
+ \calendar (cal) [
+ year planner landscape,
+ dates=\CalendarYear-01-01 to \CalendarYear-12-31,
+ ] \@wall@plmYear;
+ \@wall@plNotesOneCalendar
+\end{tikzpicture}%
+}
+
+\newcommand\YearPlannerLandscapeGrid{%
+\@wall@usePlannerMoons%
+\begin{tikzpicture}
+
+ % Background frame
+
+ \node (bg) [
+ rectangle,
+ inner sep = 0pt,
+ minimum width = \plannerGridCalendarWidth,
+ minimum height = \plannerGridCalendarHeight,
+ ] {};
+
+ \foreach \x/\m in {1/\xJanShort, 2/\xFebShort, 3/\xMarShort, 4/\xAprShort,
+ 5/\xMayShort, 6/\xJunShort, 7/\xJulShort, 8/\xAugShort, 9/\xSepShort,
+ 10/\xOctShort, 11/\xNovShort, 12/\xDecShort}
+ {
+ \setlength{\@tmp@a}{\x\plannerGridRowYShift + \plannerGridDayHeadingsHeight}
+
+ % Month labels
+
+ \node [
+ below = \@tmp@a of bg.north west,
+ yshift = 0.5\plannerGridRowYShift,
+ xshift = 0.5\plannerGridColXShift - 2pt,
+ anchor = base,
+ rotate = 90,
+ ] {\plannerGridMonthFmt\MakeUppercase{\textls*{\m}}};
+
+ % Horizontal lines
+
+ \addtolength{\@tmp@a}{-\plannerGridRowYShift}
+
+ \node (h-a-\x) [below = \@tmp@a of bg.north west] {};
+ \node (h-b-\x) [below = \@tmp@a of bg.north east] {};
+ \draw [gridcolor] (h-a-\x) -- (h-b-\x);
+ }
+
+ % 13th line
+ \setlength{\@tmp@a}{12\plannerGridRowYShift + \plannerGridDayHeadingsHeight}
+ \node (h-a-13) [below = \@tmp@a of bg.north west] {};
+ \node (h-b-13) [below = \@tmp@a of bg.north east] {};
+ \draw [gridcolor] (h-a-13) -- (h-b-13);
+
+ % Year number in the corner
+ \node [
+ right = 0pt of bg.north west,
+ xshift = 0.5\plannerGridMonthNamesWidth,
+ yshift = -0.5\plannerGridDayHeadingsHeight - 5pt,
+ anchor = base,
+ ] {\plannerGridYearNumberFmt\CalendarYear};
+
+ \setcounter{verticalCount}{1}
+
+ \foreach \i in {0,1,2,3,4,5} {
+ \foreach \j/\d in {
+ 0/\xMondayDayLetter,
+ 1/\xTuesdayDayLetter,
+ 2/\xWednesdayDayLetter,
+ 3/\xThursdayDayLetter,
+ 4/\xFridayDayLetter,
+ 5/\xSaturdayDayLetter,
+ 6/\xSundayDayLetter}
+ {
+ \addtocounter{verticalCount}{1}
+ \ifnumgreater{\value{verticalCount}}{38}{\relax}{
+ \setlength{\@tmp@a}{7\plannerGridColXShift}
+ \setlength{\@tmp@a}{\i\@tmp@a + \j\plannerGridColXShift + \plannerGridMonthNamesWidth}
+
+ % Day headings (top and bottom)
+
+ \node [
+ right = \@tmp@a of bg.north west,
+ xshift = 0.5\plannerGridColXShift + 4pt,
+ yshift = -0.5\plannerGridDayHeadingsHeight - 5pt,
+ anchor = base,
+ ] {\plannerGridDateDayFmt \d};
+
+ \node [
+ right = \@tmp@a of bg.south west,
+ xshift = 0.5\plannerGridColXShift + 4pt,
+ yshift = 0.5\plannerGridDayHeadingsHeight - 5pt,
+ anchor = base,
+ ] {\plannerGridDateDayFmt \d};
+
+ % % Vertical lines
+
+ % \node (v-a-\i-\j) [right = \@tmp@a of bg.north west] {};
+ % \node (v-b-\i-\j) [right = \@tmp@a of bg.south west] {};
+ % \draw [gridcolor] (v-a-\i-\j) -- (v-b-\i-\j);
+ }
+ }
+ }
+
+ \calendar (cal) [
+ year planner landscape grid days,
+ dates=\CalendarYear-01-01 to \CalendarYear-12-31,
+ below right = 0pt and 0pt of bg.north west,
+ anchor = north west,
+ yshift = -\plannerGridDayHeadingsHeight - 3mm,
+ xshift = \plannerGridMonthNamesWidth + 0.5\plannerGridColXShift + 4pt,
+ ] \@wall@plmYear;
+
+ \@wall@plNotesOneCalendar
+
+\end{tikzpicture}%
+}
+
+\newcommand{\YearPlannerLandscapeGridPage}{%
+\pagecolor{pagebgcolor}%
+\AddToShipoutPictureFG*{\put(\LenToUnit{\@wall@leftMargin},\LenToUnit{\@wall@bottomMargin})%
+{\begin{minipage}[b]{\plannerGridCalendarWidth}%
+\YearPlannerLandscapeGrid
+
+\begin{minipage}[b][10mm][c]{\plannerGridCalendarWidth}%
+\plannerGridNotesFmt
+\hspace*{2mm}%
+\parseYearEvents[%
+ filter pred = hasNote,
+ format cmd = {\textsuperscript{\eIdx}~\eMonthShort~\eDay:~\textit{\eNote}\ifnumless{\eIdx}{\eMaxIdx}{,\space}{.}},
+]%
+\end{minipage}%
+\end{minipage}%
+}}}
+
+% Load internal translations
+\InputIfFileExists{i18n/wallcalendar-\@wall@calendarLanguage.tex}{}%
+{\ClassError{wallcalendar}{File Not Found: i18n/wallcalendar-\@wall@calendarLanguage.tex}{}}
+
+% Load user translations if the option was set and translationsAutoload is true
+
+\newcommand\LoadTranslations{%
+\InputIfFileExists{\@wall@translationsInputFile}{}%
+{\ClassWarning{wallcalendar}{File Not Found: \@wall@translationsInputFile}{}}}
+
+\notblank{\@wall@translationsInputFile}{%
+\iftranslationsAutoload \LoadTranslations \fi}
+
+\newcommand*\@tr@monthNumName[1]{%
+\ifcase#1 \relax\or \xJanuary\or \xFebruary\or \xMarch\or \xApril\or \xMay\or \xJune\or
+\xJuly\or \xAugust\or \xSeptember\or \xOctober\or \xNovember\or \xDecember\fi}
+
+\newcommand*\@tr@dayLetter[1]{%
+\ifcase#1 \xMondayDayLetter\or \xTuesdayDayLetter\or \xWednesdayDayLetter\or
+\xThursdayDayLetter\or \xFridayDayLetter\or \xSaturdayDayLetter\or \xSundayDayLetter\fi}
+
+\newcommand*{\monthToNum}[1]{%
+\luadirect{
+ local monthToNum = {
+ january = '01',
+ february = '02',
+ march = '03',
+ april = '04',
+ may = '05',
+ june = '06',
+ july = '07',
+ august = '08',
+ september = '09',
+ october = '10',
+ november = '11',
+ december = '12',
+ }
+ local key = string.lower('#1')
+ tex.sprint(monthToNum[key])
+}}
+
+\newcommand*\monthName[1]{%
+% \ifcase might be just fine here
+\luadirect{
+ local monthName = {
+ 'January', 'February', 'March', 'April', 'May', 'June', 'July',
+ 'August', 'September', 'October', 'November', 'December',
+ }
+ local key = tonumber('#1')
+ tex.sprint(monthName[key])
+}}
+
+% End of wallcalendar.cls