Documentation ¶
Index ¶
- type Finder
- func (f Finder) Attr() attr.List
- func (f Finder) Copy() Finder
- func (f Finder) Find(pred pred.Predicate) (r Finder)
- func (f Finder) FindAll(pred pred.Predicate) FinderStream
- func (f Finder) FindPrevSibling(pred pred.Predicate) (r Finder)
- func (f Finder) FindPrevSiblings(pred pred.Predicate) FinderStream
- func (f Finder) FindSibling(pred pred.Predicate) (r Finder)
- func (f Finder) FindSiblings(pred pred.Predicate) FinderStream
- func (f Finder) FindWithSiblings(pred pred.Predicate) FinderStream
- func (f Finder) FirstChild() Finder
- func (f Finder) InnerText() string
- func (f Finder) IsEmpty() bool
- func (f Finder) LastChild() Finder
- func (f Finder) NextSibling() Finder
- func (f Finder) Parent() Finder
- func (f Finder) PrevSibling() Finder
- func (f Finder) StreamSelf() FinderStream
- func (f Finder) String() string
- func (f Finder) Write(w io.Writer) error
- type FinderStream
- func (ff FinderStream) Collect() (res []Finder)
- func (ff FinderStream) DropN(n int) FinderStream
- func (ff FinderStream) Filter(p pred.Predicate) FinderStream
- func (ff FinderStream) First() Finder
- func (ff FinderStream) Join(split SplitFunc) FinderStream
- func (ff FinderStream) Last() (f Finder)
- func (ff FinderStream) Map(m MapFunc) FinderStream
- func (ff FinderStream) Reduce(combine ReduceFunc) FinderStream
- func (ff FinderStream) Select(p pred.Predicate) Finder
- func (ff FinderStream) TakeN(n int) FinderStream
- type MapFunc
- type ReduceFunc
- type SplitFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Finder ¶
func FinderFromNode ¶
func FinderFromString ¶
func (Finder) Find ¶
Find performs depth-first traversal looking for the node satisfying given precicate. Includes current node in the search. Stops at the first found node and returns it, wrapped in a new Finder.
func (Finder) FindAll ¶ added in v0.8.0
func (f Finder) FindAll(pred pred.Predicate) FinderStream
FindAll performs depth-first traversal like Find, but returns a stream of all the found nodes satisfying the predicate, each wrapped in a Finder. Current node is included in the search.
func (Finder) FindPrevSibling ¶ added in v0.4.0
FindPrevSibling performs flat find of the first node satistying the predicate among current node's previous (left) siblings. No recursion. Omits current node, starts from a first sibling.
func (Finder) FindPrevSiblings ¶ added in v0.8.0
func (f Finder) FindPrevSiblings(pred pred.Predicate) FinderStream
FindPrevSiblings performs flat find of all the nodes satistying the predicate among current node's previous (left) siblings. No recursion. Omits current node, starts from a first sibling.
func (Finder) FindSibling ¶
FindSibling performs flat find of the first node satistying the predicate among current node's next (right) siblings. No recursion. Omits current node, starts from a first sibling.
func (Finder) FindSiblings ¶ added in v0.8.0
func (f Finder) FindSiblings(pred pred.Predicate) FinderStream
FindSiblings performs flat find of all the nodes satistying the predicate among current node's next (right) siblings. No recursion. Omits current node, starts from a first sibling.
func (Finder) FindWithSiblings ¶ added in v0.10.0
func (f Finder) FindWithSiblings(pred pred.Predicate) FinderStream
FindWithSiblings performs depth-first travelsal looking for the first of nodes satisfying given predicate. Then it continues flat find of all the siblings satisfying the predicate. All results are pushed into the returted stream of Finders.
func (Finder) FirstChild ¶
func (Finder) NextSibling ¶
func (Finder) PrevSibling ¶ added in v0.4.0
func (Finder) StreamSelf ¶ added in v0.11.0
func (f Finder) StreamSelf() FinderStream
type FinderStream ¶ added in v0.8.0
type FinderStream <-chan Finder
func AllText ¶ added in v0.14.0
func AllText(f Finder) FinderStream
AllText is a splitFunc returning a stream of all text nodes found descending from the given node, depth-first. The nodes containing only whitespaces are not included.
func Inject ¶ added in v0.15.0
func Inject(a []Finder) FinderStream
func (FinderStream) Collect ¶ added in v0.8.0
func (ff FinderStream) Collect() (res []Finder)
func (FinderStream) DropN ¶ added in v0.12.0
func (ff FinderStream) DropN(n int) FinderStream
func (FinderStream) Filter ¶ added in v0.8.0
func (ff FinderStream) Filter(p pred.Predicate) FinderStream
func (FinderStream) First ¶ added in v0.8.0
func (ff FinderStream) First() Finder
func (FinderStream) Join ¶ added in v0.14.0
func (ff FinderStream) Join(split SplitFunc) FinderStream
Join performs depth-first join of streams generated by applying the splitFunc on every item from the current stream.
func (FinderStream) Last ¶ added in v0.8.0
func (ff FinderStream) Last() (f Finder)
func (FinderStream) Map ¶ added in v0.14.0
func (ff FinderStream) Map(m MapFunc) FinderStream
Map maps the stream, changing each node wrapped by the finder according to the given function. Note that this function as a signature: `func (Finder)` and is supposed to change the internally copied html.Node struct whose pointer is wrapped by the finder. Also note that such an implicit copy is not made in the Reduce function, where we may return an original Finder.
func (FinderStream) Reduce ¶ added in v0.14.0
func (ff FinderStream) Reduce(combine ReduceFunc) FinderStream
Reduce reduces the stream according to the given combine function. It copies the first item of the stream, then for each item y, uses combine(prev, y) func to decide what should be copied to the output stream. There are three possibilities: (_, false) no item is copied in this iteration (y, true) item x is copied (newy, true) combined item newx is copied. Note: for the last case, combine func should do explicit x.Copy() to create new html.Node struct.
func (FinderStream) TakeN ¶ added in v0.12.0
func (ff FinderStream) TakeN(n int) FinderStream
type ReduceFunc ¶ added in v0.14.0
type SplitFunc ¶ added in v0.14.0
type SplitFunc func(Finder) FinderStream