github.com/aarzilli/tools@v0.0.0-20151123112009-0d27094f75e0/net/http/dedup/6_apply_dedup.go (about)

     1  package dedup
     2  
     3  import "golang.org/x/net/html"
     4  
     5  func dedupApply(n *html.Node, dedups map[string]bool) {
     6  
     7  	// Children
     8  	for c := n.FirstChild; c != nil; c = c.NextSibling {
     9  		dedupApply(c, dedups)
    10  	}
    11  
    12  	if n.Type == html.ElementNode {
    13  		outline := attrX(n.Attr, "ol") + "."
    14  
    15  		if dedups[outline] {
    16  			n.Type = html.CommentNode
    17  			n.Data = n.Data + " replaced"
    18  		}
    19  	}
    20  
    21  }