From 6e240ba91752990c6cb087e576432ce9b6a8ad44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Mon, 5 Oct 2020 02:17:09 +0200 Subject: Simplify /insert endpoint. --- module/vcomponent/base.scm | 8 -------- 1 file changed, 8 deletions(-) (limited to 'module/vcomponent') diff --git a/module/vcomponent/base.scm b/module/vcomponent/base.scm index ae10fe01..34d4416b 100644 --- a/module/vcomponent/base.scm +++ b/module/vcomponent/base.scm @@ -169,14 +169,6 @@ (copy-vline value)))) (get-component-properties component))))) -;; updates target with all fields from source. -;; fields in target but not in source left unchanged. -;; parent and children unchanged -(define-public (vcomponent-update! target source) - (for key in (property-keys source) - (set! (prop* target key) - (prop* source key)))) - (define-public (extract field) (lambda (e) (prop e field))) -- cgit v1.2.3 From 99120bc1b7920261e1020d501de139c71a381492 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Thu, 15 Oct 2020 00:12:20 +0200 Subject: Datetime bindings for search. --- module/vcomponent/search.scm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'module/vcomponent') diff --git a/module/vcomponent/search.scm b/module/vcomponent/search.scm index 7d039a24..fef0b100 100644 --- a/module/vcomponent/search.scm +++ b/module/vcomponent/search.scm @@ -52,6 +52,13 @@ (define-public (prepare-string str) (call-with-input-string (close-parenthese str) read)) +;; TODO place this in a proper module +(define (bindings-for module-name) + ;; Wrapping list so we can later export sub-modules. + (list (cons module-name + (module-map (lambda (a . _) a) + (resolve-interface module-name))))) + ;; Evaluates the given expression in a sandbox. ;; NOTE Should maybe be merged inte prepare-query. The argument against is that ;; eval-in-sandbox is possibly slow, and that would prevent easy caching by the @@ -65,7 +72,7 @@ `( ((vcomponent base) prop param children type) ((ice-9 regex) string-match) - ;; TODO datetime + ,@(bindings-for '(datetime)) ,@all-pure-bindings) ))) -- cgit v1.2.3 From 8cced0532ab69a2346654540a4d01bc64392c359 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Thu, 15 Oct 2020 00:30:15 +0200 Subject: Fix error propagation for some search queries. --- module/vcomponent/search.scm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'module/vcomponent') diff --git a/module/vcomponent/search.scm b/module/vcomponent/search.scm index fef0b100..27483720 100644 --- a/module/vcomponent/search.scm +++ b/module/vcomponent/search.scm @@ -162,8 +162,11 @@ (set-max-page! paginator (max page (get-max-page paginator))) result)))) (lambda (err proc fmt args data) - ;; TODO ensure the error actually is index out of range. - ;; (format (current-error-port) "~?~%" fmt args) + ;; NOTE This is mostly a hack to see that we + ;; actually check for the correct error. + (unless (string=? fmt "beyond end of stream") + (scm-error err proc fmt args data)) + (set-max-page! paginator (get-max-page paginator)) (set-true-max-page! paginator) (throw 'max-page (get-max-page paginator)) -- cgit v1.2.3 From 5986d8022fe2a58df6bc7054ef9499961fb776b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Fri, 16 Oct 2020 21:42:41 +0200 Subject: HTML add toggle for whole-day. --- module/vcomponent/xcal/parse.scm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'module/vcomponent') diff --git a/module/vcomponent/xcal/parse.scm b/module/vcomponent/xcal/parse.scm index 17c684fc..c97bc492 100644 --- a/module/vcomponent/xcal/parse.scm +++ b/module/vcomponent/xcal/parse.scm @@ -25,7 +25,10 @@ ;; TODO possibly trim whitespace on text fields [(cal-address uri text unknown) (car value)] - [(date) (parse-iso-date (car value))] + [(date) + ;; TODO this is correct, but ensure remaining types + (hashq-set! props 'VALUE "DATE") + (parse-iso-date (car value))] [(date-time) (parse-iso-datetime (car value))] @@ -108,6 +111,12 @@ data '(AUDIO DISPLAY EMAIL NONE))) [else data])) +;; Note +;; This doesn't verify the inter-field validity of the object, +;; meaning that value(DTSTART) == DATE and value(DTEND) == DATE-TIME +;; are possibilities, which other parts of the code will crash on. +;; TODO +;; since we are feeding user input into this it really should be fixed. (define-public (sxcal->vcomponent sxcal) (define type (symbol-upcase (car sxcal))) (define component (make-vcomponent type)) -- cgit v1.2.3 From 2ee958354c18d91a8bd44028042bb4a4a10c423a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Mon, 26 Oct 2020 20:30:22 +0100 Subject: HTML Prettyify code for following tags. --- module/vcomponent/search.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/vcomponent') diff --git a/module/vcomponent/search.scm b/module/vcomponent/search.scm index 27483720..39a3847a 100644 --- a/module/vcomponent/search.scm +++ b/module/vcomponent/search.scm @@ -70,7 +70,7 @@ (eval `(lambda (event) ,@expressions) (make-sandbox-module `( - ((vcomponent base) prop param children type) + ((vcomponent base) prop param children type parent) ((ice-9 regex) string-match) ,@(bindings-for '(datetime)) ,@all-pure-bindings) -- cgit v1.2.3 From 7a82321d5b3dcceab12d62aa9c78e3618cff4f94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Thu, 5 Nov 2020 23:25:43 +0100 Subject: Change recovery on unexpected ',' in TEXT field. --- module/vcomponent/ical/parse.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/vcomponent') diff --git a/module/vcomponent/ical/parse.scm b/module/vcomponent/ical/parse.scm index 9c555bca..8499d289 100644 --- a/module/vcomponent/ical/parse.scm +++ b/module/vcomponent/ical/parse.scm @@ -135,7 +135,7 @@ (let ((v ((get-parser 'TEXT) params value))) (unless (= 1 (length v)) (warning "List in non-list field: ~s" v)) - (car v)))] + (string-join v ",")))] ;; TEXT, but allow a list [(memv key '(CATEGORIES RESOURCES)) -- cgit v1.2.3 From bded975370dc24734af8e820aca416162de7a92c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Thu, 5 Nov 2020 23:35:36 +0100 Subject: CATEGORIES (and RESOURCES) join list ical on output. --- module/vcomponent/ical/output.scm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'module/vcomponent') diff --git a/module/vcomponent/ical/output.scm b/module/vcomponent/ical/output.scm index a0816679..bcc6bb1d 100644 --- a/module/vcomponent/ical/output.scm +++ b/module/vcomponent/ical/output.scm @@ -44,12 +44,16 @@ [(memv key '(FREEBUSY)) (get-writer 'PERIOD)] + [(memv key '(CATEGORIES RESOURCES)) + (lambda (p v) + (string-join (map (lambda (v) ((get-writer 'TEXT) p v)) + v) + ","))] + [(memv key '(CALSCALE METHOD PRODID COMMENT DESCRIPTION LOCATION SUMMARY TZID TZNAME CONTACT RELATED-TO UID - CATEGORIES RESOURCES - VERSION)) (get-writer 'TEXT)] -- cgit v1.2.3 From e469bf6c2b219f7acd08e93adf7e0244b6b3c2c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Thu, 5 Nov 2020 23:43:35 +0100 Subject: Xcal input split CATEGORIES. --- module/vcomponent/xcal/parse.scm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'module/vcomponent') diff --git a/module/vcomponent/xcal/parse.scm b/module/vcomponent/xcal/parse.scm index c97bc492..6b877b9f 100644 --- a/module/vcomponent/xcal/parse.scm +++ b/module/vcomponent/xcal/parse.scm @@ -156,7 +156,11 @@ (set! (prop* component tag*) (make-vline tag* (handle-tag - tag (handle-value type params value)) + tag (let ((v (handle-value type params value))) + ;; TODO possibly more list fields + (if (eq? tag 'categories) + (string-split v #\,) + v))) params)))))]))) ;; children -- cgit v1.2.3