From e512fec93cef4a49c6cb0e40bf5afc148d4f9281 Mon Sep 17 00:00:00 2001 From: fogus Date: Tue, 18 Nov 2014 13:18:17 -0500 Subject: [PATCH] The filename itself can standin for the namespace when its has none (e.g. project.clj and data_readers.clj) --- src/marginalia/core.clj | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/marginalia/core.clj b/src/marginalia/core.clj index b1164c2..d5a75ef 100644 --- a/src/marginalia/core.clj +++ b/src/marginalia/core.clj @@ -170,10 +170,12 @@ :else (recur (merge-line (first lines) cur-group) groups (rest lines))))) (defn path-to-doc [fn] - (let [ns (-> (java.io.File. fn) + (let [file (java.io.File. fn) + ns (-> file (read-file-ns-decl) (second) (str)) + ns (if (or (nil? ns) (empty? ns)) (.getName file) ns) groups (parse-file fn)] {:ns ns :groups groups})) @@ -264,10 +266,6 @@ ["-l" "--leiningen" "Generate the documentation for a Leiningen project file." :default "./project.clj"]) sources (distinct (format-sources (seq files))) sources (if leiningen (cons leiningen sources) sources)] - (println "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<") - (println leiningen) - (println sources) - (println "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<") (if-not sources (do (println "Wrong number of arguments passed to Marginalia.")