Utils for working with Clojure Zippers
Utils for working with Clojure Zippers
(cut-tree-vertically loc pred)
Given a Zipper, find a node matching the pred
and cut the tree vertically
there (effectively removing all content but closing tags).
Returns the root of the tree. Returns nil if pred
matches nothing.
Given a Zipper, find a node matching the `pred` and cut the tree vertically there (effectively removing all content but closing tags). Returns the root of the tree. Returns nil if `pred` matches nothing.
(find-nearest-left loc)
Find the nearest left loc of the given loc
. If it is the leftmost one,
search up until you find a node that has a left neighbour. Return nil if none.
Find the nearest left loc of the given `loc`. If it is the leftmost one, search up until you find a node that has a left neighbour. Return nil if none.
(find-node loc pred)
Return the loc
of the tree that the pred
returns true for or nil.
The pred is invoked with the node (zip/node
).
Return the `loc` of the tree that the `pred` returns true for or nil. The pred is invoked with the node (`zip/node`).
(more-marker? node)
Is the given DOM node the <!--more-->
marker?
Is the given DOM node the `<!--more-->` marker?
(remove-rights loc)
Remove all nodes to the right of this one without moving.
Modelled after clojure.zip/insert-right
Remove all nodes to the right of this one without moving. Modelled after `clojure.zip/insert-right`
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close