File tree Expand file tree Collapse file tree 3 files changed +18
-9
lines changed Expand file tree Collapse file tree 3 files changed +18
-9
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,8 @@ Changes can be:
8
8
9
9
## Unreleased
10
10
11
+ * 🐞 Fix navigation path and reload when serving notebook over http
12
+
11
13
* 🌟 Add compatibility with Babashka
12
14
13
15
Requires Babashka 1.12.204 or newer.
Original file line number Diff line number Diff line change 242
242
(or (symbol? file-or-ns) (instance? clojure.lang.Namespace file-or-ns))
243
243
(str " '" file-or-ns)
244
244
245
+ (and (string? file-or-ns) (re-matches #"^http?s://.*" file-or-ns))
246
+ (str " /" file-or-ns)
247
+
245
248
(string? file-or-ns)
246
249
(paths/drop-extension (or (paths/path-in-cwd file-or-ns) file-or-ns))))
247
250
248
- #_(->nav-path (str (fs/file (fs/cwd ) " notebooks/rule_30.clj" )))
249
- #_(->nav-path 'nextjournal.clerk.index)
250
- #_(->nav-path " notebooks/rule_30.clj" )
251
- #_(->nav-path 'nextjournal.clerk.home)
252
-
253
251
(defn find-first-existing-file [files]
254
252
(first (filter fs/exists? files)))
255
253
323
321
file-or-ns)
324
322
(catch ^:sci/error Exception e
325
323
(u/if-bb
326
- (binding [*out* *err*]
327
- (println
328
- (str/join " \n " (sci.core/format-stacktrace (sci.core/stacktrace e)))))
329
- nil )))
324
+ (binding [*out* *err*]
325
+ (println
326
+ (str/join " \n " (sci.core/format-stacktrace (sci.core/stacktrace e)))))
327
+ nil )))
330
328
{:status 200
331
329
:headers {" Content-Type" " text/html" " Cache-Control" " no-store" }
332
330
:body (view/->html {:doc (view/doc->viewer @!doc)
Original file line number Diff line number Diff line change 12
12
(is (= 'nextjournal.clerk.tap (webserver/->file-or-ns " 'nextjournal.clerk.tap" )))
13
13
(is (= " notebooks/rule_30.clj" (webserver/->file-or-ns " notebooks/rule_30.clj" ))))
14
14
15
+ (deftest ->nav-path-test
16
+ (is (= " notebooks/rule_30"
17
+ #_(webserver/->nav-path (str (fs/file (fs/cwd ) " notebooks/rule_30.clj" ))) ; ; failing on windows
18
+ (webserver/->nav-path " notebooks/rule_30.clj" )))
19
+ (is (= " 'nextjournal.clerk.home"
20
+ (webserver/->nav-path 'nextjournal.clerk.home)))
21
+ (is (= " /https://raw.githubusercontent.com/nextjournal/clerk-demo/main/notebooks/rule_30.clj"
22
+ (webserver/->nav-path " https://raw.githubusercontent.com/nextjournal/clerk-demo/main/notebooks/rule_30.clj" ))))
23
+
15
24
(deftest serve-blob
16
25
(utils/when-not-bb
17
26
(testing " lazy loading of simple range"
You can’t perform that action at this time.
0 commit comments