aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@hornquist.se>2019-06-01 21:33:28 +0200
committerHugo Hörnquist <hugo@hornquist.se>2019-06-01 21:33:28 +0200
commit9535050425fb4958b861288bd3b2dcf18eed6c6d (patch)
treea5e112df415be2b00502fef809d87a52ff24f23d
parentFix segfault when getting extension from file without one. (diff)
downloadcalp-9535050425fb4958b861288bd3b2dcf18eed6c6d.tar.gz
calp-9535050425fb4958b861288bd3b2dcf18eed6c6d.tar.xz
Fix serialize-vcomponent.
-rw-r--r--module/vcomponent/output.scm25
1 files changed, 11 insertions, 14 deletions
diff --git a/module/vcomponent/output.scm b/module/vcomponent/output.scm
index ee84d359..db4d4f33 100644
--- a/module/vcomponent/output.scm
+++ b/module/vcomponent/output.scm
@@ -57,7 +57,6 @@
(else => string)))
(string->list str))))
-;;; TODO parameters ( ;KEY=val: )
(define* (serialize-vcomponent comp #:optional (port (current-output-port)))
"Recursively write a component back to its ICS form.
Removes the X-HNH-FILENAME attribute, and sets PRODID to
@@ -66,25 +65,23 @@ Removes the X-HNH-FILENAME attribute, and sets PRODID to
(comp (prodid "HugoNikanor-calparse"))
(format port "BEGIN:~a~%" (type comp))
+
(let ((kvs (map (lambda (key) (list key (attr comp key)))
- (filter (negate (cut key=? <> 'X-HNH-FILENAME))
- (attributes comp)))))
+ (attributes comp))))
(for kv in kvs
(let* (((key value) kv))
(catch 'wrong-type-arg
(lambda ()
- (format port "~a:~a~%" key
+ (format port "~a~:{;~a=~a~}:~a~%"
+ key
+ (properties (attr* comp key))
(string->ics-safe-string
- (or (case key
- ((DTSTART DTEND)
- (if (string? value)
- value
- (time->string value "~Y~m~dT~H~M~S")))
-
- ((DURATION) "Just forget it")
-
- (else value))
- ""))))
+ (case key
+ ((DTSTART DTEND)
+ (if (string? value)
+ value
+ (time->string value "~Y~m~dT~H~M~S")))
+ (else value)))))
;; Catch
(lambda (type proc fmt . args)