Liking cljdoc? Tell your friends :D

hara.print.base.report


format-treeclj

(format-tree tree)
(format-tree tree prefix check)

returns a string representation of a tree

(-> (format-tree '[{a "1.1"} [{b "1.2"} [{c "1.3"} {d "1.4"}]]]) (string/split-lines)) => ["{a "1.1"}" " {b "1.2"}" " {c "1.3"}" " {d "1.4"}" ""]

returns a string representation of a tree

(-> (format-tree '[{a "1.1"}
                   [{b "1.2"}
                    [{c "1.3"}
                     {d "1.4"}]]])
    (string/split-lines))
=> ["{a \"1.1\"}"
    "  {b \"1.2\"}"
    "    {c \"1.3\"}"
   "    {d \"1.4\"}" ""]
raw docstring

justifyclj

(justify align content length)

justifies the content to a given alignment

(justify :right "hello" 10) => "hello"

(justify :left "hello" 10) => "hello "

justifies the content to a given alignment

(justify :right "hello" 10)
=> "hello"

(justify :left "hello" 10)
=> "hello     "
raw docstring

padclj

(pad len)

creates n number of spaces

(pad 1) => "" (pad 5) => ""

creates `n` number of spaces

(pad 1) => ""
(pad 5) => ""
raw docstring

pad-centerclj

(pad-center content length)

puts the content at the center, padding missing spacing

(pad-center "hello" 10) => "hello "

puts the content at the center, padding missing spacing

(pad-center "hello" 10)
=> "hello   "
raw docstring

pad-downclj

(pad-down row length height)

creates new lines of n spaces (pad-down [] 10 2) => [" " " "]

creates new lines of n spaces
(pad-down [] 10 2)
=> ["          " "          "]
raw docstring

pad-leftclj

(pad-left content length)

puts the content to the right, padding missing spaces

(pad-left "hello" 10) => "hello"

puts the content to the right, padding missing spaces

(pad-left "hello" 10)
=> "hello"
raw docstring

pad-rightclj

(pad-right content length)

puts the content to the left, padding missing spaces

(pad-right "hello" 10) => "hello "

puts the content to the left, padding missing spaces

(pad-right "hello" 10)
=> "hello     "
raw docstring

prepare-elementsclj

(prepare-elements row {:keys [padding columns] :as params})

same as row-elements but allows for colors and results

(prepare-elements ["hello" :world [:a :b :c :d]] {:padding 0 :spacing 1 :columns [{:align :right :length 10} {:align :center :length 10} {:align :left :length 10}]})

=> [[" hello" " "] [" :world " " "] ["[:a :b :c " " :d] "]]

same as row-elements but allows for colors and results

(prepare-elements ["hello" :world [:a :b :c :d]]
                  {:padding 0
                   :spacing 1
                   :columns [{:align :right :length 10}
                             {:align :center :length 10}
                             {:align :left :length 10}]})

=> [["     hello" "          "]
    ["  :world  " "          "]
    ["[:a :b :c " " :d]      "]]
raw docstring

(print-column items name color)

prints the column

(-> (print-column [[:id.a {:data 100}] [:id.b {:data 200}]] :data #{}) (with-out-str))

prints the column

(-> (print-column [[:id.a {:data 100}] [:id.b {:data 200}]]
                  :data
                 #{})
    (with-out-str))
raw docstring

(print-compare output)

outputs a side by side comparison

(-> (print-compare [['hara.code [[:a :b :c] [:d :e :f]]]]) (with-out-str))

outputs a side by side comparison

(-> (print-compare [['hara.code [[:a :b :c] [:d :e :f]]]])
    (with-out-str))
raw docstring

(print-header titles {:keys [padding columns] :as params})

prints a header for the row

(-> (print-header [:id :name :value] {:padding 0 :spacing 1 :columns [{:align :right :length 10} {:align :center :length 10} {:align :left :length 10}]}) (with-out-str))

prints a header for the row

(-> (print-header [:id :name :value]
                  {:padding 0
                  :spacing 1
                   :columns [{:align :right :length 10}
                             {:align :center :length 10}
                             {:align :left :length 10}]})
    (with-out-str))
raw docstring

(print-row row params)

prints a row to output

(-> (print-row ["hello" :world (result/result {:data [:a :b :c :d :e :f] :status :info})] {:padding 0 :spacing 1 :columns [{:align :right :length 10} {:align :center :length 10} {:align :left :length 10}]}) (with-out-str))

prints a row to output

(-> (print-row ["hello" :world (result/result {:data [:a :b :c :d :e :f]
                                               :status :info})]
               {:padding 0
                :spacing 1
               :columns [{:align :right :length 10}
                          {:align :center :length 10}
                          {:align :left :length 10}]})
    (with-out-str))
raw docstring

(print-subtitle text)

prints the subtitle

(-> (print-subtitle "Hello Again") (with-out-str))

prints the subtitle

(-> (print-subtitle "Hello Again")
    (with-out-str))
raw docstring

(print-summary m)

outputs the summary of results

(-> (print-summary {:count 6 :files 2}) (with-out-str))

outputs the summary of results

(-> (print-summary {:count 6 :files 2})
    (with-out-str))
raw docstring

(print-title title)

prints the title

(-> (print-title "Hello World") (with-out-str))

prints the title

(-> (print-title "Hello World")
    (with-out-str))
raw docstring

(print-tree tree)
(print-tree tree prefix check)

outputs the result of format-tree

(print-tree '[{a "1.1"} [{b "1.2"} [{c "1.3"} {d "1.4"}]]])

outputs the result of `format-tree`

(print-tree '[{a "1.1"}
              [{b "1.2"}
               [{c "1.3"}
                {d "1.4"}]]])
raw docstring

row-elementsclj

(row-elements row {:keys [padding spacing columns] :as params})

layout raw elements based on alignment and length properties

(row-elements ["hello" :world [:a :b :c :d :e :f]] {:padding 0 :spacing 1 :columns [{:align :right :length 10} {:align :center :length 10} {:align :left :length 10}]}) => [[" hello"] [" :world "] ["[:a :b :c " " :d :e :f]"]]

layout raw elements based on alignment and length properties

(row-elements ["hello" :world [:a :b :c :d :e :f]]
              {:padding 0
               :spacing 1
               :columns [{:align :right :length 10}
                         {:align :center :length 10}
                         {:align :left :length 10}]})
=> [["     hello"] ["  :world  "] ["[:a :b :c "
                                   " :d :e :f]"]]
raw docstring

seq-elementsclj

(seq-elements arr {:keys [align length]} padding spacing)

layout an array of elements as a series of rows of a given length

(seq-elements ["A" "BC" "DEF" "GHIJ" "KLMNO"] {:align :left :length 9} 0 1) => {:rows ["[A BC DEF" " GHIJ " " KLMNO] "]}

layout an array of elements as a series of rows of a given length

(seq-elements ["A" "BC" "DEF" "GHIJ" "KLMNO"]
              {:align :left
               :length 9}
              0
              1)
=> {:rows ["[A BC DEF"
           " GHIJ    "
           " KLMNO]  "]}
raw docstring

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

× close