html

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2021 License: OSL-3.0 Imports: 3 Imported by: 0

README

HTML

$$('script')
Array(16) [ script, script, script, script, script, script, script, script,

$$('[type="text/javascript"]')
Array(18) [ script, link, link, script, script, script, script, script, script,

Documentation

Overview

HTML lexer.

Why use "github.com/tdewolff/parse/v2/html" instead of "golang.org/x/net/html"?

"go.sum" with "golang.org/x/net/html" looks like this:

golang.org/x/net v0.0.0-20210924151903
golang.org/x/sys v0.0.0-20201119102817
golang.org/x/sys v0.0.0-20210423082822
golang.org/x/term v0.0.0-20201126162022
golang.org/x/text v0.3.6
golang.org/x/tools v0.0.0-20180917221912

"go.sum" with "github.com/tdewolff/parse/v2/html" looks like this:

github.com/tdewolff/parse/v2 v2.5.21
github.com/tdewolff/test v1.0.6

also, if you count lines of code in non test Go files, including imported packages, "golang.org/x/net/html" has 8,149, while "github.com/tdewolff/parse/v2/html" has 1,718.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Lexer

type Lexer struct {
	*html.Lexer
}

func NewLexer

func NewLexer(r io.Reader) Lexer

func NewLexerBytes added in v1.2.5

func NewLexerBytes(b []byte) Lexer

func (Lexer) Bytes

func (l Lexer) Bytes() []byte

Keep going until we reach "Text", "EndTag" (</script>), "StartTagVoid" (/>) or "StartTag" (<script>). Typically this method would not be used with void elements, as they have no children. However if used with a void element, and a text node immediately follows, it will be returned. Ideally "nil" would be returned, but that would require maintaining a list of all void elements.

func (Lexer) NextTag

func (l Lexer) NextTag(name string) bool

Jump to

Keyboard shortcuts

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