aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--module/entry-points/html.scm5
-rw-r--r--module/output/html.scm4
2 files changed, 6 insertions, 3 deletions
diff --git a/module/entry-points/html.scm b/module/entry-points/html.scm
index 16306031..a5cd7303 100644
--- a/module/entry-points/html.scm
+++ b/module/entry-points/html.scm
@@ -15,6 +15,7 @@
'((from (value #t) (single-char #\F))
(to (value #t) (single-char #\T))
(file (value #t) (single-char #\f))
+ (count (value #t))
(chunked)))
(define (main args)
@@ -24,6 +25,8 @@
(define end (cond [(option-ref opts 'to #f) => parse-freeform-date]
[else (date+ start (date month: 1)) ]))
+ (define count (and=> (option-ref opts 'count "12") string->number))
+
(define-values (calendars events)
(load-calendars
calendar-files: (cond [(option-ref opts 'file #f) => list]
@@ -32,5 +35,5 @@
((@ (srfi srfi-41) stream->list) events)
(if (option-ref opts 'chunked #f)
- (html-chunked-main calendars events start)
+ (html-chunked-main count calendars events start)
(html-generate calendars events start end)))
diff --git a/module/output/html.scm b/module/output/html.scm
index b016d977..ba09c0ed 100644
--- a/module/output/html.scm
+++ b/module/output/html.scm
@@ -354,7 +354,7 @@
,@(stream->list (stream-map fmt-day evs)))))))))
-(define-public (html-chunked-main calendars events start-date)
+(define-public (html-chunked-main count calendars events start-date)
;; NOTE Something here isn't thread safe.
;; TODO make it thread safe
(stream-for-each
@@ -366,7 +366,7 @@
(lambda () (apply html-generate calendars events pair)))))
(let ((ms (month-stream start-date)))
(stream-take
- 12 (stream-zip
+ count (stream-zip
ms (stream-map (lambda (d) (date- d (date day: 1))) ; last in month
(stream-cdr ms))))
)))