Liking cljdoc? Tell your friends :D

hara.code.block


blockclj

(block elem)

creates a block

(base/block-info (block 1)) => {:type :token, :tag :long, :string "1", :height 0, :width 1}

(str (block [1 (newline) (void) 2])) => "[1\n 2]"

creates a block

(base/block-info (block 1))
=> {:type :token, :tag :long, :string "1", :height 0, :width 1}

(str (block [1 (newline) (void) 2]))
=> "[1\n 2]"
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

childrenclj

(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

commentclj

(comment s)

creates a comment block

(str (comment ";hello")) => ";hello"

creates a comment block

(str (comment ";hello"))
=> ";hello"
raw docstring

comment?clj

(comment? block)

checks if the block is a token block

(comment-block? (construct/comment ";;hello")) => true

checks if the block is a token block

(comment-block? (construct/comment ";;hello"))
=> true
raw docstring

containerclj

(container tag children)

creates a container

(str (container :list [(void) (void)])) => "( )"

creates a container

(str (container :list [(void) (void)]))
=> "(  )"
raw docstring

container?clj

(container? block)

checks if block is a container block

(container-block? (construct/block [])) => true

checks if block is a container block

(container-block? (construct/block []))
=> true
raw docstring

contentsclj

(contents block)

reads out the contents of a container

(contents (block [1 2 3])) => '[1 ␣ 2 ␣ 3]

reads out the contents of a container

(contents (block [1 2 3]))
=> '[1 ␣ 2 ␣ 3]
raw docstring

cursorclj

(cursor)

creates a cursor for the navigator

(str (cursor)) => "|"

creates a cursor for the navigator

(str (cursor))
=> "|"
raw docstring

eof?clj

(eof? block)

checks if input is an eof block

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

checks if input is an eof block

(eof-block? (construct/void nil))
=> true
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

heightclj

(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

infoclj

(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

lengthclj

(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

linebreak?clj

(linebreak? block)

checks if block is of type :linebreak

(linebreak-block? (construct/newline)) => true

checks if block is of type :linebreak

(linebreak-block? (construct/newline))
=> true
raw docstring

linespace?clj

(linespace? block)

checks if block is of type :linespace

(linespace-block? (construct/space)) => true

checks if block is of type :linespace

(linespace-block? (construct/space))
=> true
raw docstring

modifier?clj

(modifier? block)

checks if block is a modifier block

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

checks if block is a modifier block

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

newlineclj

(newline)

creates a newline

(str (newline)) => "
"

creates a newline
 
   (str (newline))
   => "\
"
raw docstring

newlinesclj

(newlines n)

creates multiple newlines

(apply str (newlines 5)) => "




"

creates multiple newlines
 
   (apply str (newlines 5))
   => "\
\
\
\
\
"
raw docstring

parse-rootclj

(parse-root s)

parses a root

(str (parse-root "a b c")) => "a b c"

parses a root

(str (parse-root "a b c"))
=> "a b c"
raw docstring

parse-stringclj

(parse-string s)

parses a block from a string input

(-> (parse-string "#(:b {:b 1})") (base/block-value)) => '(fn* [] ((keyword "b") {(keyword "b") 1}))

parses a block from a string input

(-> (parse-string "#(:b {:b 1})")
    (base/block-value))
=> '(fn* [] ((keyword "b") {(keyword "b") 1}))
raw docstring

prefixedclj

(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

rootclj

(root children)

constructs a root block

(str (root '[a b])) => "a b"

constructs a root block

(str (root '[a b]))
=> "a b"
raw docstring

spaceclj

(space)

creates a space block

(str (space)) => "␣"

creates a space block

(str (space))
=> "␣"
raw docstring

space?clj

(space? block)

checks if block is of type \space

(space-block? (construct/space)) => true

checks if block is of type \space

(space-block? (construct/space))
=> true
raw docstring

spacesclj

(spaces n)

creates multiple space blocks

(apply str (spaces 5)) => "␣␣␣␣␣"

creates multiple space blocks

(apply str (spaces 5))
=> "␣␣␣␣␣"
raw docstring

stringclj

(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

suffixedclj

(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

tabclj

(tab)

creates a tab

(str (tab)) => "\ "

creates a tab

(str (tab))
=> "\	"
raw docstring

tabsclj

(tabs n)

creates multiple tabs

(apply str (tabs 5)) => "\ \ \ \ \ "

creates multiple tabs

(apply str (tabs 5))
=> "\	\	\	\	\	"
raw docstring

tagclj

(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

token?clj

(token? block)

checks if the block is a token block

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

checks if the block is a token block

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

typeclj

(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

unevalclj

(uneval)

creates a hash-uneval block

(str (uneval)) => "#_"

creates a hash-uneval block

(str (uneval))
=> "#_"
raw docstring

valueclj

(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

value-stringclj

(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

verifyclj

(verify block)

checks that the block has correct data

checks that the block has correct data
raw docstring

voidclj

(void)
(void ch)

creates a void block

(str (void)) => "␣"

creates a void block

(str (void))
=> "␣"
raw docstring

void?clj

(void? block)

checks if the block is a void block

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

checks if the block is a void block

(void-block? (construct/void))
=> true
raw docstring

widthclj

(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

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

× close