aboutsummaryrefslogtreecommitdiff
path: root/module/output/ical.scm
diff options
context:
space:
mode:
Diffstat (limited to 'module/output/ical.scm')
-rw-r--r--module/output/ical.scm19
1 files changed, 10 insertions, 9 deletions
diff --git a/module/output/ical.scm b/module/output/ical.scm
index e289456b..1c9ce187 100644
--- a/module/output/ical.scm
+++ b/module/output/ical.scm
@@ -75,15 +75,16 @@
(handle-value (value vline))))
(define (escape-chars str)
- (with-output-to-string
- (lambda ()
- (string-for-each
- (lambda (ch)
- (case ch
- ((#\, #\; #\\) => (lambda (c) (display "\\") (display c)))
- ((#\newline) (display "\\n"))
- (else (display ch))))
- str))))
+ (define (escape char)
+ (string #\\ char))
+ (string-concatenate
+ (map (lambda (c)
+ (case c
+ ((#\newline) "\\n")
+ ((#\, #\; #\\) => escape)
+ (else => string)))
+ (string->list str))))
+
(define (generate-uuid)
((@ (rnrs io ports) call-with-port)