Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@
http-kit {:mvn/version "2.3.0"}
compojure {:mvn/version "1.6.1"}
watchtower {:mvn/version "0.1.1"}
clj-org/clj-org {:mvn/version "0.0.2"}
com.taoensso/timbre {:mvn/version "4.10.0"}}}
27 changes: 27 additions & 0 deletions example/blog/about.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#+TITLE: Sur Moi
#+TAGS: foo bar baz

* A blog page!

Now /this/ is content!


** A subheading

Woah

* What about formatting?

A list?

- *BOLD*
- /Italic/
- ~fixed-width~

#+BEGIN_SRC clojure
(defn hello
([] "Greetings, nerd")
([name] (format "Greetings %s" name)))

(hello "friend")
#+END_SRC
10 changes: 9 additions & 1 deletion example/site.clj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,15 @@
(stylesheet global-style)]
[:body content]])

(def-asset about-page
{:path "/about.html"
:type :html
:data (let [{title :title
content :content}
(parse-org "./example/blog/about.org")]
(page title content))})

(def-asset home-page
{:path "/index.html"
:type :html
:data (page "Hello world" [:p "This is magic"])})
:data (page "Hello world" [:a {:href (asset-path about-page)} "This is a blog link."])})
8 changes: 8 additions & 0 deletions src/teknql/statik/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
[garden.color]
[garden.stylesheet]
[garden.units]
[clj-org.org]
[clojure.string :as str])
(:refer-clojure :exclude [compile]))

Expand Down Expand Up @@ -81,6 +82,12 @@
(str/replace "." "/"))
".clj"))

(defn parse-org [path]
"Take a path and return a map of title and content."
(-> path
(slurp)
(clj-org.org/parse-org)))

(defn eval-string
"Ealuates the provided string. Returns a list of assets defined by the file."
[s]
Expand All @@ -101,6 +108,7 @@
'user) {'def-asset def-asset
'asset-path asset-path
'stylesheet stylesheet
'parse-org parse-org
'register-asset! #(swap! assets conj %)}}
(map (juxt identity ns-interns) included-namespaces))})
@assets))