parser

package
v0.0.0-...-6fe145f Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Filter

func Filter(nodes []*html.Node, m Matcher) (result []*html.Node)

func Query

func Query(n *html.Node, m Matcher) *html.Node

func QueryAll

func QueryAll(n *html.Node, m Matcher) []*html.Node

Types

type Matcher

type Matcher interface {
	Match(n *html.Node) bool
}

type Sel

type Sel interface {
	Matcher
	Specificity() Specificity

	String() string

	PseudoElement() string
}

func Parse

func Parse(sel string) (Sel, error)

func ParseWithPseudoElement

func ParseWithPseudoElement(sel string) (Sel, error)

type Selector

type Selector func(*html.Node) bool

func Compile

func Compile(sel string) (Selector, error)

func MustCompile

func MustCompile(sel string) Selector

func (Selector) Filter

func (s Selector) Filter(nodes []*html.Node) (result []*html.Node)

func (Selector) Match

func (s Selector) Match(n *html.Node) bool

func (Selector) MatchAll

func (s Selector) MatchAll(n *html.Node) []*html.Node

func (Selector) MatchFirst

func (s Selector) MatchFirst(n *html.Node) *html.Node

type SelectorGroup

type SelectorGroup []Sel

func ParseGroup

func ParseGroup(sel string) (SelectorGroup, error)

func ParseGroupWithPseudoElements

func ParseGroupWithPseudoElements(sel string) (SelectorGroup, error)

func (SelectorGroup) Match

func (s SelectorGroup) Match(n *html.Node) bool

func (SelectorGroup) String

func (c SelectorGroup) String() string

type Specificity

type Specificity [3]int

func (Specificity) Add

func (s Specificity) Add(other Specificity) Specificity

func (Specificity) Less

func (s Specificity) Less(other Specificity) bool

Jump to

Keyboard shortcuts

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