From 30aec7ca6fefa5a2406e414280ed5051bc6d5d82 Mon Sep 17 00:00:00 2001 From: Nicolas Buduroi Date: Wed, 19 Jan 2011 15:21:50 -0500 Subject: [PATCH] Fixed small bug in parser when a namespace don't have a docstring and also made it possible to parse inexistent namespaces. --- src/marginalia/parser.clj | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/marginalia/parser.clj b/src/marginalia/parser.clj index b234de7..f5afc3d 100644 --- a/src/marginalia/parser.clj +++ b/src/marginalia/parser.clj @@ -86,7 +86,9 @@ (defn- extract-common-docstring [form raw nspace-sym] (let [sym (second form) - _ (if (= 'ns (first form)) (require sym)) + _ (if (= 'ns (first form)) + (try (require sym) + (catch Exception _))) nspace (find-ns sym)] (let [docstring (if nspace (-> nspace meta :doc) @@ -98,7 +100,7 @@ (defmethod dispatch-form 'ns [form raw nspace-sym] (let [[ds r s] (extract-common-docstring form raw nspace-sym)] - (let [ds (nth form 2) + (let [ds (when (> (count form) 2) (nth form 2)) ds (when (string? ds) ds)] [ds (strip-docstring ds r)