i tried parsing regex and now i have three problems.
just fix the hashtag case instead of thinking.
This commit is contained in:
parent
07ae68eae0
commit
42d8dc3619
|
@ -4,7 +4,7 @@ changelog
|
||||||
|
|
||||||
+ Fix mastodon import.
|
+ Fix mastodon import.
|
||||||
|
|
||||||
+ Better regex for filters.
|
+ Filters work better with hashtags.
|
||||||
|
|
||||||
+ Fix hoot to work with Twitter's latest crap.
|
+ Fix hoot to work with Twitter's latest crap.
|
||||||
|
|
||||||
|
|
9
hfcs.go
9
hfcs.go
|
@ -21,7 +21,6 @@ import (
|
||||||
"regexp"
|
"regexp"
|
||||||
"sort"
|
"sort"
|
||||||
"time"
|
"time"
|
||||||
"unicode"
|
|
||||||
|
|
||||||
"humungus.tedunangst.com/r/webs/cache"
|
"humungus.tedunangst.com/r/webs/cache"
|
||||||
)
|
)
|
||||||
|
@ -110,8 +109,8 @@ func filtcachefiller(userid int64) (afiltermap, bool) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if t := filt.Text; t != "" {
|
if t := filt.Text; t != "" {
|
||||||
wordfront := unicode.IsLetter(rune(t[0]))
|
wordfront := t[0] != '#'
|
||||||
wordtail := unicode.IsLetter(rune(t[len(t)-1]))
|
wordtail := true
|
||||||
t = "(?i:" + t + ")"
|
t = "(?i:" + t + ")"
|
||||||
if wordfront {
|
if wordfront {
|
||||||
t = "\\b" + t
|
t = "\\b" + t
|
||||||
|
@ -126,8 +125,8 @@ func filtcachefiller(userid int64) (afiltermap, bool) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if t := filt.Rewrite; t != "" {
|
if t := filt.Rewrite; t != "" {
|
||||||
wordfront := unicode.IsLetter(rune(t[0]))
|
wordfront := t[0] != '#'
|
||||||
wordtail := unicode.IsLetter(rune(t[len(t)-1]))
|
wordtail := true
|
||||||
t = "(?i:" + t + ")"
|
t = "(?i:" + t + ")"
|
||||||
if wordfront {
|
if wordfront {
|
||||||
t = "\\b" + t
|
t = "\\b" + t
|
||||||
|
|
Loading…
Reference in New Issue