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/search.scm') 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/search.scm') 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 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/search.scm') 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