func htmlNodeToText(w *bytes.Buffer, n *html.Node) {
	for ; n != nil; n = n.NextSibling {
		switch n.Type {
		case html.TextNode:
			data := sanitizeText(n.Data, false)
			if len(data) == 0 {
				break
			}
			if w.Len() > 0 {
				w.WriteString("; ")
			}
			w.Write(data)
		case html.ElementNode:
			if n.DataAtom != atom.Script {
				htmlNodeToText(w, n.FirstChild)
			}
		case html.DocumentNode:
			htmlNodeToText(w, n.FirstChild)
		}
	}
}
// htmlNodeToText tries to extract some text from an arbitrary HTML
// page. It doesn't try to avoid looking in the header, because the
// title is in the header and is often the most succinct description of
// the page.
htmlNodeToText tries to extract some text from an arbitrary HTML
page. It doesn't try to avoid looking in the header, because the
title is in the header and is often the most succinct description of
the page.
// htmlNodeToText tries to extract some text from an arbitrary HTML // page . It doesn ' t try to avoid looking in the header because the // title is in the header and is often the most succinct description of // the page .
func htmlNodeToText(w *bytes.Buffer, n *html.Node) {
	for ; n != nil; n = n.NextSibling {
		switch n.Type {
		case html.TextNode:
			data := sanitizeText(n.Data, false)
			if len(data) == 0 {
				break
			}
			if w.Len() > 0 {
				w.WriteString("; ")
			}
			w.Write(data)
		case html.ElementNode:
			if n.DataAtom != atom.Script {
				htmlNodeToText(w, n.FirstChild)
			}
		case html.DocumentNode:
			htmlNodeToText(w, n.FirstChild)
		}
	}
}
func htmlNodeToText ( w * bytes . Buffer , n * html . Node ) { for ; n != nil ; n = n . NextSibling { switch n . Type { case html . TextNode : data := sanitizeText ( n . Data , false ) if len ( data ) == 0 { break } if w . Len ( ) > 0 { w . WriteString ( " " ) } w . Write ( data ) case html . ElementNode : if n . DataAtom != atom . Script { htmlNodeToText ( w , n . FirstChild ) } case html . DocumentNode : htmlNodeToText ( w , n . FirstChild ) } } }
htmlNodeToText tries to extract some text from an arbitrary HTML
page.
htmlNodeToText tries to extract some text from an arbitrary HTML page .