carrot

package module
v0.0.0-...-f5aabfc Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2021 License: MIT Imports: 5 Imported by: 0

README

🥕carrot

Go Reference Go Report Card

CSS Selectors Level 3 implementation

Carrot is built to select HTML node using CSS3 selectors.

Basic Usage

carrot := New().SetDoc("./eval/testdata/t.html")
e1 := carrot.Eval("h1") // return []*html.Node
err := carrot.Errors() // return []error

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CSS

type CSS struct {
	// contains filtered or unexported fields
}

CSS is a base object to evaluate css selectors.

func New

func New() *CSS

New creates new CSS object.

func (*CSS) Errors

func (c *CSS) Errors() []error

Errors returns errors field

func (*CSS) Eval

func (c *CSS) Eval(input string) []*html.Node

Eval evaluates a css selector

func (*CSS) SetDoc

func (c *CSS) SetDoc(input string) *CSS

SetDoc set document to a context. input param can be url or local filepath.

func (*CSS) SetDocN

func (c *CSS) SetDocN(n *html.Node) *CSS

SetDocN is another version of SetDoc.

func (*CSS) SetDocR

func (c *CSS) SetDocR(r *http.Response) *CSS

SetDocR is another version of SetDoc.

func (*CSS) SetDocS

func (c *CSS) SetDocS(s string) *CSS

SetDocS is another version of SetDoc.

func (*CSS) String

func (c *CSS) String() string

String returns input field

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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