htmlutil

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

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

Go to latest
Published: Sep 26, 2016 License: AGPL-3.0 Imports: 5 Imported by: 2

README

Collecting together my various html helpers for golang

Not yet sure if this should be considered a proper package or just a source
of snippets to cut&paste from...

A snappier name would be nice.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAttr

func GetAttr(n *html.Node, attr string) string

GetAttr retrieves the value of an attribute on a node. Returns empty string if attribute doesn't exist.

func RenderNode

func RenderNode(n *html.Node) string

RenderNode renders HTML as text, using linebreaks for block elements

func Sanitise

func Sanitise(node *html.Node)

Sanitise HTML - filter eleements and sttrs - remove comments - trim empty text nodes - TODO make links absolute

func TextContent

func TextContent(n *html.Node) string

TextContent recursively fetches the text for a node

Types

This section is empty.

Jump to

Keyboard shortcuts

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