almosthtml

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

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

Go to latest
Published: Jun 27, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTitle

func GetTitle(s string) string

GetTitle returns value of the title tag of this document

func StripTags

func StripTags(s string) string

StripTags removes all tags and keeps only text values

Types

type Node

type Node struct {
	Name     string
	Raw      string
	Params   map[string]string
	Children []*Node
}

Node is something like a html element: tag or text data.

func ParseHTML

func ParseHTML(doc string) (*Node, error)

ParseHTML converts a html text into a Node tree.

func (*Node) GetAttribute

func (n *Node) GetAttribute(attr string) opt.Optional[string]

GetAttribute returns attribute value or Nothing optional if there is no such attribute.

func (*Node) GetElementsByTagAndClass

func (n *Node) GetElementsByTagAndClass(tag string, classes ...string) []*Node

GetElementsByTagAndClass finds all tags with given name, which have all the given classes.

func (*Node) GetElementsByTags

func (n *Node) GetElementsByTags(tags ...string) []*Node

GetElementsByTags finds all elements with given tag names.

func (*Node) InnerHTML

func (n *Node) InnerHTML() string

InnerHTML generates a html representation of the node and it's contents.

func (*Node) String

func (n *Node) String() string

type State

type State int

State is a convenient name for the tokenizer state

func (State) String

func (s State) String() string

Jump to

Keyboard shortcuts

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