(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"
(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"}
(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)"]}
(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}
(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"}
(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}
(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"}
(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)"]}]
(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)"}
(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"}
(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 [" "]}
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close