diff --git a/deps.edn b/deps.edn index 07c869294..62cc0659e 100644 --- a/deps.edn +++ b/deps.edn @@ -43,14 +43,8 @@ :build {:deps {io.github.clojure/tools.build {:git/tag "v0.6.1" :git/sha "515b334"} io.github.slipset/deps-deploy {:git/sha "b4359c5d67ca002d9ed0c4b41b710d7e5a82e3bf"} - io.github.nextjournal/cas {:git/url "https://github.com/nextjournal/cas" + io.github.nextjournal/cas {:git/url "git@github.com:nextjournal/cas" :git/sha "5e8079b720e347b9466db9c2282ce79a125a011c"} rewrite-clj/rewrite-clj {:mvn/version "1.0.699-alpha"} babashka/fs {:mvn/version "0.0.5"}} - :ns-default build} - - :test {:extra-paths ["test"] - :extra-deps {io.github.cognitect-labs/test-runner - {:git/tag "v0.5.0" :git/sha "b3fd0d2"}} - :main-opts ["-m" "cognitect.test-runner"] - :exec-fn cognitect.test-runner.api/test}}} + :ns-default build}}} diff --git a/src/nextjournal/clerk.clj b/src/nextjournal/clerk.clj index 87c82fda8..3564e7e1a 100644 --- a/src/nextjournal/clerk.clj +++ b/src/nextjournal/clerk.clj @@ -176,17 +176,20 @@ (throw e)))) (defn supported-file? - "Returns whether PATH points to a file that can be visualized." + "Returns whether `path` points to a file that should be shown." [path] - - ;; Notes - ;; - ;; 1. file names starting with .# are most likely Emacs lock files - ;; and should be ignored. + ;; file names starting with .# are most likely Emacs lock files and should be ignored. (->> path io/file .getName (re-matches #"(?!^\.#).+\.(md|clj|cljc)$") some?)) +#_(supported-file? "foo_bar.clj") +#_(supported-file? "xyz/foo.md") +#_(supported-file? "xyz/foo.clj") +#_(supported-file? "xyz/abc.#name.cljc") +#_(supported-file? ".#name.clj") +#_(supported-file? "xyz/.#name.cljc") + (defn file-event [{:keys [type path]}] (when (and (contains? #{:modify :create} type) (supported-file? path)) diff --git a/test/nextjournal/clerk_test.clj b/test/nextjournal/clerk_test.clj deleted file mode 100644 index 9cbc7d16a..000000000 --- a/test/nextjournal/clerk_test.clj +++ /dev/null @@ -1,13 +0,0 @@ -(ns nextjournal.clerk-test - (:require [nextjournal.clerk :as c] - [clojure.test :as t])) - -(t/deftest supported-filenames - (t/is (= true (c/supported-file? "xyz/name.md"))) - (t/is (= true (c/supported-file? "xyz/name.clj"))) - (t/is (= true (c/supported-file? "name.clj"))) - (t/is (= true (c/supported-file? "xyz/name.cljc"))) - (t/is (= false (c/supported-file? "xyz/name.any"))) - (t/is (= false (c/supported-file? "xyz/.#name.cljc"))) - (t/is (= true (c/supported-file? "xyz/abc.#name.cljc"))) - )