From 122043d1e621923a8fde3698d055aea12e3f05ee Mon Sep 17 00:00:00 2001 From: Christoph Date: Sat, 3 Jul 2021 10:25:09 +0200 Subject: [PATCH] Corrected gen_vor.php --- gen_vor.php | 9 ++++++++- layouts/partial/site-header.html~ | 30 ----------------------------- layouts/shortcodes/dat.html~ | 32 ------------------------------- layouts/shortcodes/past.html~ | 3 --- layouts/shortcodes/tabref.html~ | 1 - layouts/shortcodes/vor.html~ | 2 -- 6 files changed, 8 insertions(+), 69 deletions(-) delete mode 100644 layouts/partial/site-header.html~ delete mode 100644 layouts/shortcodes/dat.html~ delete mode 100644 layouts/shortcodes/past.html~ delete mode 100644 layouts/shortcodes/tabref.html~ delete mode 100644 layouts/shortcodes/vor.html~ diff --git a/gen_vor.php b/gen_vor.php index 277c0cb..df1cebb 100644 --- a/gen_vor.php +++ b/gen_vor.php @@ -8,6 +8,13 @@ $fil = file($file_txt, FILE_IGNORE_NEW_LINES); // Insert header $arr = ['| | | |', '|:------|:------|:------|']; $ts=(new DateTime('first day of this month'))->getTimeStamp(); +$tues_ts = strtotime('fourth tuesday of this month + 1 day', $ts); + +// Are we past the fourst Tuesday in the month? +if ((new DateTime())->getTimeStamp() >= $tues_ts) { + $ts = strtotime('+1 month', $ts); +} + foreach ($fil as $line) { $fields = array_filter(explode('|', $line)); if (count($fields) == 2) { @@ -15,7 +22,7 @@ foreach ($fil as $line) { $tuesday = strftime('%A, %d.%m.%Y ', strtotime('fourth tuesday of this month', $ts)); array_unshift($fields, $tuesday); } - $ts=strtotime('+1 month', $ts); + $ts = strtotime('+1 month', $ts); $li = implode('|', $fields); // Insert leading and trailing spaces if required if ($li[0] != ' ') { diff --git a/layouts/partial/site-header.html~ b/layouts/partial/site-header.html~ deleted file mode 100644 index 92f5027..0000000 --- a/layouts/partial/site-header.html~ +++ /dev/null @@ -1,30 +0,0 @@ -
- -
- diff --git a/layouts/shortcodes/dat.html~ b/layouts/shortcodes/dat.html~ deleted file mode 100644 index 472b056..0000000 --- a/layouts/shortcodes/dat.html~ +++ /dev/null @@ -1,32 +0,0 @@ -
- - -
diff --git a/layouts/shortcodes/past.html~ b/layouts/shortcodes/past.html~ deleted file mode 100644 index e71090d..0000000 --- a/layouts/shortcodes/past.html~ +++ /dev/null @@ -1,3 +0,0 @@ -
- {{ readFile "vor.md" | markdownify }} -
diff --git a/layouts/shortcodes/tabref.html~ b/layouts/shortcodes/tabref.html~ deleted file mode 100644 index 3695c16..0000000 --- a/layouts/shortcodes/tabref.html~ +++ /dev/null @@ -1 +0,0 @@ -{{ .Get "title" }} diff --git a/layouts/shortcodes/vor.html~ b/layouts/shortcodes/vor.html~ deleted file mode 100644 index d3ffaf6..0000000 --- a/layouts/shortcodes/vor.html~ +++ /dev/null @@ -1,2 +0,0 @@ -
- {{ readFile "vor.md" | markdownify }}