From 2d26f2e4e33e16559bc337c434ba255ad4ce96aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Thu, 19 Mar 2020 02:26:09 +0100 Subject: Rewamp HTML-main to allow for more styles. --- module/entry-points/html.scm | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/module/entry-points/html.scm b/module/entry-points/html.scm index 55fb0c94..d5f21233 100644 --- a/module/entry-points/html.scm +++ b/module/entry-points/html.scm @@ -13,11 +13,12 @@ (define opt-spec - '((from (value #t) (single-char #\F)) + `((from (value #t) (single-char #\F)) (to (value #t) (single-char #\T)) (file (value #t) (single-char #\f)) (count (value #t)) - (chunked))) + (style (value #t) (predicate ,(lambda (v) (memv (string->symbol v) + '(wide unchunked table))))))) (define (main args) (define opts (getopt-long args opt-spec)) @@ -26,7 +27,9 @@ (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 count (string->number (option-ref opts 'count "12"))) + + (define style (string->symbol (option-ref opts 'style "wide"))) (define-values (calendars events) (load-calendars @@ -36,6 +39,12 @@ (report-time! "Calendars loaded") - (if (option-ref opts 'chunked #f) - (html-chunked-main count calendars events start) - (html-generate calendars events start end render-calendar))) + (case style + [(unchunked) + (html-generate calendars events start end render-calendar)] + [(wide) ; previously `chunked' + (html-chunked-main count calendars events start)] + [(table) + (html-table-main count calendars events start)] + [else + (error "Unknown html style: ~a" style)])) -- cgit v1.2.3