MCPcopy Create free account
hub / github.com/cogentcore/core / nodeString

Function nodeString

htmlcore/text.go:55–67  ·  view source on GitHub ↗

nodeString returns the given node as starting and ending strings in the format: and It returns "", "" if the given node is not an [html.ElementNode]

(n *html.Node)

Source from the content-addressed store, hash-verified

53//
54// It returns "", "" if the given node is not an [html.ElementNode]
55func nodeString(n *html.Node) (start, end string) {
56 if n.Type != html.ElementNode {
57 return
58 }
59 tag := n.Data
60 start = "<" + tag
61 for _, a := range n.Attr {
62 start += " " + a.Key + "=" + `"` + a.Val + `"`
63 }
64 start += ">"
65 end = "</" + tag + ">"
66 return
67}
68
69// textTags are all of the node tags that result in a true return value for [isText].
70var textTags = []string{

Callers 2

extractTextFunction · 0.85
handleTextTagFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected