std.block.base

*block-tags*

dynamic

*block-types*

dynamic

*container-limits*

dynamic

*container-tags*

dynamic

*void-representations*

dynamic

block-children

added in 3.0

(block-children block)

returns the children in the block

(->> (block-children (parse/parse-string “1 2”)) (apply str)) => “1␣␣␣2”

block-height

added in 3.0

(block-height block)

returns the height of a block

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

block-info

added in 3.0

(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}

block-length

added in 3.0

(block-length block)

return the length of the string

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

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

block-modify

added in 3.0

(block-modify block accumulator input)

allows the block to modify an accumulator

(block-modify (construct/uneval) 1 2 ’ANYTHING) => 1 2

block-prefixed

added in 3.0

(block-prefixed block)

returns the length of the starting characters

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

block-string

added in 3.0

(block-string block)

returns block string as representated in the file

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

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

block-suffixed

added in 3.0

(block-suffixed block)

returns the length of the ending characters

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

block-tag

added in 3.0

(block-tag block)

returns block tag as keyword

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

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

block-type

added in 3.0

(block-type block)

returns block type as keyword

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

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

block-value

added in 3.0

(block-value block)

returns the value of the block

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

block-value-string

added in 3.0

(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"))”

block-verify

added in 3.0

(block-verify block)

checks that the block has correct data

block-width

added in 3.0

(block-width block)

returns the width of a block

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

block?

added in 3.0

(block? obj)

check whether an object is a block

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

(block? (construct/token “hello”)) => true

container?

added in 3.0

(container? block)

determines whether a block has children

(container? (parse/parse-string “1 2 3”)) => true

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

expression?

added in 3.0

(expression? block)

checks if the block has a value associated with it

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

modifier?

added in 3.0

(modifier? block)

checks if the block is of type INodeModifier

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

replace-children

added in 3.0

(replace-children block children)

replace childer

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