Skip to content

Commit 8f72758

Browse files
committed
move out structure
1 parent 2e2514f commit 8f72758

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

report/src/core.clj

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
[clojure.java.io :as io]))
66

77
;; TODO: do something whenever the mode has just `.yas-parents` and nothing else?
8+
(def bulma-url "https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.4/css/bulma.css")
89

910
(defn kw-pattern
1011
[kw]
@@ -47,6 +48,7 @@
4748
(def header [:name :key :group :filename])
4849

4950
(defn table
51+
"Generate a table"
5052
[header rows]
5153
[:table.table.is-striped
5254
[:thead (into [:tr.tr]
@@ -59,23 +61,22 @@
5961
(for [h header]
6062
[:td.td (r h)]))))])
6163

62-
[:link {:rel "stylesheet"
63-
:href "https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.4/css/bulma.css"
64-
:crossorigin "anonymous"}]
64+
(defn structure
65+
[body]
66+
[:html
67+
[:head
68+
[:link {:rel "stylesheet"
69+
:href bulma-url
70+
:crossorigin "anonymous"}]]
71+
[:body body]])
6572

6673
(defn gen-html
6774
[snips-dir]
6875
(let [all-modes (parse-everything snips-dir)
69-
tables (for [[m snips] all-modes]
70-
[:html
71-
[:head
72-
[:link {:rel "stylesheet"
73-
:href "https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.4/css/bulma.css"
74-
:crossorigin "anonymous"}]]
75-
[:body
76-
[:div.hero
77-
[:h2 m]
78-
(table header snips)]]])]
76+
tables (for [[m snips] (take 10 (sort all-modes))]
77+
[:div
78+
[:h2 m]
79+
(table header snips)])]
7980
(spit
8081
"hello.html"
8182
(hiccup/html tables))))

0 commit comments

Comments
 (0)