From 3d2c2ba29c7fa6854e3734ce3d8635a37b6ecc2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Mon, 10 Aug 2020 16:06:33 +0200 Subject: Start breaking apart HTML modules. --- module/output/html-search.scm | 59 +++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 30 deletions(-) (limited to 'module/output/html-search.scm') diff --git a/module/output/html-search.scm b/module/output/html-search.scm index a6a80cd4..f6b74a77 100644 --- a/module/output/html-search.scm +++ b/module/output/html-search.scm @@ -3,36 +3,35 @@ :use-module (util) :use-module (vcomponent) :use-module (vcomponent search) - :use-module (ice-9 format) + :use-module ((ice-9 pretty-print) :select (pretty-print)) + :use-module (html components) ) -(define-public (search-result-page search-term search-result page paginator q=) - `(*TOP* - (*PI* xml "version=\"1.0\" encoding=\"utf-8\"") - (html (@ (xmlns "http://www.w3.org/1999/xhtml") (lang sv)) - (head (title "Search results") - ;; TODO (@ (output html) include-css) - (link (@ (type "text/css") - (rel "stylesheet") - (href "/static/style.css")))) - (body - (h2 "Search term") - (form - (pre (textarea (@ (name "q") (rows 5) (spellcheck false) - (style "width:100%")) - ,(format #f "~y" search-term))) - (input (@ (type submit)))) - (h2 "Result (page " ,page ")") - (ul - ,@(for event in search-result - `(li (@ (class "event")) - ,(prop event 'SUMMARY)))) - (div (@ (class "paginator")) - ,@(paginator->list - paginator - (lambda (p) (if (= p page) - `(span ,p) - `(a (@ (href "?" ,q= "&p=" ,p)) ,p))) - (lambda (p) `(a (@ (href "?" ,q= "&p=" ,p)) "»")))) - )))) +(define-public (search-result-page + search-term search-result page paginator q=) + (xhtml-doc + (@ (lang sv)) + (head (title "Search results") + ,(include-css "/static/style.css")) + (body + (h2 "Search term") + (form + (pre (textarea (@ (name "q") (rows 5) (spellcheck false) + (style "width:100%")) + ,(with-output-to-string + (lambda () (pretty-print search-term))))) + (input (@ (type submit)))) + (h2 "Result (page " ,page ")") + (ul + ,@(for event in search-result + `(li (@ (class "event")) + ,(prop event 'SUMMARY)))) + (div (@ (class "paginator")) + ,@(paginator->list + paginator + (lambda (p) (if (= p page) + `(span ,p) + `(a (@ (href "?" ,q= "&p=" ,p)) ,p))) + (lambda (p) `(a (@ (href "?" ,q= "&p=" ,p)) "»")))) + ))) -- cgit v1.2.3