aboutsummaryrefslogtreecommitdiff
path: root/module/html/util.scm
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2020-08-23 23:22:10 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2020-08-23 23:22:10 +0200
commitedaf758b80fed1f5f14cd4b192e661c8863e84bc (patch)
tree9baf17c11a6254e81f29a1c473e5eb86c072aa79 /module/html/util.scm
parentAdd rendering of standalone small-cal. (diff)
downloadcalp-edaf758b80fed1f5f14cd4b192e661c8863e84bc.tar.gz
calp-edaf758b80fed1f5f14cd4b192e661c8863e84bc.tar.xz
Move html modules under calp.
Diffstat (limited to 'module/html/util.scm')
-rw-r--r--module/html/util.scm46
1 files changed, 0 insertions, 46 deletions
diff --git a/module/html/util.scm b/module/html/util.scm
deleted file mode 100644
index 4e15356a..00000000
--- a/module/html/util.scm
+++ /dev/null
@@ -1,46 +0,0 @@
-(define-module (html util)
- :use-module ((base64) :select (base64encode base64decode))
- :use-module (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
- (let ((id (make-object-property)))
- (lambda (ev)
- (or (id ev)
- (set/r! (id ev) (symbol->string (gensym "__html_id_")))))))