(defn with-template
[handler]
(fn [request]
(if-let [response (handler request)]
(create-response
request
(template :html request response)))))
(defmethod template :html
[format request response]
[(content-type "text/html")
{:body
(html
(doctype :xhtml-strict)
[:html
[:head
[:title (:title response)]
(apply include-js (concat (list "/js/jquery-1.3.2.min.js")
(:scripts response)
))
[:link {:href "/css/main.css"
:rel "stylesheet"
:type "text/css"}]
(map (fn [link-info]
[:link link-info])
(:links response))]
[:body
[:div#header
[:object {:type "image/svg+xml"
:data "/images/mycyclopedia.svg"
:width "480"
:height "85"} "Mycyclopedia"]
[:div
(navigation)
(login-form request response)]
(if-let [flash (-> request :flash :message)]
[:p#flash flash])]
[:div#content (:body response)]]])}])