predicate

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 19, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Debug = false

Functions

func HtmlNodeToString

func HtmlNodeToString(n *html.Node) string

func NodeTypeToString

func NodeTypeToString(nodeType html.NodeType) string

Types

type AndPredicate

type AndPredicate struct {
	Predicates []Predicate
}

func And

func And(predicates ...Predicate) *AndPredicate

func (*AndPredicate) Match

func (ap *AndPredicate) Match(n *html.Node) bool

func (*AndPredicate) Search

func (ap *AndPredicate) Search(ctx context.Context, n *html.Node) []*html.Node

func (*AndPredicate) String

func (ap *AndPredicate) String() string

type HasAttributeKeyAllValuesPredicate

type HasAttributeKeyAllValuesPredicate struct {
	Key    string
	Values []string
}

func (*HasAttributeKeyAllValuesPredicate) Match

func (hakavp *HasAttributeKeyAllValuesPredicate) Match(n *html.Node) bool

func (*HasAttributeKeyAllValuesPredicate) Search

func (*HasAttributeKeyAllValuesPredicate) String

func (hakavp *HasAttributeKeyAllValuesPredicate) String() string

type HasAttributeKeyAnyValuesPredicate

type HasAttributeKeyAnyValuesPredicate struct {
	Key    string
	Values []string
}

func (*HasAttributeKeyAnyValuesPredicate) Match

func (hakavp *HasAttributeKeyAnyValuesPredicate) Match(n *html.Node) bool

func (*HasAttributeKeyAnyValuesPredicate) Search

func (*HasAttributeKeyAnyValuesPredicate) String

func (hakavp *HasAttributeKeyAnyValuesPredicate) String() string

type HasAttributeKeyExactValuePredicate

type HasAttributeKeyExactValuePredicate struct {
	Key   string
	Value string
}

func (*HasAttributeKeyExactValuePredicate) Match

func (*HasAttributeKeyExactValuePredicate) Search

func (*HasAttributeKeyExactValuePredicate) String

type HasAttributeKeyValueRegexpPredicate

type HasAttributeKeyValueRegexpPredicate struct {
	KeyRegexp   *regexp.Regexp
	ValueRegexp *regexp.Regexp
}

func (*HasAttributeKeyValueRegexpPredicate) Match

func (*HasAttributeKeyValueRegexpPredicate) Search

func (*HasAttributeKeyValueRegexpPredicate) String

type HasAttributePredicate

type HasAttributePredicate struct {
	Key string
}

func (*HasAttributePredicate) Match

func (hap *HasAttributePredicate) Match(n *html.Node) bool

func (*HasAttributePredicate) Search

func (hap *HasAttributePredicate) Search(_ context.Context, n *html.Node) []*html.Node

func (*HasAttributePredicate) String

func (hap *HasAttributePredicate) String() string

type HasAttributeRegexpPredicate

type HasAttributeRegexpPredicate struct {
	KeyRegexp *regexp.Regexp
}

func (*HasAttributeRegexpPredicate) Match

func (harp *HasAttributeRegexpPredicate) Match(n *html.Node) bool

func (*HasAttributeRegexpPredicate) Search

func (harp *HasAttributeRegexpPredicate) Search(_ context.Context, n *html.Node) []*html.Node

func (*HasAttributeRegexpPredicate) String

func (harp *HasAttributeRegexpPredicate) String() string

type HasChildWithPredicate

type HasChildWithPredicate struct {
	ChildPredicate Predicate
}

func ChildWith

func ChildWith(p Predicate) *HasChildWithPredicate

func (*HasChildWithPredicate) Match

func (hcwp *HasChildWithPredicate) Match(n *html.Node) bool

func (*HasChildWithPredicate) Search

func (hcwp *HasChildWithPredicate) Search(ctx context.Context, n *html.Node) []*html.Node

type HasDescendantWithPredicate

type HasDescendantWithPredicate struct {
	DescendantPredicate Predicate
}

func DescendantWith

func DescendantWith(p Predicate) *HasDescendantWithPredicate

func (*HasDescendantWithPredicate) Match

func (hdwp *HasDescendantWithPredicate) Match(n *html.Node) bool

func (*HasDescendantWithPredicate) Search

func (hdwp *HasDescendantWithPredicate) Search(ctx context.Context, n *html.Node) []*html.Node

type HasSiblingWithPredicate

type HasSiblingWithPredicate struct {
	SiblingPredicate Predicate
}

func SiblingWith

func SiblingWith(p Predicate) *HasSiblingWithPredicate

func (*HasSiblingWithPredicate) Match

func (hswp *HasSiblingWithPredicate) Match(n *html.Node) bool

func (*HasSiblingWithPredicate) Search

func (hswp *HasSiblingWithPredicate) Search(ctx context.Context, n *html.Node) []*html.Node

type IsNodeTypePredicate

type IsNodeTypePredicate struct {
	NodeType html.NodeType
}

func (*IsNodeTypePredicate) Match

func (isntp *IsNodeTypePredicate) Match(n *html.Node) bool

func (*IsNodeTypePredicate) Search

func (isntp *IsNodeTypePredicate) Search(_ context.Context, n *html.Node) []*html.Node

type OrPredicate

type OrPredicate struct {
	Predicates []Predicate
}

func Or

func Or(predicates ...Predicate) *OrPredicate

func (*OrPredicate) Match

func (op *OrPredicate) Match(n *html.Node) bool

func (*OrPredicate) Search

func (op *OrPredicate) Search(ctx context.Context, n *html.Node) []*html.Node

func (*OrPredicate) String

func (op *OrPredicate) String() string

type Predicate

type Predicate interface {
	Match(n *html.Node) bool
	Search(ctx context.Context, n *html.Node) []*html.Node
}

func Attribute

func Attribute(args ...interface{}) Predicate

type TagPredicate

type TagPredicate struct {
	Tag string
}

func Tag

func Tag(tag string) *TagPredicate

func (*TagPredicate) Match

func (tp *TagPredicate) Match(n *html.Node) bool

func (*TagPredicate) Search

func (tp *TagPredicate) Search(_ context.Context, n *html.Node) []*html.Node

func (*TagPredicate) String

func (tp *TagPredicate) String() string

type TagRegexpPredicate

type TagRegexpPredicate struct {
	TagRegexp *regexp.Regexp
}

func TagRegexp

func TagRegexp(tagRegexp *regexp.Regexp) *TagRegexpPredicate

func (*TagRegexpPredicate) Match

func (trp *TagRegexpPredicate) Match(n *html.Node) bool

func (*TagRegexpPredicate) Search

func (trp *TagRegexpPredicate) Search(_ context.Context, n *html.Node) []*html.Node

func (*TagRegexpPredicate) String

func (trp *TagRegexpPredicate) String() string

Jump to

Keyboard shortcuts

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