aboutsummaryrefslogtreecommitdiff
path: root/module/vcomponent/formats/xcal/types.scm
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2023-12-13 11:06:57 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2023-12-13 11:17:34 +0100
commit00a66eca0f32fcf585d2c21375641020e877e3ea (patch)
treec2aceeb5047bf46e03726e1c5e8378cf86a4df63 /module/vcomponent/formats/xcal/types.scm
parentFix sxml namespaced util. (diff)
downloadcalp-00a66eca0f32fcf585d2c21375641020e877e3ea.tar.gz
calp-00a66eca0f32fcf585d2c21375641020e877e3ea.tar.xz
Update things depending on namespaced sxml.sxml-work
Update all code to emit correctly formed namespaced sxml objects, instead of the old list based approach. Also introduces a number of typechecks which in semi-related parts of the code. Note that the webdav-server test is currently broken.
Diffstat (limited to 'module/vcomponent/formats/xcal/types.scm')
-rw-r--r--module/vcomponent/formats/xcal/types.scm30
1 files changed, 16 insertions, 14 deletions
diff --git a/module/vcomponent/formats/xcal/types.scm b/module/vcomponent/formats/xcal/types.scm
index 812f1d20..b9b8239d 100644
--- a/module/vcomponent/formats/xcal/types.scm
+++ b/module/vcomponent/formats/xcal/types.scm
@@ -9,32 +9,33 @@
:export (get-writer))
(define (write-boolean _ v)
- `(,(xml xcal 'boolean) ,(if v "true" "false")))
+ ((xml xcal 'boolean) (if v "true" "false")))
(define (write-date _ v)
- `(,(xml xcal 'date) ,(date->string v "~Y-~m-~d")))
+ ((xml xcal 'date) (date->string v "~Y-~m-~d")))
(define (write-datetime p v)
- `(,(xml xcal 'date-time)
- ,(datetime->string
- (table-get p '-X-HNH-ORIGINAL v)
- ;; 'Z' should be included for UTC,
- ;; other timezones MUST be specified
- ;; in the TZID parameter.
- "~Y-~m-~dT~H:~M:~S~Z")))
+ ((xml xcal 'date-time)
+ (datetime->string
+ (table-get p '-X-HNH-ORIGINAL v)
+ ;; 'Z' should be included for UTC,
+ ;; other timezones MUST be specified
+ ;; in the TZID parameter.
+ "~Y-~m-~dT~H:~M:~S~Z")))
(define (write-time _ v)
- `(,(xml xcal 'time) ,(time->string v "~H:~M:S")))
+ ((xml xcal 'time) (time->string v "~H:~M:S")))
(define (write-recur _ v)
- `(,(xml xcal 'recur) ,@((@@ (vcomponent recurrence internal) recur-rule->rrule-sxml) v)))
+ (apply (xml xcal 'recur)
+ ((@@ (vcomponent recurrence internal) recur-rule->rrule-sxml) v)))
;; sepparate since this text shouldn't be escaped
(define (write-text _ v)
;; TODO out type should be xsd:string.
;; Look into what that means, and escape
;; from there
- `(,(xml xcal 'text) ,v))
+ ((xml xcal 'text) v))
@@ -43,8 +44,9 @@
#| TODO PERIOD |# URI UTC-OFFSET)
(hashq-set! sxml-writers simple-type
(lambda (p v)
- `(,(xml xcal (downcase-symbol simple-type))
- ,(((@ (vcomponent formats ical types) get-writer) simple-type) p v)))))
+ ((xml xcal (downcase-symbol simple-type))
+ (((@ (vcomponent formats ical types) get-writer) simple-type)
+ p v)))))
(hashq-set! sxml-writers 'BOOLEAN write-boolean)
(hashq-set! sxml-writers 'DATE write-date)