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:
88
99## Unreleased
1010
11+ * 🐞 Fix navigation path and reload when serving notebook over http
12+
1113* 🌟 Add compatibility with Babashka
1214
1315 Requires Babashka 1.12.204 or newer.
Original file line number Diff line number Diff line change 242242 (or (symbol? file-or-ns) (instance? clojure.lang.Namespace file-or-ns))
243243 (str " '" file-or-ns)
244244
245+ (and (string? file-or-ns) (re-matches #"^http?s://.*" file-or-ns))
246+ (str " /" file-or-ns)
247+
245248 (string? file-or-ns)
246249 (paths/drop-extension (or (paths/path-in-cwd file-or-ns) file-or-ns))))
247250
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-
253251(defn find-first-existing-file [files]
254252 (first (filter fs/exists? files)))
255253
323321 file-or-ns)
324322 (catch ^:sci/error Exception e
325323 (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 )))
330328 {:status 200
331329 :headers {" Content-Type" " text/html" " Cache-Control" " no-store" }
332330 :body (view/->html {:doc (view/doc->viewer @!doc)
Original file line number Diff line number Diff line change 1212 (is (= 'nextjournal.clerk.tap (webserver/->file-or-ns " 'nextjournal.clerk.tap" )))
1313 (is (= " notebooks/rule_30.clj" (webserver/->file-or-ns " notebooks/rule_30.clj" ))))
1414
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+
1524(deftest serve-blob
1625 (utils/when-not-bb
1726 (testing " lazy loading of simple range"
You can’t perform that action at this time.
0 commit comments