Skip to content

Commit 1eeefa2

Browse files
committed
inline unixify
1 parent ccf94a6 commit 1eeefa2

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

src/nextjournal/clerk/analyzer.clj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@
408408

409409
(defn normalize-filename [f]
410410
(if (fs/windows?)
411-
(-> f fs/normalize fs/unixify)
411+
(-> f fs/normalize utils/unixify)
412412
f))
413413

414414
(defn ns->jar [ns]
@@ -456,7 +456,7 @@
456456
"jar" (first (str/split (.getPath resource) #"!"))
457457
"file" (str resource))]
458458
(-> resource-file java.net.URI. io/file str))))
459-
fs/unixify)))
459+
utils/unixify)))
460460

461461
#_(var->location #'inc)
462462
#_(var->location #'var->location)
@@ -550,7 +550,7 @@
550550
(let [jar? (or (nil? source)
551551
(str/ends-with? source ".jar"))
552552
gitlib-hash (and (not jar?)
553-
(second (re-find #".gitlibs/libs/.*/(\b[0-9a-f]{5,40}\b)/" (fs/unixify source))))]
553+
(second (re-find #".gitlibs/libs/.*/(\b[0-9a-f]{5,40}\b)/" (utils/unixify source))))]
554554
(if (or jar? gitlib-hash)
555555
(update g :->analysis-info merge (into {} (map (juxt identity
556556
(constantly (if source

src/nextjournal/clerk/paths.clj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"Clerk's paths expansion and paths-fn handling."
33
(:require [babashka.fs :as fs]
44
[clojure.edn :as edn]
5-
[clojure.string :as str])
5+
[clojure.string :as str]
6+
[nextjournal.clerk.utils :as utils])
67
(:import [java.net URL]))
78

89
(defn ^:private ensure-not-empty [build-opts {:as opts :keys [error expanded-paths]}]
@@ -130,7 +131,7 @@
130131
(fs/exists? file))
131132
(let [rel (fs/relativize (fs/cwd) (fs/canonicalize file #{:nofollow-links}))]
132133
(when-not (str/starts-with? (str rel) "..")
133-
(fs/unixify rel)))))
134+
(utils/unixify rel)))))
134135

135136
#_(path-in-cwd "notebooks/rule_30.clj")
136137
#_(path-in-cwd "/tmp/foo.clj")

src/nextjournal/clerk/utils.clj

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
(ns nextjournal.clerk.utils
2-
(:require [alphabase.base58 :as base58]))
2+
(:require [alphabase.base58 :as base58]
3+
[clojure.string :as str]))
34

45
(def bb? (System/getProperty "babashka.version"))
56

@@ -23,3 +24,6 @@
2324

2425
(defn ->base58 [x]
2526
(base58/encode x))
27+
28+
(defn unixify [x]
29+
(str/replace (str x) "\\" "/"))

0 commit comments

Comments
 (0)