Liking cljdoc? Tell your friends :D

hara.code.block.base


*block-tags*clj


*block-types*clj


*container-limits*clj


*container-tags*clj


*void-representations*clj


block-childrenclj

(block-children block)

returns the children in the block

(->> (block-children (parse/parse-string "[1 2]")) (apply str)) => "1␣␣␣2"

returns the children in the block

(->> (block-children (parse/parse-string "[1   2]"))
     (apply str))
=> "1␣␣␣2"
raw docstring

block-heightclj

(block-height block)

returns the height of a block

(block-height (construct/block ^:list [(construct/newline) (construct/newline)])) => 2

returns the height of a block

(block-height (construct/block
               ^:list [(construct/newline)
                       (construct/newline)]))
=> 2
raw docstring

block-infoclj

(block-info block)

returns the data associated with the block

(block-info (construct/token true)) => {:type :token, :tag :boolean, :string "true", :height 0, :width 4} => {:type :token, :tag :boolean, :string "true"}

(block-info (construct/void \tab)) => {:type :void, :tag :linetab, :string "\t", :height 0, :width 4}

returns the data associated with the block

(block-info (construct/token true))
=> {:type :token, :tag :boolean, :string "true", :height 0, :width 4}
=> {:type :token, :tag :boolean, :string "true"}

(block-info (construct/void \tab))
=> {:type :void, :tag :linetab, :string "\t", :height 0, :width 4}
raw docstring

block-lengthclj

(block-length block)

return the length of the string

(block-length (construct/void)) => 1

(block-length (construct/block [1 2 3 4])) => 9

return the length of the string

(block-length (construct/void))
=> 1

(block-length (construct/block [1 2 3 4]))
=> 9
raw docstring

block-modifyclj

(block-modify block accumulator input)

allows the block to modify an accumulator

(block-modify (construct/uneval) [1 2] 'ANYTHING) => [1 2]

allows the block to modify an accumulator

(block-modify (construct/uneval) [1 2] 'ANYTHING)
=> [1 2]
raw docstring

block-prefixedclj

(block-prefixed block)

returns the length of the starting characters

(block-prefixed (construct/block #{})) => 2

returns the length of the starting characters

(block-prefixed (construct/block #{}))
=> 2
raw docstring

block-stringclj

(block-string block)

returns block string as representated in the file

(block-string (construct/token 3/4)) => "3/4"

(block-string (construct/void \space)) => ""

returns block string as representated in the file

(block-string (construct/token 3/4))
=> "3/4"

(block-string (construct/void \space))
=> ""
raw docstring

block-suffixedclj

(block-suffixed block)

returns the length of the ending characters

(block-suffixed (construct/block #{})) => 1

returns the length of the ending characters

(block-suffixed (construct/block #{}))
=> 1
raw docstring

block-tagclj

(block-tag block)

returns block tag as keyword

(block-tag (construct/void nil)) => :eof

(block-tag (construct/void \space)) => :linespace

returns block tag as keyword

(block-tag (construct/void nil))
=> :eof

(block-tag (construct/void \space))
=> :linespace
raw docstring

block-typeclj

(block-type block)

returns block type as keyword

(block-type (construct/void nil)) => :void

(block-type (construct/token "hello")) => :token

returns block type as keyword

(block-type (construct/void nil))
=> :void

(block-type (construct/token "hello"))
=> :token
raw docstring

block-valueclj

(block-value block)

returns the value of the block

(block-value (construct/token 1.2)) => 1.2

returns the value of the block

(block-value (construct/token 1.2))
=> 1.2
raw docstring

block-value-stringclj

(block-value-string block)

returns the string for which a value will be generated

(block-value-string (parse/parse-string "#(+ 1 ::2)")) => "#(+ 1 (keyword ":2"))"

returns the string for which a value will be generated

(block-value-string (parse/parse-string "#(+ 1 ::2)"))
=> "#(+ 1 (keyword \":2\"))"
raw docstring

block-verifyclj

(block-verify block)

checks that the block has correct data

checks that the block has correct data
raw docstring

block-widthclj

(block-width block)

returns the width of a block

(block-width (construct/token 'hello)) => 5

returns the width of a block

(block-width (construct/token 'hello))
=> 5
raw docstring

block?clj

(block? obj)

check whether an object is a block

(block? (construct/void nil)) => true

(block? (construct/token "hello")) => true

check whether an object is a block

(block? (construct/void nil))
=> true

(block? (construct/token "hello"))
=> true
raw docstring

container?clj

(container? block)

determines whether a block has children

(container? (parse/parse-string "[1 2 3]")) => true

(container? (parse/parse-string " ")) => false

determines whether a block has children

(container? (parse/parse-string "[1 2 3]"))
=> true

(container? (parse/parse-string " "))
=> false
raw docstring

expression?clj

(expression? block)

checks if the block has a value associated with it

(expression? (construct/token 1.2)) => true

checks if the block has a value associated with it

(expression? (construct/token 1.2))
=> true
raw docstring

modifier?clj

(modifier? block)

checks if the block is of type INodeModifier

(modifier? (construct/uneval)) => true

checks if the block is of type INodeModifier

(modifier? (construct/uneval))
=> true
raw docstring

replace-childrenclj

(replace-children block children)

replace childer

(->> (replace-children (construct/block []) (conj (vec (.-children (construct/block [1 2]))) (construct/void \space) (construct/block [3 4]))) str) => "[1 2 [3 4]]"

replace childer

(->> (replace-children (construct/block [])
                       (conj (vec (.-children (construct/block [1 2])))
                             (construct/void \space)
                             (construct/block [3 4])))
     str)
=> "[1 2 [3 4]]"
raw docstring

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

× close