Liking cljdoc? Tell your friends :D

hydrox.doc.parse


*indentation*clj

source

*namespace*clj

source

*spacing*clj

source

append-codeclj

(append-code current new)
source

code-formclj

(code-form zloc symbol)

converts a form zipper into a code string

(-> (z/of-string "(fact (+ 1 1) \n => 2)") (code-form 'fact)) => "(+ 1 1) \n => 2"

converts a form zipper into a code string

(-> (z/of-string "(fact (+ 1 1) \n => 2)")
    (code-form 'fact))
=> "(+ 1 1) \n  => 2"
sourceraw docstring

is-code-formclj

(is-code-form zloc)
source

merge-currentclj

(merge-current output current)
source

parse-attributeclj

(parse-attribute zloc)

coverts an attribute zipper into an element (-> (z/of-string "[[{:title "hello world"}]]") (parse-attribute)) => {:type :attribute, :title "hello world"}

coverts an attribute zipper into an element
(-> (z/of-string "[[{:title \"hello world\"}]]")
    (parse-attribute))
=> {:type :attribute, :title "hello world"}
sourceraw docstring

parse-codeclj

(parse-code zloc)

coverts a code zipper into an element (-> (z/of-string "(+ 1 1) (+ 2 2)") (parse-code)) => {:type :code, :indentation 0, :code ["(+ 1 1)"]}

coverts a code zipper into an element
(-> (z/of-string "(+ 1 1) (+ 2 2)")
    (parse-code))
=> {:type :code, :indentation 0, :code ["(+ 1 1)"]}
sourceraw docstring

parse-code-directiveclj

(parse-code-directive zloc)

coverts an code directive zipper into an element (-> (z/of-string "[[:code {:language :ruby} "1 + 1 == 2"]]") (parse-code-directive)) => {:type :block, :indentation 0 :code "1 + 1 == 2" :language :ruby}

coverts an code directive zipper into an element
(-> (z/of-string "[[:code {:language :ruby} \"1 + 1 == 2\"]]")
    (parse-code-directive))
=> {:type :block, :indentation 0 :code "1 + 1 == 2" :language :ruby}
sourceraw docstring

parse-comment-formclj

(parse-comment-form zloc)

convert a comment zipper into an element

(-> (z/of-string "(comment (+ 1 1) \n => 2)") (parse-comment-form)) => {:type :block :indentation 2 :code "(+ 1 1) \n => 2"}

convert a comment zipper into an element

(-> (z/of-string "(comment (+ 1 1) \n => 2)")
    (parse-comment-form))
=> {:type :block :indentation 2 :code "(+ 1 1) \n => 2"}
sourceraw docstring

parse-deftest-formclj

(parse-deftest-form zloc)
source

parse-directiveclj

(parse-directive zloc)

converts a directive zipper into an element (-> (z/of-string "[[:chapter {:title "hello world"}]]") (parse-directive)) => {:type :chapter :title "hello world"}

(binding [namespace 'example.core] (-> (z/of-string "[[:ns {:title "hello world"}]]") (parse-directive))) => {:type :ns, :title "hello world", :ns 'example.core}

converts a directive zipper into an element
(-> (z/of-string "[[:chapter {:title \"hello world\"}]]")
    (parse-directive))
=> {:type :chapter :title "hello world"}

(binding [*namespace* 'example.core]
  (-> (z/of-string "[[:ns {:title \"hello world\"}]]")
      (parse-directive)))
=> {:type :ns, :title "hello world", :ns 'example.core}
sourceraw docstring

parse-fact-formclj

(parse-fact-form zloc)

convert a fact zipper into an element

(-> (z/of-string "(fact (+ 1 1) \n => 2)") (parse-fact-form)) => {:type :block :indentation 2 :code "(+ 1 1) \n => 2"}

convert a fact zipper into an element

(-> (z/of-string "(fact (+ 1 1) \n => 2)")
    (parse-fact-form))
=> {:type :block :indentation 2 :code "(+ 1 1) \n => 2"}
sourceraw docstring

parse-facts-formclj

(parse-facts-form zloc)
source

parse-fileclj

(parse-file file opts)
source

parse-innerclj

(parse-inner zloc f output current opts)
source

parse-is-formclj

(parse-is-form zloc)
source

parse-loopclj

(parse-loop zloc opts)
(parse-loop zloc opts current output)

the main loop for the parser (-> (z/of-string "(ns example.core) [[:chapter {:title "hello"}]] (+ 1 1) (+ 2 2)") (parse-loop {})) => [{:type :ns-form, :indentation 0, :ns 'example.core, :code "(ns example.core)"} {:type :chapter, :title "hello"} {:type :code, :indentation 0, :code ["(+ 1 1)" " " "\n" " " "(+ 2 2)"]}]

the main loop for the parser
(-> (z/of-string "(ns example.core)
                  [[:chapter {:title \"hello\"}]]
                  (+ 1 1)
                  (+ 2 2)")
    (parse-loop {}))
=> [{:type :ns-form, :indentation 0, :ns 'example.core, :code "(ns example.core)"}
    {:type :chapter, :title "hello"}
   {:type :code, :indentation 0, :code ["(+ 1 1)"
                                         " "
                                         "\n"
                                         "                    "
                                         "(+ 2 2)"]}]
sourceraw docstring

parse-ns-formclj

(parse-ns-form zloc)

converts a ns zipper into an element

(-> (z/of-string "(ns example.core)") (parse-ns-form)) => '{:type :ns-form :indentation 0 :ns example.core :code "(ns example.core)"}

converts a ns zipper into an element

(-> (z/of-string "(ns example.core)")
    (parse-ns-form))
=> '{:type :ns-form
     :indentation 0
     :ns example.core
     :code "(ns example.core)"}
sourceraw docstring

parse-paragraphclj

(parse-paragraph zloc)

converts a string zipper into an element (-> (z/of-string ""this is a paragraph"") (parse-paragraph)) => {:type :paragraph :text "this is a paragraph"}

converts a string zipper into an element
(-> (z/of-string "\"this is a paragraph\"")
    (parse-paragraph))
=> {:type :paragraph :text "this is a paragraph"}
sourceraw docstring

parse-singleclj

(parse-single zloc)
source

parse-whitespaceclj

(parse-whitespace zloc)

coverts a whitespace zipper into an element (-> (z/of-string "1 2 3") (z/right*) (parse-whitespace)) => {:type :whitespace, :code [" "]}

coverts a whitespace zipper into an element
(-> (z/of-string "1 2 3")
    (z/right*)
    (parse-whitespace))
=> {:type :whitespace, :code [" "]}
sourceraw docstring

wrap-metaclj

(wrap-meta f)
source

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close