Exemple #1
0
func endSentenceWithNode(n *h5.Node) bool {
	for _, v := range endSentenceElementTypes {
		if v == n.Data() { //  || (n.Parent != nil && v == n.Parent.Data()) {
			return true
		}
	}
	return false
}
Exemple #2
0
func validNodeType(n *h5.Node) bool {
	switch n.Type {
	case h5.TextNode:
		return true
	case h5.ElementNode:
		for _, v := range validElementTypes {
			if v == n.Data() {
				return true
			}
		}
	}
	return false
}
Exemple #3
0
Fichier : dom.go Projet : hidai/go
func _getElementsByTagNameAndClass(e *h5.Node, tag_name string, class string, result *[]*h5.Node) {
	if tag_name == "" || e.Data() == tag_name {
		if class == "" {
			*result = append(*result, e)
		} else {
			for _, attr := range e.Attr {
				if attr.Name == "class" && attr.Value == class {
					*result = append(*result, e)
				}
			}
		}
	}
	for _, child := range e.Children {
		_getElementsByTagNameAndClass(child, tag_name, class, result)
	}
}