aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2023-12-02 03:25:34 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2023-12-02 03:25:34 +0100
commit977e04a898e1cff122de934e6b05e32ead186e9b (patch)
tree867ee8228d037a0a3a81673c85b421b3726fec83
parentRepair format tests. (diff)
downloadcalp-formats-stash.tar.gz
calp-formats-stash.tar.xz
STASH: work on formats.formats-stash
-rw-r--r--module/vcomponent/formats/xcal.scm3
-rw-r--r--module/vcomponent/formats/xcal/parse.scm27
-rw-r--r--tests/unit/formats/run.scm8
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)