less aggressive rewrite filter rewriting
This commit is contained in:
parent
2f52375872
commit
c5ab532e64
9
hfcs.go
9
hfcs.go
|
@ -20,6 +20,7 @@ import (
|
||||||
"regexp"
|
"regexp"
|
||||||
"sort"
|
"sort"
|
||||||
"time"
|
"time"
|
||||||
|
"unicode"
|
||||||
|
|
||||||
"humungus.tedunangst.com/r/webs/cache"
|
"humungus.tedunangst.com/r/webs/cache"
|
||||||
)
|
)
|
||||||
|
@ -109,8 +110,8 @@ func filtcachefiller(userid int64) (afiltermap, bool) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if t := filt.Text; t != "" && t != "." {
|
if t := filt.Text; t != "" && t != "." {
|
||||||
wordfront := t[0] != '#'
|
wordfront := unicode.IsLetter(rune(t[0]))
|
||||||
wordtail := true
|
wordtail := unicode.IsLetter(rune(t[len(t)-1]))
|
||||||
t = "(?i:" + t + ")"
|
t = "(?i:" + t + ")"
|
||||||
if wordfront {
|
if wordfront {
|
||||||
t = "\\b" + t
|
t = "\\b" + t
|
||||||
|
@ -125,8 +126,8 @@ func filtcachefiller(userid int64) (afiltermap, bool) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if t := filt.Rewrite; t != "" {
|
if t := filt.Rewrite; t != "" {
|
||||||
wordfront := t[0] != '#'
|
wordfront := unicode.IsLetter(rune(t[0]))
|
||||||
wordtail := true
|
wordtail := unicode.IsLetter(rune(t[len(t)-1]))
|
||||||
t = "(?i:" + t + ")"
|
t = "(?i:" + t + ")"
|
||||||
if wordfront {
|
if wordfront {
|
||||||
t = "\\b" + t
|
t = "\\b" + t
|
||||||
|
|
Loading…
Reference in New Issue