htmlx

package module
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 11, 2022 License: BSD-3-Clause Imports: 5 Imported by: 1

README

htmlx

Build Status Coverage Status Go Report Card

HTML parsing eXtensions, aka Monadic Finder of elements.

Includes handy parsehtml command.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Finder

type Finder struct {
	*html.Node
}

func FinderFromData

func FinderFromData(r io.Reader) (Finder, error)

func FinderFromNode

func FinderFromNode(h *html.Node) Finder

func FinderFromString

func FinderFromString(s string) (Finder, error)

func (Finder) Attr added in v0.3.0

func (f Finder) Attr() attr.List

func (Finder) Find

func (f Finder) Find(pred pred.Predicate) (r Finder)

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

func (f Finder) FindPrevSibling(pred pred.Predicate) (r Finder)

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

func (f Finder) FindSibling(pred pred.Predicate) (r Finder)

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, bool)

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 (f Finder) FirstChild() Finder

func (Finder) InnerText added in v0.8.0

func (f Finder) InnerText() string

func (Finder) IsEmpty

func (f Finder) IsEmpty() bool

func (Finder) LastChild added in v0.4.0

func (f Finder) LastChild() Finder

func (Finder) NextSibling

func (f Finder) NextSibling() Finder

func (Finder) Parent added in v0.4.0

func (f Finder) Parent() Finder

func (Finder) PrevSibling added in v0.4.0

func (f Finder) PrevSibling() Finder

func (Finder) StreamSelf added in v0.11.0

func (f Finder) StreamSelf() FinderStream

func (Finder) String

func (f Finder) String() string

func (Finder) Write added in v0.8.0

func (f Finder) Write(w io.Writer) error

type FinderStream added in v0.8.0

type FinderStream <-chan Finder

func (FinderStream) Collect added in v0.8.0

func (ff FinderStream) Collect() (res []Finder)

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) Last added in v0.8.0

func (ff FinderStream) Last() (f Finder)

func (FinderStream) Select added in v0.8.0

func (ff FinderStream) Select(p pred.Predicate) Finder

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL