arnes.space-bagatto/index.janet

32 lines
884 B
Janet

(import janet-html :as html)
(import spork/netrepl)
(import ./views)
# ---
# expose the a netrepl for conjure to connect to when running in repl mode
# ---
(defn bag-repl? [cli-args]
(= ["bag" "--repl"] (slice cli-args 0 2)))
(def conjure-repl
(when (bag-repl? (dyn :args))
(thread/new (fn [_] (netrepl/server)))))
# ---
# site config
# ---
(bagatto/set-output-dir! "site")
(def data {:config {:attrs {:title "arnes.space"}}
:posts {:src (bagatto/slurp-* "posts/*.md")
:attrs bagatto/parse-mmarkdown}})
(def site {:index {:dest "index.html"
:out (views/base data [:h1 "Hello World!"])}
:posts {:each :posts
:dest (bagatto/%p "posts" '%i "title" '% ".html")
:out (fn [data item]
(views/base data (bagatto/mmarkdown->html (item :contents)) true))}})