aboutsummaryrefslogtreecommitdiff
path: root/module
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@hornquist.se>2019-12-25 19:20:18 +0100
committerHugo Hörnquist <hugo@hornquist.se>2019-12-25 19:20:18 +0100
commitcad1bb506aa7b2723cbeb5ba435b65868c10916a (patch)
tree739796203154ec3b660557c4aa0061b94b865441 /module
parentICAL handling of events different from display handling. (diff)
downloadcalp-cad1bb506aa7b2723cbeb5ba435b65868c10916a.tar.gz
calp-cad1bb506aa7b2723cbeb5ba435b65868c10916a.tar.xz
HTML output only describe multi-day events once.
The HTML renderer mostly works in days. Events spanning over midnight therefore appears multiple times in the layout. This lead to their start-time + uid not to be unique any more, which was bad since I assumed it to be unique. This commit only describes a multi-day event on the day the event starts, with a special case for events which start before a given time span. Repeating events aren't affected, and are still show once per instance.
Diffstat (limited to 'module')
-rw-r--r--module/output/html.scm25
1 files changed, 24 insertions, 1 deletions
diff --git a/module/output/html.scm b/module/output/html.scm
index 21713455..977c73b9 100644
--- a/module/output/html.scm
+++ b/module/output/html.scm
@@ -1,5 +1,6 @@
(define-module (output html)
#:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-26)
#:use-module (srfi srfi-41)
#:use-module (srfi srfi-41 util)
#:use-module (vcomponent)
@@ -149,7 +150,16 @@
(header (h2 ,(let ((s (date->string date "~Y-~m-~d")))
`(a (@ (href "#" ,s)
(class "hidelink")) ,s))))
- ,@(map fmt-single-event (stream->list events)))))
+ ,@(stream->list
+ (stream-map fmt-single-event
+ (stream-filter
+ (lambda (ev)
+ ;; If start was an earlier day
+ ;; This removes all descriptions from events for previous days,
+ ;; solving duplicates.
+ (time<? (date->time-utc date)
+ (attr ev 'DTSTART)))
+ events))))))
(define (days-in-month n)
(cond ((memv n '(1 3 5 7 8 10 12)) 31)
@@ -226,6 +236,11 @@
(define repo-url (make-parameter "https://git.hornquist.se"))
+;;; NOTE
+;;; The side bar filters all earlier events for each day to not create repeats,
+;;; and the html-generate procedure also filters, but instead to find earlier eventns.
+;;; All this filtering is probably slow, and should be looked into.
+
(define-public (html-generate calendars events start end)
(define evs (get-groups-between (group-stream events)
start end))
@@ -293,6 +308,14 @@
;; List of events
(div (@ (class "eventlist"))
+ ;; Events which started before our start point, but "spill" into our time span.
+ (section (@ (class "text-day"))
+ (header (h2 "Tidigare"))
+ ,@(stream->list
+ (stream-map fmt-single-event
+ (stream-take-while (compose (cut time<? <> (date->time-utc start))
+ (extract 'DTSTART))
+ (cdr (stream-car evs))))))
,@(stream->list (stream-map fmt-day evs)))))))))