From 977e04a898e1cff122de934e6b05e32ead186e9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sat, 2 Dec 2023 03:25:34 +0100 Subject: STASH: work on formats. --- module/vcomponent/formats/xcal.scm | 3 --- module/vcomponent/formats/xcal/parse.scm | 27 +++++++++++++++------------ tests/unit/formats/run.scm | 8 +++++--- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/module/vcomponent/formats/xcal.scm b/module/vcomponent/formats/xcal.scm index 8fadde75..b70a8f65 100644 --- a/module/vcomponent/formats/xcal.scm +++ b/module/vcomponent/formats/xcal.scm @@ -16,9 +16,6 @@ (namespaced-sxml->xml port: port namespaces: namespaces))) -(define (serialize/object component) - (call-with-output-string (lambda (p) (serialize component p)))) - (define* (deserialize port) (-> port diff --git a/module/vcomponent/formats/xcal/parse.scm b/module/vcomponent/formats/xcal/parse.scm index d0bc7bf2..c696edc1 100644 --- a/module/vcomponent/formats/xcal/parse.scm +++ b/module/vcomponent/formats/xcal/parse.scm @@ -16,6 +16,7 @@ :use-module (srfi srfi-88) :use-module (calp translation) :use-module (hnh util table) + :use-module (hnh util type) :export (sxcal->vcomponent) ) @@ -210,17 +211,17 @@ ;; TODO multi valued data (define raw-value (cdr typetag)) (define vline* - (vline type: tag* - value: (handle-tag - xml-tag - (let ((v (handle-value type parameters raw-value))) - ;; TODO possibly more list fields - ;; (if (eq? tag 'categories) - ;; (string-split v #\,) - ;; v) - - v)) - parameters: parameters)) + (vline key: tag* + vline-value: (handle-tag + xml-tag + (let ((v (handle-value type parameters raw-value))) + ;; TODO possibly more list fields + ;; (if (eq? tag 'categories) + ;; (string-split v #\,) + ;; v) + + v)) + vline-parameters: parameters)) (if (memv tag* '(ATTACH ATTENDEE CATEGORIES COMMENT CONTACT EXDATE REQUEST-STATUS RELATED-TO @@ -255,8 +256,10 @@ ;; would be expanded into ;; KEY;p=1:a ;; KEY;p=1:b + ;; TODO this crashes (fold swap handle-single-property - (vcomponent type: type) (cdr it)) + (vcomponent type: type) + (cdr it)) (vcomponent type: type)))) ;; children diff --git a/tests/unit/formats/run.scm b/tests/unit/formats/run.scm index 860ccae9..85650409 100644 --- a/tests/unit/formats/run.scm +++ b/tests/unit/formats/run.scm @@ -122,7 +122,7 @@ ((@@ (vcomponent formats sxcal) serialize/object) ev) `((,xcal . xcal))) p)) - ;; TODO parse + ;; parse: sxcs:deserialize )) (test-group "xCalendar" @@ -133,12 +133,14 @@ (lambda (port) (xcs:serialize ev port))) xmllint (display p))) - ;; TODO parse + parse: xcs:deserialize )) -'((vcomponent formats xcal) +'((vcomponent formats common types) + + (vcomponent formats xcal) (vcomponent formats xcal output) (vcomponent formats xcal parse) (vcomponent formats xcal types) -- cgit v1.2.3