From bc0ee663a7fb3df71cf1547455d9eb93007b4459 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Mon, 30 Mar 2020 00:53:24 +0200 Subject: Fixed minor errors in HTML output. --- config.scm | 7 ++++++- module/output/html.scm | 33 +++++++++++++++++++-------------- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/config.scm b/config.scm index c4ea29e8..9b56b471 100644 --- a/config.scm +++ b/config.scm @@ -36,7 +36,12 @@ (define (a link) `(a (@ (href ,link)) ,link)) (define (parse-html str) - (xml->sxml (string-append "
" str "
") + ;; extra space to ensure that we don't get a self closing + ;; div tag in the final output + ;; TODO Fix a real sxml->html | The space + ;; method instead of pretending | + ;; that HTML is XML. v + (xml->sxml (string-append "
" str "
") default-entity-handler: (lambda (port name) (case name diff --git a/module/output/html.scm b/module/output/html.scm index 6e64d176..454f9dc4 100644 --- a/module/output/html.scm +++ b/module/output/html.scm @@ -416,19 +416,24 @@ `(td (@ (class ,(when (date< date start-date) "prev ") ,(when (date< end-date date) "next "))) - (a (@ (href ,(cond [(date< date start-date) - ;; TODO find a prettier way to generate links to previous and next time intervals - ;; TODO also, it would do good with a bit of testing for off-by-one errors - (date->string - (stream-find (lambda (d) (date<= d date (next-start d))) - (stream-iterate prev-start start-date)) - "~Y-~m-~d.html")] - [(date< end-date date) - (date->string - (stream-find (lambda (d) (and (date<= d date) - (date< date (next-start d)))) - (stream-iterate next-start start-date)) - "~Y-~m-~d.html" )]) + (a (@ (href ,(cond + ;; We are before our time interval + [(date< date start-date) + ;; TODO find a prettier way to generate links to previous and next time intervals + ;; TODO also, it would do good with a bit of testing for off-by-one errors + (date->string + (stream-find (lambda (d) (date<= d date (next-start d))) + (stream-iterate prev-start start-date)) + "~Y-~m-~d.html")] + ;; We are after our time interval + [(date< end-date date) + (date->string + (stream-find (lambda (d) (and (date<= d date) + (date< date (next-start d)))) + (stream-iterate next-start start-date)) + "~Y-~m-~d.html" )] + ;; We are in our time interval + [else ""]) "#" ,(date->string date "~Y-~m-~d")) (class "hidelink")) ,(day date)))) @@ -489,7 +494,7 @@ (head (title "Calendar") (meta (@ (charset "utf-8"))) - (meta (@ (http-equiv "Content-Type") (content "application/xhtml+xml"))) + ;; (meta (@ (http-equiv "Content-Type") (content "application/xhtml+xml"))) (meta (@ (name viewport) (content "width=device-width, initial-scale=0.5"))) (meta (@ (name description) -- cgit v1.2.3