From 9535050425fb4958b861288bd3b2dcf18eed6c6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sat, 1 Jun 2019 21:33:28 +0200 Subject: Fix serialize-vcomponent. --- module/vcomponent/output.scm | 25 +++++++++++-------------- 1 file 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) -- cgit v1.2.3