aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2020-04-30 18:41:39 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2020-04-30 18:41:39 +0200
commitc74486cbb2efda112dc2631aa3ed84824fc61c8a (patch)
treee4369351dd510907c648d12db485077ec604f49b
parentUpdate ical parts to use app context. (diff)
downloadcalp-c74486cbb2efda112dc2631aa3ed84824fc61c8a.tar.gz
calp-c74486cbb2efda112dc2631aa3ed84824fc61c8a.tar.xz
Update HTML to use app.
-rw-r--r--module/entry-points/html.scm17
-rw-r--r--module/output/html.scm14
2 files changed, 16 insertions, 15 deletions
diff --git a/module/entry-points/html.scm b/module/entry-points/html.scm
index 70fbde42..d80de3b5 100644
--- a/module/entry-points/html.scm
+++ b/module/entry-points/html.scm
@@ -4,7 +4,7 @@
:use-module (util)
:use-module (util time)
:use-module (util config)
- :use-module (vcomponent)
+ ;; :use-module (vcomponent)
:use-module (datetime)
:use-module (datetime util)
:use-module (ice-9 getopt-long)
@@ -30,26 +30,17 @@
(define style (string->symbol (option-ref opts 'style "wide")))
- (define-values (calendars events)
- (cond [(option-ref opts 'file #f) => (compose load-calendars list)]
- [else (load-calendars)]))
-
-
- (report-time! "Calendars loaded")
-
(case style
- [(unchunked)
- (html-generate calendars events start end render-calendar)]
[(wide) ; previously `chunked'
- (html-chunked-main count calendars events start (date month: 1))]
+ (html-chunked-main count start (date month: 1))]
[(week)
;; TODO The small calendar is always centered on months, it might
;; be a good idea to instead center it on the current week, meaning
;; that the active row is always in the center
- (html-chunked-main count calendars events
+ (html-chunked-main count
(start-of-week start (get-config 'week-start))
(date day: 7))]
[(table)
- (html-table-main count calendars events start)]
+ (html-table-main count start)]
[else
(error "Unknown html style: ~a" style)]))
diff --git a/module/output/html.scm b/module/output/html.scm
index 8a932fd0..740be7b9 100644
--- a/module/output/html.scm
+++ b/module/output/html.scm
@@ -7,6 +7,7 @@
#:use-module (vcomponent group)
#:use-module (vcomponent datetime)
#:use-module (util)
+ #:use-module (util app)
#:use-module (util exceptions)
#:use-module (util config)
#:use-module (util tree)
@@ -745,7 +746,11 @@
,@(stream->list (stream-map fmt-day evs))))))))
-(define-public (html-chunked-main count calendars events start-date chunk-length)
+(define-method (html-chunked-main count start-date chunk-length)
+
+ (define calendars (getf app 'calendars))
+ (define events (getf app 'event-set))
+
;; 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
@@ -778,7 +783,12 @@
(cdr ms))))))))
-(define-public (html-table-main count calendars events start-date)
+
+(define-method (html-table-main count start-date)
+
+ (define calendars (getf app 'calendars))
+ (define events (getf app 'event-set))
+
;; TODO same file creation as in html-chunked-main
(stream-for-each
(lambda (start-of-month)