(code-form nav symbol)converts a form zipper into a code string
(-> (nav/parse-string "(fact (+ 1 1) \n => 2)") (code-form 'fact)) => "(+ 1 1) \n => 2"
converts a form zipper into a code string
(-> (nav/parse-string "(fact (+ 1 1) \n => 2)")
(code-form 'fact))
=> "(+ 1 1) \n => 2"(is-code-form nav)converts the is form into a string
(is-code-form (nav/parse-string "(is (= (+ 1 1) 2))")) => "(+ 1 1)\n=> 2"
(is-code-form (nav/parse-string "(is true)")) => "true"
converts the `is` form into a string (is-code-form (nav/parse-string "(is (= (+ 1 1) 2))")) => "(+ 1 1)\n=> 2" (is-code-form (nav/parse-string "(is true)")) => "true"
(merge-current output current)if not whitespace, then merge output
if not whitespace, then merge output
(parse-attribute nav)coverts an attribute zipper into an element
(-> (nav/parse-string "[[{:title "hello world"}]]") (parse-attribute)) => {:type :attribute, :title "hello world"}
coverts an attribute zipper into an element
(-> (nav/parse-string "[[{:title \"hello world\"}]]")
(parse-attribute))
=> {:type :attribute, :title "hello world"}(parse-code nav)coverts a code zipper into an element
(-> (nav/parse-root "(+ 1 1) (+ 2 2)") (nav/down) (parse-code)) => {:type :code, :indentation 0, :code ["(+ 1 1)"]}
coverts a code zipper into an element
(-> (nav/parse-root "(+ 1 1) (+ 2 2)")
(nav/down)
(parse-code))
=> {:type :code, :indentation 0, :code ["(+ 1 1)"]}(parse-code-directive nav)coverts an code directive zipper into an element
(-> (nav/parse-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
(-> (nav/parse-string "[[:code {:language :ruby} \"1 + 1 == 2\"]]")
(parse-code-directive))
=> {:type :block, :indentation 0 :code "1 + 1 == 2" :language :ruby}(parse-comment-form nav)convert a comment zipper into an element
(-> (nav/parse-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
(-> (nav/parse-string "(comment (+ 1 1) \n => 2)")
(parse-comment-form))
=> {:type :block :indentation 2 :code "(+ 1 1) \n => 2"}(parse-deftest-form nav)converts the deftest form into an element
(-> (nav/parse-string "(deftest hello)") (parse-deftest-form)) => {:type :test, :source {:row 1, :col 1, :end-row 1, :end-col 16}}
converts the `deftest` form into an element
(-> (nav/parse-string "(deftest hello)")
(parse-deftest-form))
=> {:type :test, :source {:row 1, :col 1, :end-row 1, :end-col 16}}(parse-directive nav)converts a directive zipper into an element
(-> (nav/parse-string "[[:chapter {:title "hello world"}]]") (parse-directive)) => {:type :chapter :title "hello world"}
(binding [namespace 'example.core] (-> (nav/parse-string "[[:ns {:title "hello world"}]]") (parse-directive))) => {:type :ns, :title "hello world", :ns 'example.core}
converts a directive zipper into an element
(-> (nav/parse-string "[[:chapter {:title \"hello world\"}]]")
(parse-directive))
=> {:type :chapter :title "hello world"}
(binding [*namespace* 'example.core]
(-> (nav/parse-string "[[:ns {:title \"hello world\"}]]")
(parse-directive)))
=> {:type :ns, :title "hello world", :ns 'example.core}(parse-fact-form nav)convert a fact zipper into an element
(-> (nav/parse-string "(fact (+ 1 1) \n => 2)") (parse-fact-form)) => {:type :test :indentation 2 :code "(+ 1 1) \n => 2"}
convert a fact zipper into an element
(-> (nav/parse-string "(fact (+ 1 1) \n => 2)")
(parse-fact-form))
=> {:type :test :indentation 2 :code "(+ 1 1) \n => 2"}(parse-facts-form nav)converts a facts zipper into an element
(-> (nav/parse-string "(facts (+ 1 1) \n => 2)") (parse-facts-form)) => {:type :test :indentation 2 :code "(+ 1 1) \n => 2"}
converts a facts zipper into an element
(-> (nav/parse-string "(facts (+ 1 1) \n => 2)")
(parse-facts-form))
=> {:type :test :indentation 2 :code "(+ 1 1) \n => 2"}(parse-file file {:keys [root] :as opts})parses the entire file
parses the entire file
(parse-header line)parses a markdown header line
parses a markdown header line
(parse-inner nav f output current opts)parses the inner form of the fact and comment function
parses the inner form of the fact and comment function
(parse-is-form nav)converts an is form into an element
(-> (nav/parse-string "(is (= (+ 1 1) 2))")
(parse-is-form))
=> {:type :block, :indentation 2, :code "(+ 1 1)\n=> 2"}
converts an `is` form into an element
(-> (nav/parse-string "(is (= (+ 1 1) 2))")
(parse-is-form))
=> {:type :block, :indentation 2, :code "(+ 1 1)\n=> 2"}(parse-loop nav opts)(parse-loop nav opts current output)the main loop for the parser
(-> (nav/parse-root "(ns example.core) [[:chapter {:title "hello"}]] (+ 1 1) (+ 2 2)") (nav/down) (parse-loop {}))
=> (contains-in [{:type :ns-form, :indentation 0, :ns 'example.core, :code "(ns example.core)"} {:type :chapter, :title "hello"} {:type :code, :indentation 0, :code (contains ["(+ 1 1)" "(+ 2 2)"] :gaps-ok)}])
the main loop for the parser
(-> (nav/parse-root "(ns example.core)
[[:chapter {:title \"hello\"}]]
(+ 1 1)
(+ 2 2)")
(nav/down)
(parse-loop {}))
=> (contains-in
[{:type :ns-form,
:indentation 0,
:ns 'example.core,
:code "(ns example.core)"}
{:type :chapter, :title "hello"}
{:type :code, :indentation 0, :code (contains ["(+ 1 1)"
"(+ 2 2)"]
:gaps-ok)}])(parse-markdown content)parses markdown content into code.doc elements
parses markdown content into code.doc elements
(parse-ns-form nav)converts a ns zipper into an element
(-> (nav/parse-string "(ns example.core)") (parse-ns-form)) => {:type :ns-form :indentation 0 :meta {} :ns 'example.core :code "(ns example.core)"}
converts a ns zipper into an element
(-> (nav/parse-string "(ns example.core)")
(parse-ns-form))
=> {:type :ns-form
:indentation 0
:meta {}
:ns 'example.core
:code "(ns example.core)"}(parse-paragraph nav)converts a string zipper into an element
(-> (nav/parse-string ""this is a paragraph"") (parse-paragraph)) => {:type :paragraph :text "this is a paragraph"}
converts a string zipper into an element
(-> (nav/parse-string "\"this is a paragraph\"")
(parse-paragraph))
=> {:type :paragraph :text "this is a paragraph"}(parse-whitespace nav)coverts a whitespace zipper into an element
(-> (nav/parse-root "1 2 3") (nav/down) (nav/right*) (parse-whitespace)) => {:type :whitespace, :code [" "]}
coverts a whitespace zipper into an element
(-> (nav/parse-root "1 2 3")
(nav/down)
(nav/right*)
(parse-whitespace))
=> {:type :whitespace, :code [" "]}(wrap-line-info f)helper to add the line information to the parser (used by parse-loop)
helper to add the line information to the parser (used by `parse-loop`)
(wrap-meta f)if form is meta, then go down a level
if form is meta, then go down a level
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |