htmlutils

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

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

Go to latest
Published: Jul 25, 2016 License: Apache-2.0 Imports: 2 Imported by: 0

README

htmlutils

htmlutils contains functions to simplify working with Go language's experimental HTML5 parser

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendAll

func AppendAll(dst []*html.Node, n *html.Node, mf MatchFunc) []*html.Node

AppendAll recursively traverses the parse tree rooted under the provided node and appends all nodes matched by the MatchFunc to dst.

func FindNode

func FindNode(n *html.Node, mf MatchFunc) *html.Node

FindNode recursively searches for the node matched by MatchFunc and returns it if found.

func GetAttr

func GetAttr(n *html.Node, namespace, key string) string

GetAttr fetches the value of a html.Attribute for a given namespace and key.

func GetData

func GetData(n *html.Node) string

GetData searches for all the text nodes under the provided node and returns concatenation of text data

Types

type MatchFunc

type MatchFunc func(*html.Node) bool

MatchFunc matches HTML nodes.

func MatchAtom

func MatchAtom(a atom.Atom) MatchFunc

MatchAtom returns a MatchFunc that matches a Node with the specified Atom.

func MatchAtomAttr

func MatchAtomAttr(a atom.Atom, namespace, key, value string) MatchFunc

MatchAtomAttr returns a MatchFunc that matches a Node with the specified Atom and a html.Attribute's namespace, key and value.

Jump to

Keyboard shortcuts

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