Categorygithub.com/hunsin/go-htmlutil
modulepackage
0.0.0-20200905061817-2226738adb87
Repository: https://github.com/hunsin/go-htmlutil.git
Documentation: pkg.go.dev

# README

go-htmlutil Build Status PkgGoDev

Package htmlutil

htmlutil is a lightweight, simple package that provides utility working with package golang.org/x/net/html.

Package dom

dom implements the Document and Element interfaces of Document Object Model(DOM).

Installation

$ go get -u github.com/Hunsin/go-htmlutil

Documents and examples can be found in pkg.go.dev.

# Packages

No description provided by the author

# Functions

Attr returns the value of keyed attribute under n.
First works like Walk(n, fn) but returns the node once fn(node) returns true.
HasAttr returns whether n has any attribute which matches given key and val.
HasText returns wether n is a html.TextNode and n.Data contains given sub string.
Int returns the first integer it found in n and n's children.
Int64 is like Int(n) but returns an interger of type int64.
IsElement returns whether n is a html.ElementNode and n.Data matches given data.
Last works like First(n, fn) but searches nodes in different direction.
Real returns the first number it found in n and n's children.
Text returns the content of n's first text child node.
Uint64 is like Int(n) but for unsigned numbers.
Walk calls fn with n and all the children under n.

# Type aliases

A MatchFunc is a function which returns if a html node matches certain condition.