use render-current-state via code creates html with failiing images
Running this evaluates the notespace and generates html, but the plots fail with
(ns notespace.cli
(:require [notespace.actions :as actions]
[notespace.api :as api]
[gorilla-notes.core :as gn]
[notespace.kinds :as k]
)
)
(require '[notespace.v3-experiment1-test])
(defn eval-and-realize-a-notespace []
(let [anamespace (find-ns 'notespace.v3-experiment1-test)
]
(api/init)
(actions/act-on-notes! anamespace [actions/eval-note!])
(gn/render-current-state! "/tmp/out.html")
)
(System/exit 0)
)
Thre is somethinh weired going on. The above code only produces the non-working html, while started from leiningen:
lein exec -ep "(use 'notespace.cli)(eval-and-realize-a-notespace "notespace.v3-experiment1-test")"
Running the same in repl works:
(require '[notespace.actions :as actions]
'[notespace.api :as api]
'[gorilla-notes.core :as gn]
'[notespace.kinds :as k]
)
(require '[notespace.v3-experiment1-test])
(let [anamespace (find-ns 'notespace.v3-experiment1-test)
]
(api/init)
(actions/act-on-notes! anamespace [actions/eval-note!])
(gn/render-current-state! "/tmp/out.html")
)
I diffed the produced html, and it differs in size. But I could not really see anything in the diff, due to huge lines.
I think the "leiningen" run code does not interpret the kind metadata.
All notes gets rendered as native:

vs.

I have not seen this before, only the missing plots were obvious.
Interesting.
It looks like the problem with the first time is that it renders the code when it is not supposed to render. The markdown-rendered output ("text: ...") seems to appear in both cases. Right?
I don't know, my screenshot wa maybe not good... The most visible issue is this:

And there is no plot
I tried to a lot of variations of the code, with "sleeps and prints" eveywhere, and the only working workaround is to run evaluation twice:
(require '[notespace.v3-experiment1-test])
(defn eval-and-realize-a-notespace [& args]
(let [anamespace (find-ns 'notespace.v3-experiment1-test)]
(api/init)
(actions/act-on-notes! anamespace [actions/eval-note!])
(actions/act-on-notes! anamespace [actions/eval-note!])
(gn/render-current-state! "/tmp/out.html") )
(System/exit 0) )
This works reliably.
This test case is even better, as it produces 2 different html files, one bad, one good:
(let [anamespace (find-ns 'notespace.v3-experiment1-test)]
(api/init)
(actions/act-on-notes! anamespace [actions/eval-note!])
(gn/render-current-state! "/tmp/out_bad.html")
(actions/act-on-notes! anamespace [actions/eval-note!])
(gn/render-current-state! "/tmp/out_good.html")
)