Exemple #1
0
func getData(t html.Token, dt html.Token) (ok bool, href string, descr string) {
	for _, a := range t.Attr {
		if a.Key == "href" {
			href = a.Val
			descr = dt.String()
		}
		if a.Key == "class" {
			if strings.HasPrefix(a.Val, "title may-blank") {
				ok = true
			}
		}
	}
	return
}
Exemple #2
0
func swapBrackets(token html.Token) string {
	t := token.String()
	t = strings.Replace(t, "<", "&lt;", 1)
	return strings.Replace(t, ">", "&gt;", 1)
}