aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2023-11-14 00:31:19 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2023-11-16 00:51:19 +0100
commit8df1c642c101db44f9b655027f0be78bfeb6cb96 (patch)
tree18245bcfbb421724ccb4bb75dc8e6970f51e1153
parentExport 'extract' from (vcomponent) (diff)
downloadcalp-8df1c642c101db44f9b655027f0be78bfeb6cb96.tar.gz
calp-8df1c642c101db44f9b655027f0be78bfeb6cb96.tar.xz
Formatting changes.
-rw-r--r--module/vcomponent/create.scm24
-rw-r--r--module/vcomponent/datetime.scm18
2 files changed, 23 insertions, 19 deletions
diff --git a/module/vcomponent/create.scm b/module/vcomponent/create.scm
index 355839f0..ebf845fe 100644
--- a/module/vcomponent/create.scm
+++ b/module/vcomponent/create.scm
@@ -68,20 +68,22 @@
(cond ((null? attrs*) (values '() '()))
((even? (length attrs*)) (values attrs* '()))
(else (init+last attrs*))))
+
+ (define (attach-property pair component)
+ (let ((k value (car+cdr pair)))
+ (prop* component k
+ (cond ((vline? value)
+ (key value k))
+ ((list-value? value)
+ (map (lambda (value) (vline key: k vline-value: value))
+ (list-value-value value)))
+ (else (vline key: k vline-value: value))))))
+
;; TODO add-child requires a UID on the child
;; Possibly just genenerate one here if missing
(fold (swap add-child)
- (fold (lambda (pair component)
- (let ((k value (car+cdr pair)))
- (prop* component k
- (cond ((vline? value)
- (key value k))
- ((list-value? value)
- (map (lambda (value) (vline key: k vline-value: value))
- (list-value-value value)))
- (else (vline key: k vline-value: value))))))
- (vcs-vcomponent
- type: type)
+ (fold attach-property
+ (vcs-vcomponent type: type)
(upcase-keys (kvlist->assq attrs)))
children))
diff --git a/module/vcomponent/datetime.scm b/module/vcomponent/datetime.scm
index 5aa6f4ab..886fb519 100644
--- a/module/vcomponent/datetime.scm
+++ b/module/vcomponent/datetime.scm
@@ -80,8 +80,10 @@ Event must have the DTSTART and DTEND protperty set."
(date day: 1)
(datetime))
((if (date? (prop e 'DTSTART))
- date-difference datetime-difference)
- (prop e 'DTEND) (prop e 'DTSTART))))
+ date-difference
+ datetime-difference)
+ (prop e 'DTEND)
+ (prop e 'DTSTART))))
;;
;; |-----| extent of event
@@ -147,11 +149,10 @@ Event must have the DTSTART and DTEND protperty set."
(define (really-long-event? ev)
(let ((start (prop ev 'DTSTART))
(end (prop ev 'DTEND)))
- (if (date? start)
- (and end (date< (date+ start (date day: 1)) end))
- (and end
- (datetime< (datetime day: 1)
- (datetime-difference end start))))))
+ (and end (if (date? start)
+ (date< (date+ start (date day: 1)) end)
+ (datetime< (datetime day: 1)
+ (datetime-difference end start))))))
;; DTEND of the last instance of this event.
@@ -311,5 +312,6 @@ Event must have the DTSTART and DTEND protperty set."
])
)
(prop (vcomponent type: 'VTIMEZONE) 'TZID zone-name)
- (filter (relevant-zone-entry? event) (get-zone zoneinfo zone-name))
+ (filter (relevant-zone-entry? event)
+ (get-zone zoneinfo zone-name))
))