make dashboard HTML standards-compliant by adding DOCTYPE and <title> element (closes #23)

pull/27/head
Matthew Butterick 10 years ago
parent dba97e6fd1
commit 451370c7e5

@ -15,9 +15,13 @@
(provide route-dashboard route-xexpr route-default route-404 route-in route-out)
(define (body-wrapper content-xexpr)
(define (response/xexpr+doctype xexpr)
(response/xexpr #:preamble #"<!DOCTYPE html>" xexpr))
(define (body-wrapper content-xexpr #:title [title #f])
`(html
(head
(title ,(if title title "Pollen"))
(meta ([charset "UTF-8"]))
(link ([rel "stylesheet"]
[type "text/css"]
@ -49,7 +53,7 @@
(λ(req . string-args)
(logger req)
(define path (apply build-path (world:current-project-root) (flatten string-args)))
(response/xexpr (route-proc path))))
(response/xexpr+doctype (route-proc path))))
;; extract main xexpr from a path
@ -190,7 +194,7 @@
(cached-require (->path dashboard-ptree) world:main-pollen-export)
(directory->pagetree dashboard-dir))))))
(body-wrapper
(body-wrapper #:title (format "~a" dashboard-dir)
`(table
,@(cons (make-parent-row)
(if (not (null? project-paths))
@ -228,7 +232,7 @@
(request? . -> . response?)
(define error-text (format "route-404: Can't find ~a" (->string (req->path req))))
(message error-text)
(response/xexpr `(html ,error-text)))
(response/xexpr+doctype `(html ,error-text)))

Loading…
Cancel
Save