don't let html entities leak as hashtags
This commit is contained in:
parent
af45592beb
commit
4eeb9ec743
14
fun.go
14
fun.go
|
@ -122,12 +122,18 @@ var re_hashes = regexp.MustCompile(`(?:^|\W)#[[:alnum:]]+`)
|
||||||
|
|
||||||
func ontologies(s string) []string {
|
func ontologies(s string) []string {
|
||||||
m := re_hashes.FindAllString(s, -1)
|
m := re_hashes.FindAllString(s, -1)
|
||||||
for i, h := range m {
|
j := 0
|
||||||
if h[0] != '#' {
|
for _, h := range m {
|
||||||
m[i] = h[1:]
|
if h[0] == '&' {
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
if h[0] != '#' {
|
||||||
|
h = h[1:]
|
||||||
|
}
|
||||||
|
m[j] = h
|
||||||
|
j++
|
||||||
}
|
}
|
||||||
return m
|
return m[:j]
|
||||||
}
|
}
|
||||||
|
|
||||||
type Mention struct {
|
type Mention struct {
|
||||||
|
|
Loading…
Reference in New Issue