aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2020-04-07 09:39:07 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2020-04-07 09:39:07 +0200
commitb24e655996463bbb17d732d81788b410f28ae05d (patch)
tree67376b6541496f8e3bf37ab2a61314a820dcb446
parentAdded pretty formatter for RRULE:s. (diff)
downloadcalp-b24e655996463bbb17d732d81788b410f28ae05d.tar.gz
calp-b24e655996463bbb17d732d81788b410f28ae05d.tar.xz
Add location to blocks, rrules and last-modified to text in html.
-rw-r--r--module/output/html.scm28
-rw-r--r--module/vcomponent/parse.scm2
-rw-r--r--static/style.css28
3 files changed, 54 insertions, 4 deletions
diff --git a/module/output/html.scm b/module/output/html.scm
index 44e9d8d3..371edba9 100644
--- a/module/output/html.scm
+++ b/module/output/html.scm
@@ -159,7 +159,14 @@
(div (@ (class "popup"))
,(event-debug-html ev))
(div (@ (class "body"))
- ,((get-config 'summary-filter) ev (attr ev 'SUMMARY))))))
+ ,(when (attr ev 'RRULE)
+ `(span (@ (class "repeating")) "↺"))
+ ,((get-config 'summary-filter) ev (attr ev 'SUMMARY))
+ ,(when (attr ev 'LOCATION)
+ `(span (@ (class "location"))
+ ,(string-map (lambda (c) (if (char=? c #\,) #\newline c))
+ (attr ev 'LOCATION))))
+ ))))
)
@@ -308,14 +315,29 @@
" tentative")))
(h3 (a (@ (href "#" ,(date-link (as-date (attr ev 'DTSTART))))
(class "hidelink"))
+ ,(when (attr ev 'RRULE)
+ `(span (@ (class "repeating")) "↺"))
,(attr ev 'SUMMARY)))
(div
,(call-with-values (lambda () (fmt-time-span ev))
(match-lambda* [(start end) `(div ,start " — " ,end)]
[(start) `(div ,start)]))
,(when (and=> (attr ev 'LOCATION) (negate string-null?))
- `(div (b "Plats: ") ,(attr ev 'LOCATION)))
- ,(and=> (attr ev 'DESCRIPTION) (lambda (str) ((get-config 'description-filter) ev str))))))
+ `(div (b "Plats: ") (div (@ (class "location")),(string-map (lambda (c) (if (char=? c #\,) #\newline c)) (attr ev 'LOCATION)))))
+ ,(and=> (attr ev 'DESCRIPTION) (lambda (str) ((get-config 'description-filter) ev str)))
+ ,(awhen (attr ev 'RRULE)
+ `(span (@ (class "rrule"))
+ "Upprepas "
+ ,((compose (@ (vcomponent recurrence display) format-recurrence-rule)
+ (@ (vcomponent recurrence parse) parse-recurrence-rule))
+ it)
+ ;; TODO exdate
+ "."))
+ ,(when (attr ev 'LAST-MODIFIED)
+ `(span (@ (class "last-modified")) "Senast ändrad "
+ ,(datetime->string (attr ev 'LAST-MODIFIED) "~1 ~H:~M"))
+ )
+ )))
;; Single event in side bar (text objects)
(define (fmt-day day)
diff --git a/module/vcomponent/parse.scm b/module/vcomponent/parse.scm
index 7ae966a1..c7cb39d6 100644
--- a/module/vcomponent/parse.scm
+++ b/module/vcomponent/parse.scm
@@ -201,7 +201,7 @@ row ~a column ~a ctx = ~a
(strbuf->string strbuf ((@ (rnrs io ports) make-transcoder)
encoding))))])]
- [(DTSTART DTEND RECURRENCE-ID)
+ [(DTSTART DTEND RECURRENCE-ID LAST-MODIFIED DTSTAMP)
;; '("Africa/Ceuta" "Europe/Stockholm" "local")
(let ((tz (or (and=> (prop it 'TZID) car)
diff --git a/static/style.css b/static/style.css
index e7a51a6e..83cd35d5 100644
--- a/static/style.css
+++ b/static/style.css
@@ -435,6 +435,34 @@ Find color between gray and lightgray
border: 3px dashed black;
}
+.event .location {
+ display: block;
+ font-size: 80%;
+ font-style: italic;
+ white-space: pre;
+}
+
+.event .repeating {
+ float: left;
+ color: red;
+ font-size: 150%;
+}
+
+.eventtext .location {
+ display: inline-block;
+ vertical-align: text-top;
+}
+
+.eventtext .last-modified,
+.eventtext .rrule {
+ display: flex;
+ justify-content: right;
+ text-align: right;
+ font-size: 80%;
+ color: grey;
+ padding-right: 1em;
+}
+
/* */
.longevents .event {