-
Notifications
You must be signed in to change notification settings - Fork 1
/
page.clj
67 lines (54 loc) · 1.9 KB
/
page.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
(ns basic.page
(:require [scicloj.kindly-advice.v1.api :as kindly-advice]
[scicloj.kindly-render.notes.to-html-page :as to-html-page]
[scicloj.kindly-render.notes.to-markdown-page :as to-markdown-page]
[scicloj.kindly.v4.kind :as kind]))
(def chart
(kind/echarts {:title {:text "Echarts Example"}
:tooltip {}
:legend {:data ["sales"]}
:xAxis {:data ["Shirts", "Cardigans", "Chiffons",
"Pants", "Heels", "Socks"]}
:yAxis {}
:series [{:name "sales"
:type "bar"
:data [5 20 36
10 10 20]}]}))
(def hiccup-list
(kind/hiccup
[:div {:style {:background "#efe9e6"
:border-style :solid}}
[:ul
[:li "one"]
[:li "two"]
[:li "three"]]]))
(def portal
(kind/portal {:foo "bar"}))
(def notebook
{:notes [
;; kind-portal is not loaded, so this should render a short
;; message explaining its absence
{:value portal}
;; single kind
{:value hiccup-list}
;; basic hiccup
{:value (kind/hiccup [:div {} chart chart])}
;; nested hiccup
{:value (kind/hiccup [:div {}
[:div chart chart]])}
;; nested vector inside hiccup
{:value (kind/hiccup [:div {}
[chart chart]])}
;; What happens to markdown?
{:value (kind/md "Hello, this is some text")}
]})
(defn -main [& args]
(->> (to-markdown-page/render-notebook notebook)
(spit "basic.md"))
(->> (to-html-page/render-notebook notebook)
(spit "basic.html")))
(comment
(-main))
;; TODO:
;; 1. Does it work for Clay?
;; 2. Does it work from ClojureScript?