aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@hornquist.se>2019-04-20 21:41:44 +0200
committerHugo Hörnquist <hugo@hornquist.se>2019-04-20 21:41:44 +0200
commit49afa89eb2d5a59f66befa908d2a999456ce40df (patch)
tree7514851b98876d59fee0be08330fdf31f9e51f8a
parentChange parse-datetime back to single return. (diff)
downloadcalp-49afa89eb2d5a59f66befa908d2a999456ce40df.tar.gz
calp-49afa89eb2d5a59f66befa908d2a999456ce40df.tar.xz
Improve print-vcomponent.
-rw-r--r--module/vcalendar/output.scm16
1 files changed, 9 insertions, 7 deletions
diff --git a/module/vcalendar/output.scm b/module/vcalendar/output.scm
index a15857f7..2abc1e08 100644
--- a/module/vcalendar/output.scm
+++ b/module/vcalendar/output.scm
@@ -20,20 +20,22 @@
(begin body ...)
(if pred-value STR-RESET ""))))
-(define* (print-vcomponent comp #:optional (depth 0))
- (let ((kvs (map (lambda (key) (cons key (attr comp key)))
+(define* (print-vcomponent comp #:optional (port #t) #:key (depth 0))
+ (let ((kvs (map (lambda (key) (cons key (attr* comp key)))
(attributes comp))))
- (format #t "~a <~a> :: ~:a~%"
+ (format port "~a <~a> :: ~:a~%"
(make-string depth #\:)
(type comp) comp)
(for-each-in kvs
(lambda (kv)
- (let* (((key . value) kv))
- (format #t "~a ~20@a: ~a~%"
+ (let* (((key . at) kv))
+ (format port "~a ~15@a~{;~a=~{~a~^,~}~}: ~a~%"
(make-string depth #\:)
- key value))))
+ key
+ (concat (hash-map->list list (cdr at)))
+ (v at)))))
(for-each-in (children comp)
- (cut print-vcomponent <> (1+ depth)))))
+ (lambda (e) (print-vcomponent e port #:depth (1+ depth))))))