aboutsummaryrefslogtreecommitdiff
path: root/vcalendar
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2019-03-08 14:49:57 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2019-03-08 14:49:57 +0100
commit58b2524b89d4db614aadbd8497b6e791e0d999cf (patch)
treeeba5a635e302b998751810920184fa4c72b25be7 /vcalendar
parentFix error when looking at cloned events. (diff)
downloadcalp-58b2524b89d4db614aadbd8497b6e791e0d999cf.tar.gz
calp-58b2524b89d4db614aadbd8497b6e791e0d999cf.tar.xz
Move stuff between modules.
Diffstat (limited to 'vcalendar')
-rw-r--r--vcalendar/output.scm33
-rw-r--r--vcalendar/recur.scm2
2 files changed, 34 insertions, 1 deletions
diff --git a/vcalendar/output.scm b/vcalendar/output.scm
new file mode 100644
index 00000000..908dab34
--- /dev/null
+++ b/vcalendar/output.scm
@@ -0,0 +1,33 @@
+(define-module (vcalendar output)
+ #:use-module (vcalendar)
+ #:use-module (util)
+ #:use-module (srfi srfi-26)
+ #:export (print-vcomponent
+ color-if
+ STR-YELLOW STR-RESET))
+
+(define STR-YELLOW "\x1b[0;33m")
+(define STR-RESET "\x1b[m")
+
+(define-syntax-rule (color-if pred color body ...)
+ (let ((pred-value pred))
+ (format #f "~a~a~a"
+ (if pred-value color "")
+ (begin body ...)
+ (if pred-value STR-RESET ""))))
+
+(define* (print-vcomponent comp #:optional (depth 0))
+ (let ((kvs (map (lambda (key) (cons key (attr comp key)))
+ (attributes comp))))
+ (format #t "~a <~a> :: ~:a~%"
+ (make-string depth #\:)
+ (type comp) comp)
+ (for-each-in kvs
+ (lambda (kv)
+ (let ((key (car kv))
+ (value (cdr kv)))
+ (format #t "~a ~20@a: ~a~%"
+ (make-string depth #\:)
+ key value))))
+ (for-each-in (children comp)
+ (cut print-vcomponent <> (1+ depth)))))
diff --git a/vcalendar/recur.scm b/vcalendar/recur.scm
index 23c00b12..80bd03a9 100644
--- a/vcalendar/recur.scm
+++ b/vcalendar/recur.scm
@@ -155,7 +155,7 @@
(time-difference
(attr event "DTEND")
(attr event "DTSTART"))))
- (recur-event-stream event (build-recur-rules (get-attr event "RRULE"))))
+ (recur-event-stream event (build-recur-rules (attr event "RRULE"))))
(define tzero (make-time time-utc 0 0))
(define dzero (time-utc->date tzero))