aboutsummaryrefslogtreecommitdiff
path: root/vcalendar/output.scm
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/output.scm
parentFix error when looking at cloned events. (diff)
downloadcalp-58b2524b89d4db614aadbd8497b6e791e0d999cf.tar.gz
calp-58b2524b89d4db614aadbd8497b6e791e0d999cf.tar.xz
Move stuff between modules.
Diffstat (limited to '')
-rw-r--r--vcalendar/output.scm (renamed from code.scm)32
1 files changed, 8 insertions, 24 deletions
diff --git a/code.scm b/vcalendar/output.scm
index af6c7b8c..908dab34 100644
--- a/code.scm
+++ b/vcalendar/output.scm
@@ -1,28 +1,14 @@
-(define-module (code)
- #:export (extract sort* color-if
- STR-YELLOW STR-RESET
- print-vcomponent))
-
-(use-modules (srfi srfi-19)
- (srfi srfi-19 util)
- (srfi srfi-26)
- (vcalendar)
- (util))
-
-(define (extract field)
- (cut get-attr <> field))
-
-;;; This function borrowed from web-ics (calendar util)
-(define* (sort* items comperator #:optional (get identity))
- "A sort function more in line with how python's sorted works"
- (sort items (lambda (a b)
- (comperator (get a)
- (get b)))))
+(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"
@@ -30,9 +16,8 @@
(begin body ...)
(if pred-value STR-RESET ""))))
-
(define* (print-vcomponent comp #:optional (depth 0))
- (let ((kvs (map (lambda (key) (cons key (get-attr comp key)))
+ (let ((kvs (map (lambda (key) (cons key (attr comp key)))
(attributes comp))))
(format #t "~a <~a> :: ~:a~%"
(make-string depth #\:)
@@ -46,4 +31,3 @@
key value))))
(for-each-in (children comp)
(cut print-vcomponent <> (1+ depth)))))
-