parseutils

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

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

Go to latest
Published: May 19, 2026 License: MIT Imports: 14 Imported by: 3 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

package parseutils is awesome. It does not use any logging.

Index

Constants

This section is empty.

Variables

View Source
var MNdTypes = []string{"nil", "Blk", "Inl", "Doc"}
View Source
var NodeTypeString = []string{
	"Error", "CData", "Docmt", "Elmnt", "Comnt", "Doctype",
}

NodeTypeString is TBS.

View Source
var TheReader text.Reader
View Source
var TheSourceAfr []byte
View Source
var TheSourceBfr []byte

var theSRC []byte // string var NdKdNms []string

Functions

func DataOfHtmlNode

func DataOfHtmlNode(n *html.Node) string

DataOfHtmlNode returns a string that should be the value of both [Node.Data] and [Node.DataAtom] . If they differ, a warning is issued. Note that if the tag is not recognized, DataAtom is left empty.

TODO: Use strings.Clone ? .

func DoParseTree_html

func DoParseTree_html(s string) (*html.Node, error)

DoParseTree_html returns the parse tree for the HTML from the given string. The input is assumed to be UTF-8 encoded.

func DoParseTree_mkdn

func DoParseTree_mkdn(s string) (ast.Node, text.Reader, error)

DoParseTree_mkdn takes a string and returns the tree produced by the parser.

func FlattenParseTree_html

func FlattenParseTree_html(pHN *html.Node) ([]*html.Node, []int, []*CT.FilePosition, error)

FlattenParseTree_html is TBS.

func FlattenParseTree_mkdn

func FlattenParseTree_mkdn(pMN ast.Node) ([]ast.Node, []int, []*CT.FilePosition, error)

FlattenParseTree_mkdn is TBS.

func HtmlWalk

func HtmlWalk(n *html.Node, walker wf_aWalker_html)

HtmlWalk walks an AST tree of HTML by the depth first search algorithm.

func NTstring

func NTstring(nt html.NodeType) string

NTstring is TBS.

Types

type KVpair

type KVpair struct{ Key, Value string }

KVpair is used for storign property values.

func KVpairsFromAttributes_html

func KVpairsFromAttributes_html(atts []html.Attribute) []KVpair

KVpairsFromAttributes_html is TBS.

func KVpairsFromAttributes_mkdn

func KVpairsFromAttributes_mkdn(atts []ast.Attribute) []KVpair

KVpairsFromAttributes_mkdn is TBS.

func (KVpair) String

func (kvp KVpair) String() string

type ParserResults_html

type ParserResults_html struct {
	RootNode  *html.Node
	NodeSlice []*html.Node
	XU.CommonCPR
}

ParserResults_html is the CPT for HTML(5).

func GenerateParserResults_html

func GenerateParserResults_html(s string) (*ParserResults_html, error)

GenerateParserResults_html is TBS.

func (*ParserResults_html) GetAllByAnyTag

func (pCPR *ParserResults_html) GetAllByAnyTag(ss []string) []*html.Node

GetAllByAnyTag returns a slice of all tree *html.Node that match the tag.

func (*ParserResults_html) GetAllByTag

func (pCPR *ParserResults_html) GetAllByTag(s string) []*html.Node

GetAllByTag returns a slice of *html.Node. It checks the basic tag only, not any namespace. Note that these tag lookup func's default to searching the `ListNodesP`, not the tree of `Node`s.

func (*ParserResults_html) NodeDebug

func (p *ParserResults_html) NodeDebug(i int) string

type ParserResults_mkdn

type ParserResults_mkdn struct {
	RootNode  ast.Node
	NodeSlice []ast.Node
	Reader    text.Reader
	XU.CommonCPR
}

ParserResults_mkdn is a bit dodgy cos ast.Node is an interface, not a struct.

func GenerateParserResults_mkdn

func GenerateParserResults_mkdn(s string) (*ParserResults_mkdn, error)

GenerateParserResults_mkdn is TBS.

func (*ParserResults_mkdn) GetAllByTag

func (pCPR *ParserResults_mkdn) GetAllByTag(s string) []ast.Node

GetAllByTag returns a slice of `ast.Node`. It checks the basic tag only, not any namespace. Note that these tag lookup func's default to searching the `ListNodesP`, not the tree of `Node`s.

Jump to

Keyboard shortcuts

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