Add support for cljx reader tags #+clj and #+cljs to make it possible to generate marginalia docs in projects using cljx to target Clojure and ClojureScript.
This commit is contained in:
parent
a21cd992c4
commit
0e43f515a9
1 changed files with 10 additions and 3 deletions
|
@ -391,10 +391,17 @@
|
||||||
(defn cljs-file? [filepath]
|
(defn cljs-file? [filepath]
|
||||||
(.endsWith (lower-case filepath) "cljs"))
|
(.endsWith (lower-case filepath) "cljs"))
|
||||||
|
|
||||||
|
(defn cljx-file? [filepath]
|
||||||
|
(.endsWith (lower-case filepath) "cljx"))
|
||||||
|
|
||||||
|
(def cljx-data-readers {'+clj identity
|
||||||
|
'+cljs identity})
|
||||||
|
|
||||||
(defn parse-file [file]
|
(defn parse-file [file]
|
||||||
(let [readers (if (cljs-file? file)
|
(let [readers (merge {}
|
||||||
(->> default-data-readers (merge *cljs-data-readers*))
|
(when (cljs-file? file) *cljs-data-readers*)
|
||||||
default-data-readers)]
|
(when (cljx-file? file) cljx-data-readers)
|
||||||
|
default-data-readers)]
|
||||||
(binding [*data-readers* readers
|
(binding [*data-readers* readers
|
||||||
*comments-enabled* (atom true)]
|
*comments-enabled* (atom true)]
|
||||||
(parse (slurp file)))))
|
(parse (slurp file)))))
|
||||||
|
|
Loading…
Reference in a new issue