diff options
author | Hugo Hörnquist <hugo@hornquist.se> | 2019-04-24 01:08:06 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@hornquist.se> | 2019-04-24 01:08:06 +0200 |
commit | d26d16dc7d70077d47089756fb30fe4b6e3808d4 (patch) | |
tree | 76e98d857fbd8d355580bde4858a985433ad7c36 /module/output/html.scm | |
parent | Improve text layout code. (diff) | |
download | calp-d26d16dc7d70077d47089756fb30fe4b6e3808d4.tar.gz calp-d26d16dc7d70077d47089756fb30fe4b6e3808d4.tar.xz |
Add 'from' and 'to' flags to HTML.
Diffstat (limited to '')
-rw-r--r-- | module/output/html.scm | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/module/output/html.scm b/module/output/html.scm index 614fc1cb..a58fce0c 100644 --- a/module/output/html.scm +++ b/module/output/html.scm @@ -10,6 +10,8 @@ #:use-module (srfi srfi-19 util) #:use-module (output general) + #:use-module (ice-9 getopt-long) + #:use-module (parameters) #:use-module (config)) @@ -114,21 +116,26 @@ ,(string-append time ":00"))) (map number->string (iota 12 0 2)))) -(define (d str) - (string->date str "~Y-~m-~d")) - (define (include-css path) `(link (@ (type "text/css") (rel "stylesheet") (href ,path)))) +(define opt-spec + '((from (value #t) (single-char #\f)) + (to (value #t) (single-char #\t)))) + (define-public (html-main calendars events args) + (define opts (getopt-long args opt-spec)) + + (define start (parse-freeform-date (option-ref opts 'from "2019-04-15"))) + (define end (parse-freeform-date (option-ref opts 'to "2019-05-10"))) + (define evs (filter-sorted-stream - (compose (in-date-range? - (d "2019-04-15") - (d "2019-05-10")) + ;; TODO in-date-range? drops the first date + (compose (in-date-range? start end) car) (group-stream events))) |