Documentation ¶
Overview ¶
package parseutils is awesome, and does not use any logging.
Index ¶
- Variables
- func DataOfHtmlNode(n *html.Node) string
- func DoParseTree_html(s string) (*html.Node, error)
- func DoParseTree_mkdn(s string) (ast.Node, text.Reader, error)
- func FlattenParseTree_html(pHN *html.Node) ([]*html.Node, []int, []*CT.FilePosition, error)
- func FlattenParseTree_mkdn(pMN ast.Node) ([]ast.Node, []int, []*CT.FilePosition, error)
- func HtmlWalk(n *html.Node, walker wf_aWalker_html)
- func NTstring(nt html.NodeType) string
- type KVpair
- type ParserResults_html
- func (pCPR *ParserResults_html) GetAllByAnyTag(ss []string) []*html.Node
- func (pCPR *ParserResults_html) GetAllByTag(s string) []*html.Node
- func (p *ParserResults_html) NodeCount() int
- func (p *ParserResults_html) NodeDebug(i int) string
- func (p *ParserResults_html) NodeEcho(i int) string
- func (p *ParserResults_html) NodeInfo(i int) string
- type ParserResults_mkdn
Constants ¶
This section is empty.
Variables ¶
var MNdTypes = []string{"nil", "Blk", "Inl", "Doc"}
var NodeTypeString = []string{
"Error", "CData", "Docmt", "Elmnt", "Comnt", "Doctype",
}
var TheReader text.Reader
var TheSourceAfr []byte
var TheSourceBfr []byte
var theSRC []byte // string var NdKdNms []string
Functions ¶
func DataOfHtmlNode ¶
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 ¶
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 ¶
DoParseTree_mkdn takes a string and returns the tree produced by the parser.
func FlattenParseTree_html ¶
func FlattenParseTree_mkdn ¶
Types ¶
type KVpair ¶
type KVpair struct{ Key, Value string }
type ParserResults_html ¶
func GenerateParserResults_html ¶
func GenerateParserResults_html(s string) (*ParserResults_html, error)
func (*ParserResults_html) GetAllByAnyTag ¶
func (pCPR *ParserResults_html) GetAllByAnyTag(ss []string) []*html.Node
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) NodeCount ¶
func (p *ParserResults_html) NodeCount() int
func (*ParserResults_html) NodeDebug ¶
func (p *ParserResults_html) NodeDebug(i int) string
func (*ParserResults_html) NodeEcho ¶
func (p *ParserResults_html) NodeEcho(i int) string
func (*ParserResults_html) NodeInfo ¶
func (p *ParserResults_html) NodeInfo(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)
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.
func (*ParserResults_mkdn) NodeCount ¶
func (p *ParserResults_mkdn) NodeCount() int
func (*ParserResults_mkdn) NodeDebug ¶
func (p *ParserResults_mkdn) NodeDebug(i int) string
func (*ParserResults_mkdn) NodeEcho ¶
func (p *ParserResults_mkdn) NodeEcho(i int) string
func (*ParserResults_mkdn) NodeInfo ¶
func (p *ParserResults_mkdn) NodeInfo(i int) string