Split views into separate file

This commit is contained in:
heyarne 2021-07-10 10:30:25 +02:00
commit 1b776bd0f3
2 changed files with 20 additions and 10 deletions

17
views.janet Normal file
View file

@ -0,0 +1,17 @@
(import janet-html :as html)
(defn as-html [h]
(html/encode (html/doctype :html5) [:html h]))
(defn header [data]
[:head
[:meta {:charset "utf-8"}]
[:title (get-in data [:config :title])]])
(defn base [data body]
(as-html [(header data)
[:body body]]))
(defn with-raw-html [data raw-html]
(as-html [(header data)
[:body (html/raw raw-html)]]))