don't let html entities leak as hashtags

This commit is contained in:
Ted Unangst 2019-07-03 16:06:31 -04:00
parent af45592beb
commit 4eeb9ec743
1 changed files with 10 additions and 4 deletions

12
fun.go
View File

@ -122,12 +122,18 @@ var re_hashes = regexp.MustCompile(`(?:^|\W)#[[:alnum:]]+`)
func ontologies(s string) []string {
m := re_hashes.FindAllString(s, -1)
for i, h := range m {
j := 0
for _, h := range m {
if h[0] == '&' {
continue
}
if h[0] != '#' {
m[i] = h[1:]
h = h[1:]
}
m[j] = h
j++
}
return m
return m[:j]
}
type Mention struct {