main.go (366B)
1 package main 2 3 import ( 4 "fmt" 5 "os" 6 "strings" 7 8 "golang.org/x/net/html" 9 10 "entf.net/htmltools" 11 "entf.net/htmltools/cmd" 12 ) 13 14 func main() { 15 cmd.Main(os.Args[1:], func(doc *html.Node) { 16 for n := range htmltools.FindRecursive( 17 doc, 18 htmltools.MatchNodeTypeFunc(html.TextNode)) { 19 if t := strings.TrimSpace(n.Data); t != "" { 20 fmt.Println(t) 21 } 22 } 23 }) 24 }