Liking cljdoc? Tell your friends :D

std.block.grid


*bind-length*clj


*indent-length*clj


adjust-commentsclj

(adjust-comments blocks)

adds additional newlines after comments

(->> (adjust-comments [(construct/comment ";hello") :a]) (mapv str)) => [";hello" "
" ":a"]

adds additional newlines after comments
 
   (->> (adjust-comments [(construct/comment ";hello") :a])
        (mapv str))
   => [";hello" "\
" ":a"]
raw docstring

gridclj

(grid container anchor {:keys [rules scope] :as opts})

formats lines given indentation rules and scope

(-> (construct/block ^:list ['if-let (construct/newline) (construct/newline) (construct/block '[i (pos? 0)]) (construct/newline) (construct/block '(+ i 1))]) (grid 1 {:rules {'if-let {:indent 1 :bind 1}}}) (construct/contents))

formats lines given indentation rules and scope

(-> (construct/block ^:list ['if-let
                             (construct/newline)
                             (construct/newline) (construct/block '[i (pos? 0)])
                            (construct/newline) (construct/block '(+ i 1))])
    (grid 1 {:rules {'if-let {:indent 1
                              :bind 1}}})
    (construct/contents))
raw docstring

grid-rulesclj

(grid-rules tag sym pscope rules)

creates indentation rules for current block

(grid-rules :list nil nil nil) => {:indent 0, :bind 0, :scope []}

(grid-rules :vector nil nil nil) => {:indent 0, :bind 0, :scope [0]}

(grid-rules :list 'add [1] nil) => {:indent 1, :bind 0, :scope [0]}

(grid-rules :list 'if nil '{if {:indent 1}}) => {:indent 1, :bind 0, :scope []}

creates indentation rules for current block

(grid-rules :list nil nil nil)
=> {:indent 0, :bind 0, :scope []}

(grid-rules :vector nil nil nil)
=> {:indent 0, :bind 0, :scope [0]}

(grid-rules :list 'add [1] nil)
=> {:indent 1, :bind 0, :scope [0]}

(grid-rules :list 'if nil '{if {:indent 1}})
=> {:indent 1, :bind 0, :scope []}
raw docstring

grid-scopeclj

(grid-scope pscope)

calculates the grid scope for child nodes

(grid-scope [{0 1} 1]) => [{0 1} 0]

calculates the grid scope for child nodes

(grid-scope [{0 1} 1])
=> [{0 1} 0]
raw docstring

indent-bindclj

(indent-bind lines bind)

returns the number of lines indentation

(indent-bind [[(construct/token 'if-let)] [(construct/newline)] [(construct/newline) (construct/block '[i (pos? 0)])] [(construct/newline) (construct/block '(+ i 1))]] 1) => 2

returns the number of lines indentation

(indent-bind [[(construct/token 'if-let)]
              [(construct/newline)]
              [(construct/newline) (construct/block '[i (pos? 0)])]
              [(construct/newline) (construct/block '(+ i 1))]]
             1)
=> 2
raw docstring

indent-linesclj

(indent-lines [start & more :as lines]
              anchor
              {:keys [indent bind scope] :as rule})

indent lines given an anchor and rule

(-> (indent-lines [[(construct/token 'if-let)] [(construct/newline)] [(construct/newline) (construct/block '[i (pos? 0)])] [(construct/newline) (construct/block '(+ i 1))]] 1 {:indent 1 :bind 1}) (construct/contents))

indent lines given an anchor and rule

(-> (indent-lines [[(construct/token 'if-let)]
                   [(construct/newline)]
                   [(construct/newline) (construct/block '[i (pos? 0)])]
                  [(construct/newline) (construct/block '(+ i 1))]]
                  1
                  {:indent 1
                   :bind 1})
    (construct/contents))
raw docstring

read-resourceclj


remove-extra-linebreaksclj

(remove-extra-linebreaks lines)

removes extra linebreaks

(remove-extra-linebreaks [[:a] [(construct/newline)] [(construct/newline)] [(construct/newline)] [:b]]) => [[:a] [(construct/newline)] [:b]]

removes extra linebreaks

(remove-extra-linebreaks [[:a]
                          [(construct/newline)]
                          [(construct/newline)]
                          [(construct/newline)]
                          [:b]])
=> [[:a]
    [(construct/newline)]
    [:b]]
raw docstring

remove-starting-spacesclj

(remove-starting-spaces lines)

removes extra spaces from the start of the line

(remove-starting-spaces [[(construct/newline) (construct/space) (construct/space) :a :b] [(construct/newline) (construct/space) :c :d]]) => [[(construct/newline) :a :b] [(construct/newline) :c :d]]

removes extra spaces from the start of the line

(remove-starting-spaces [[(construct/newline)
                          (construct/space)
                          (construct/space) :a :b]
                         [(construct/newline) (construct/space) :c :d]])
=> [[(construct/newline) :a :b]
    [(construct/newline) :c :d]]
raw docstring

split-linesclj

(split-lines blocks)

splits the nodes, retaining the linebreak nodes

(split-lines [:a :b (construct/newline) :c :d]) => [[:a :b] [(construct/newline) :c :d]]

splits the nodes, retaining the linebreak nodes

(split-lines [:a :b (construct/newline) :c :d])
=> [[:a :b]
    [(construct/newline) :c :d]]
raw docstring

trim-leftclj

(trim-left blocks)

removes whitespace nodes on the left

(->> (trim-left [(construct/space) :a (construct/space)]) (mapv str)) => [":a" "␣"]

removes whitespace nodes on the left

(->> (trim-left [(construct/space)
                 :a
                 (construct/space)])
     (mapv str))
=> [":a" "␣"]
raw docstring

trim-rightclj

(trim-right blocks)

removes whitespace nodes on the right

(->> (trim-right [(construct/space) :a (construct/space)]) (mapv str)) => ["␣" ":a"]

removes whitespace nodes on the right

(->> (trim-right [(construct/space)
                  :a
                  (construct/space)])
     (mapv str))
=> ["␣" ":a"]
raw docstring

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

× close