From 3c6fa840252fd5eddadca6e5587cd8f8fa8dbb56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20K=C3=BCng?= Date: Thu, 12 Sep 2024 08:27:22 +0200 Subject: [PATCH] Don't parse a Python file if introduced via libpython-clj and instead return nil. This change fixes https://github.com/philippkueng/clerk-issue-531 and most likely will address https://github.com/nextjournal/clerk/issues/531 too. --- src/nextjournal/clerk/parser.cljc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/nextjournal/clerk/parser.cljc b/src/nextjournal/clerk/parser.cljc index a73056164..89b2b46a3 100644 --- a/src/nextjournal/clerk/parser.cljc +++ b/src/nextjournal/clerk/parser.cljc @@ -403,9 +403,10 @@ #?(:clj (defn parse-file ([file] (parse-file {} file)) - ([opts file] (-> (if (str/ends-with? file ".md") - (parse-markdown-string opts (slurp file)) - (parse-clojure-string opts (slurp file))) + ([opts file] (-> (cond + (str/ends-with? file ".md") (parse-markdown-string opts (slurp file)) + (str/ends-with? file ".py") nil + :else (parse-clojure-string opts (slurp file))) (assoc :file file))))) #_(parse-file {:doc? true} "notebooks/visibility.clj")