all repos — honk @ 8f140d517f7b30633ba0a2e0788c7643d5c27909

my fork of honk

more flexible regex for quick mentions, reported by dirk
Ted Unangst tedu@tedunangst.com
Fri, 03 Feb 2023 22:37:19 -0500
commit

8f140d517f7b30633ba0a2e0788c7643d5c27909

parent

7646d85420fb98a1f161021c45340d9f2bebba7b

1 files changed, 4 insertions(+), 2 deletions(-)

jump to
M fun.gofun.go

@@ -27,6 +27,7 @@ "os"

"regexp" "strings" "time" + "unicode" "golang.org/x/net/html" "humungus.tedunangst.com/r/webs/cache"

@@ -457,7 +458,8 @@ }

honk.Noise = re_memes.ReplaceAllStringFunc(honk.Noise, repl) } -var re_quickmention = regexp.MustCompile("(^|[ \n])@[[:alnum:]]+([ \n.]|$)") +// be mindful not to match trailing @ +var re_quickmention = regexp.MustCompile("(^|[ \n])@[[:alnum:]]+([ \n.,']|$)") func quickrename(s string, userid int64) string { nonstop := true

@@ -472,7 +474,7 @@ }

prefix += "@" m = m[1:] tail := "" - if last := m[len(m)-1]; last == ' ' || last == '\n' || last == '.' { + if last := m[len(m)-1]; last == ' ' || last == '\n' || unicode.IsPunct(rune(last)) { tail = m[len(m)-1:] m = m[:len(m)-1] }