just be explicit about match checking
This commit is contained in:
parent
91db81b44d
commit
50524cade2
5
fun.go
5
fun.go
|
@ -27,7 +27,6 @@ import (
|
|||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
"unicode"
|
||||
|
||||
"golang.org/x/net/html"
|
||||
"humungus.tedunangst.com/r/webs/cache"
|
||||
|
@ -458,7 +457,6 @@ func memetize(honk *Honk) {
|
|||
honk.Noise = re_memes.ReplaceAllStringFunc(honk.Noise, repl)
|
||||
}
|
||||
|
||||
// be mindful not to match trailing @
|
||||
var re_quickmention = regexp.MustCompile("(^|[ \n])@[[:alnum:]]+([ \n.,']|$)")
|
||||
|
||||
func quickrename(s string, userid int64) string {
|
||||
|
@ -474,7 +472,8 @@ func quickrename(s string, userid int64) string {
|
|||
prefix += "@"
|
||||
m = m[1:]
|
||||
tail := ""
|
||||
if last := m[len(m)-1]; last == ' ' || last == '\n' || unicode.IsPunct(rune(last)) {
|
||||
if last := m[len(m)-1]; last == ' ' || last == '\n' ||
|
||||
last == '.' || last == ',' || last == '\'' {
|
||||
tail = m[len(m)-1:]
|
||||
m = m[:len(m)-1]
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue