File tree Expand file tree Collapse file tree 3 files changed +44
-3
lines changed Expand file tree Collapse file tree 3 files changed +44
-3
lines changed Original file line number Diff line number Diff line change
1
+ #+TITLE: Sur Moi
2
+ #+TAGS: foo bar baz
3
+
4
+ * A blog page!
5
+
6
+ Now /this/ is content!
7
+
8
+
9
+ ** A subheading
10
+
11
+ Woah
12
+
13
+ * What about formatting?
14
+
15
+ A list?
16
+
17
+ - *BOLD*
18
+ - /Italic/
19
+ - ~fixed-width~
20
+
21
+ #+BEGIN_SRC clojure
22
+ (defn hello
23
+ ([] "Greetings, nerd")
24
+ ([name] (format "Greetings %s" name)))
25
+
26
+ (hello "friend")
27
+ #+END_SRC
Original file line number Diff line number Diff line change 13
13
(stylesheet global-style)]
14
14
[:body content]])
15
15
16
+ (def-asset about-page
17
+ {:path " /about.html"
18
+ :type :html
19
+ :data (let [{title :title
20
+ content :content }
21
+ (parse-org " ./example/blog/about.org" )]
22
+ (page title content))})
23
+
16
24
(def-asset home-page
17
25
{:path " /index.html"
18
26
:type :html
19
- :data (page " Hello world" [:p " This is magic " ])})
27
+ :data (page " Hello world" [:a { :href ( asset-path about-page)} " This is a blog link. " ])})
Original file line number Diff line number Diff line change 70
70
'[garden.core
71
71
garden.stylesheet
72
72
garden.color
73
- garden.units
74
- clj-org.org])
73
+ garden.units])
75
74
76
75
(defn- ns->src-path
77
76
" Utility to take a required namespace and load a src path with it"
83
82
(str/replace " ." " /" ))
84
83
" .clj" ))
85
84
85
+ (defn parse-org [path]
86
+ " Take a path and return a map of title and content."
87
+ (-> path
88
+ (slurp )
89
+ (clj-org.org/parse-org )))
90
+
86
91
(defn eval-string
87
92
" Ealuates the provided string. Returns a list of assets defined by the file."
88
93
[s]
103
108
'user) {'def-asset def-asset
104
109
'asset-path asset-path
105
110
'stylesheet stylesheet
111
+ 'parse-org parse-org
106
112
'register-asset! #(swap! assets conj %)}}
107
113
(map (juxt identity ns-interns) included-namespaces))})
108
114
@assets))
You can’t perform that action at this time.
0 commit comments