selector

package
v0.0.1-dev.4 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type CssSelector

type CssSelector struct {
	SelectorText string
	AttrName     string
	Pretty       bool
}

func (CssSelector) Select

func (this CssSelector) Select(node *html.Node) string

func (CssSelector) SelectList

func (this CssSelector) SelectList(node *html.Node) []string

func (CssSelector) SelectNode

func (this CssSelector) SelectNode(node *html.Node) *html.Node

func (CssSelector) SelectNodeList

func (this CssSelector) SelectNodeList(node *html.Node) []*html.Node

type HtmlNode

type HtmlNode struct {
	Elements []*html.Node
}

func (HtmlNode) Css

func (this HtmlNode) Css(selectorText string) Selectable

func (HtmlNode) CssWithAttr

func (this HtmlNode) CssWithAttr(selectorText string, attrName string) Selectable

has attribute, consider as plaintext

func (HtmlNode) Html

func (this HtmlNode) Html() string
func (this HtmlNode) Links() Selectable

func (HtmlNode) Match

func (this HtmlNode) Match() bool

func (HtmlNode) Nodes

func (this HtmlNode) Nodes() []Selectable

func (HtmlNode) Regex

func (this HtmlNode) Regex(regex string) Selectable

func (HtmlNode) Replace

func (this HtmlNode) Replace(src, replacement string) Selectable

func (HtmlNode) Text

func (this HtmlNode) Text() string

type LinkSelector

type LinkSelector struct{}

func (LinkSelector) Select

func (LinkSelector) Select(node *html.Node) string

func (LinkSelector) SelectList

func (LinkSelector) SelectList(node *html.Node) []string

func (LinkSelector) SelectNode

func (LinkSelector) SelectNode(node *html.Node) *html.Node

func (LinkSelector) SelectNodeList

func (LinkSelector) SelectNodeList(node *html.Node) []*html.Node

type NodeSelector

type NodeSelector interface {
	Select(node *html.Node) string
	SelectList(node *html.Node) []string
	SelectNode(node *html.Node) *html.Node
	SelectNodeList(node *html.Node) []*html.Node
}

type PlainText

type PlainText struct {
	SourceTexts []string
}

func (PlainText) Css

func (this PlainText) Css(selector string) Selectable

func (PlainText) CssWithAttr

func (this PlainText) CssWithAttr(selector string, attrName string) Selectable

func (PlainText) Html

func (this PlainText) Html() string
func (this PlainText) Links() Selectable

func (PlainText) Match

func (this PlainText) Match() bool

func (PlainText) Nodes

func (this PlainText) Nodes() []Selectable

func (PlainText) Regex

func (this PlainText) Regex(regex string) Selectable

func (PlainText) Replace

func (this PlainText) Replace(regexStr, replacement string) Selectable

func (PlainText) Text

func (this PlainText) Text() string

type RegexSelector

type RegexSelector struct {
	RegexStr string
	// contains filtered or unexported fields
}

func NewRegexSelector

func NewRegexSelector(regexStr string) (*RegexSelector, error)

func (RegexSelector) SelectString

func (this RegexSelector) SelectString(src string) string

func (RegexSelector) SelectStringList

func (this RegexSelector) SelectStringList(src string) []string

type ReplaceSelector

type ReplaceSelector struct {
	RegexStr string

	Replacement string
	// contains filtered or unexported fields
}

func NewReplaceSelector

func NewReplaceSelector(regexStr string, replacement string) (*ReplaceSelector, error)

func (ReplaceSelector) SelectString

func (this ReplaceSelector) SelectString(text string) string

func (ReplaceSelector) SelectStringList

func (this ReplaceSelector) SelectStringList(regexStr string) []string

type Selectable

type Selectable interface {
	Links() Selectable
	Regex(regex string) Selectable
	Html() string
	Text() string
	Match() bool
	Css(selectorText string) Selectable
	CssWithAttr(selectorText, attrName string) Selectable
	Replace(regex, replacement string) Selectable
	Nodes() []Selectable
}

type Selector

type Selector interface {
	SelectString(src string) string
	SelectStringList(src string) []string
}

Jump to

Keyboard shortcuts

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