// pruneFiltered phrase-scans children of n that match fpr.Selector, and adds
// to toDelete those that should be removed according to fpr.Threshold and acls.
pruneFiltered phrase-scans children of n that match fpr.Selector, and adds
to toDelete those that should be removed according to fpr.Threshold and acls.
// pruneFiltered phrase - scans children of n that match fpr . Selector and adds // to toDelete those that should be removed according to fpr . Threshold and acls .
func (c *config) pruneFiltered(n *html.Node, fpr filteredPruningRule, acls map[string]bool, toDelete map[*html.Node]bool) {
	for child := n.FirstChild; child != nil; child = child.NextSibling {
		if toDelete[child] {
			continue
		}
		remove := false
		if fpr.Selector.Selector(child) {
			buf := new(bytes.Buffer)
			html.Render(buf, child)
			tally := make(map[rule]int)
			c.scanContent(buf.Bytes(), "text/html", "utf-8", tally)
			scores := c.categoryScores(tally)
			rule, _ := c.ChooseACLCategoryAction(acls, scores, fpr.Threshold, "allow", "block", "block-invisible")
			remove = rule.Action == "block" || rule.Action == "block-invisible"
		}
		if remove {
			toDelete[child] = true
		} else {
			c.pruneFiltered(child, fpr, acls, toDelete)
		}
	}
}
func ( c * config ) pruneFiltered ( n * html . Node , fpr filteredPruningRule , acls map [ string ] bool , toDelete map [ * html . Node ] bool ) { for child := n . FirstChild ; child != nil ; child = child . NextSibling { if toDelete [ child ] { continue } remove := false if fpr . Selector . Selector ( child ) { buf := new ( bytes . Buffer ) html . Render ( buf , child ) tally := make ( map [ rule ] int ) c . scanContent ( buf . Bytes ( ) , " " , " " , tally ) scores := c . categoryScores ( tally ) rule , _ := c . ChooseACLCategoryAction ( acls , scores , fpr . Threshold , " " , " " , " " ) remove = rule . Action == " " || rule . Action == " " } if remove { toDelete [ child ] = true } else { c . pruneFiltered ( child , fpr , acls , toDelete ) } } }
pruneFiltered phrase-scans children of n that match fpr.Selector, and adds
to toDelete those that should be removed according to fpr.Threshold and acls.
pruneFiltered phrase - scans children of n that match fpr . Selector and adds to toDelete those that should be removed according to fpr . Threshold and acls .