diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-03-22 19:40:13 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-03-22 19:40:13 +0100 |
commit | 8f9666a32a4bc5b9bf7350212eadb5cfd9bbe41e (patch) | |
tree | ba5c248fc4937ecac3950c807d1a5ccf5bfade8b | |
parent | Begin changing how html calls work. (diff) | |
download | calp-8f9666a32a4bc5b9bf7350212eadb5cfd9bbe41e.tar.gz calp-8f9666a32a4bc5b9bf7350212eadb5cfd9bbe41e.tar.xz |
Start work on week-by-week html.
Diffstat (limited to '')
-rw-r--r-- | module/entry-points/html.scm | 6 | ||||
-rw-r--r-- | module/output/html.scm | 8 |
2 files changed, 8 insertions, 6 deletions
diff --git a/module/entry-points/html.scm b/module/entry-points/html.scm index d5f21233..6655d63a 100644 --- a/module/entry-points/html.scm +++ b/module/entry-points/html.scm @@ -18,7 +18,7 @@ (file (value #t) (single-char #\f)) (count (value #t)) (style (value #t) (predicate ,(lambda (v) (memv (string->symbol v) - '(wide unchunked table))))))) + '(wide week unchunked table))))))) (define (main args) (define opts (getopt-long args opt-spec)) @@ -43,7 +43,9 @@ [(unchunked) (html-generate calendars events start end render-calendar)] [(wide) ; previously `chunked' - (html-chunked-main count calendars events start)] + (html-chunked-main count calendars events start (date month: 1))] + [(week) + (html-chunked-main count calendars events start (date day: 7))] [(table) (html-table-main count calendars events start)] [else diff --git a/module/output/html.scm b/module/output/html.scm index fa9d4f47..b35a4d2f 100644 --- a/module/output/html.scm +++ b/module/output/html.scm @@ -565,7 +565,7 @@ ,@(stream->list (stream-map fmt-day evs))))))))) -(define-public (html-chunked-main count calendars events start-date) +(define-public (html-chunked-main count calendars events start-date chunk-length) ;; TODO This still doesn't account for PWD, file existing but is of ;; wrong type, html directory existing but static symlink missing, ;; static being a different file type, and probably something else @@ -583,10 +583,10 @@ (format (current-error-port) "Writing to [~a]~%" fname) (with-output-to-file fname (lambda () (html-generate calendars events start-date end-date render-calendar - next-start: month+ - prev-start: month- + next-start: (lambda (d) (date+ d chunk-length)) + prev-start: (lambda (d) (date- d chunk-length)) ))))]) - (let ((ms (month-stream start-date))) + (let ((ms (stream-iterate (cut date+ <> chunk-length) start-date))) (with-streams (take count (zip ms |