From 8df1c642c101db44f9b655027f0be78bfeb6cb96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Tue, 14 Nov 2023 00:31:19 +0100 Subject: Formatting changes. --- module/vcomponent/create.scm | 24 +++++++++++++----------- module/vcomponent/datetime.scm | 18 ++++++++++-------- 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)) )) -- cgit v1.2.3