diff options
author | Hugo Hörnquist <hugo@hornquist.se> | 2019-06-01 21:33:28 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@hornquist.se> | 2019-06-01 21:33:28 +0200 |
commit | 9535050425fb4958b861288bd3b2dcf18eed6c6d (patch) | |
tree | a5e112df415be2b00502fef809d87a52ff24f23d /module/vcomponent | |
parent | Fix segfault when getting extension from file without one. (diff) | |
download | calp-9535050425fb4958b861288bd3b2dcf18eed6c6d.tar.gz calp-9535050425fb4958b861288bd3b2dcf18eed6c6d.tar.xz |
Fix serialize-vcomponent.
Diffstat (limited to '')
-rw-r--r-- | module/vcomponent/output.scm | 25 |
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) |