aboutsummaryrefslogtreecommitdiff
path: root/module/calp/html/util.scm
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2021-11-10 00:09:30 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2021-11-10 00:12:14 +0100
commit720863f5e183fb78866041df36ee8bd4f9a42f72 (patch)
treee4ff1333d980b9ccc0561da3f8f6d53ad17c6a44 /module/calp/html/util.scm
parentBetter handle debug tab. (diff)
downloadcalp-720863f5e183fb78866041df36ee8bd4f9a42f72.tar.gz
calp-720863f5e183fb78866041df36ee8bd4f9a42f72.tar.xz
Calendar colors now handled through html datasets.
Previously css rules for each calendar (governing color) where handled through CSS classes. This however had the problem that all calendar names needed to be mapped unto valid classnames, and it brought some problems with updating it. This change places the calendar information in the dataset.calendar attribute. It's still base64 encoded, so special characters don't need escaping, and XML doesn't trip up.
Diffstat (limited to 'module/calp/html/util.scm')
-rw-r--r--module/calp/html/util.scm31
1 files changed, 0 insertions, 31 deletions
diff --git a/module/calp/html/util.scm b/module/calp/html/util.scm
index cd5aaeab..40852279 100644
--- a/module/calp/html/util.scm
+++ b/module/calp/html/util.scm
@@ -1,42 +1,11 @@
(define-module (calp html util)
- :use-module ((base64) :select (base64encode base64decode))
:use-module (calp util))
-;;; @var{html-attr} & @var{html-unattr} used to just strip any
-;;; attributes not valid in css. That allowed a human reader to
-;;; quickly see what data it was. The downside was that it was one
-;;; way. The new base64 based system supports both an encode and a
-;;; decode without problem.
-;;;
-;;; The encoded string substitutes { + => å, / => ä, = => ö } to be
-;;; valid CSS selector names.
-
-;; Retuns an HTML-safe version of @var{str}.
-(define-public (html-attr str)
- (string-map (lambda (c)
- (case c
- ((#\+) #\å)
- ((#\/) #\ä)
- ((#\=) #\ö)
- (else c)))
- (base64encode str)))
-
-(define-public (html-unattr str)
- (base64decode
- (string-map (lambda (c)
- (case c
- ((#\å) #\+)
- ((#\ä) #\/)
- ((#\ö) #\=)
- (else c)))
- str)))
-
(define-public (date-link date)
((@ (datetime) date->string) date "~Y-~m-~d"))
-
;; Generate an html id for an event.
;; TODO? same event placed multiple times, when spanning multiple cells
(define-public html-id