html

package
v0.0.67 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: Apache-2.0, NCSA Imports: 4 Imported by: 0

Documentation

Overview

Package html is a set of utilities for manipulating html Nodes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decorate

func Decorate(root *html.Node, decor []Decoration)

Decorate will apply the given slice of Decorations to the HTML tree starting at root.

func MustZip

func MustZip(n *html.Node, path string) *html.Node

MustZip delegates to Zip and panics on any error.

func PlainText

func PlainText(nodes ...*html.Node) string

PlainText returns the concatenation of the textual contents for the given html Nodes.

func Zip

func Zip(n *html.Node, path string) (*html.Node, error)

Zip returns the Node at the end of the specified path where path contains only the following characters:

'u' Parent
'f' FirstChild
'l' LastChild
'n' NextSibling
'p' PrevSibling

Types

type Decoration

type Decoration struct {
	// 0-based character offsets for the span of the decoration.
	Start, End int

	// Template to use as the HTML decoration Node.
	Node *html.Node
}

Decoration is a template for an HTML node that should span some textual offsets.

Jump to

Keyboard shortcuts

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