diff options
author | 2022-12-16 11:20:22 +0000 | |
---|---|---|
committer | 2022-12-16 12:20:22 +0100 | |
commit | eb08529f35ce33ed98c34fb48013f0f4a5fc9635 (patch) | |
tree | 394fd774a943f5c33ce793c67b5865f2570b46c5 /internal/util/statustools.go | |
parent | [bugfix] use match-sorter for filtering domain blocks (#1270) (diff) | |
download | gotosocial-eb08529f35ce33ed98c34fb48013f0f4a5fc9635.tar.xz |
[chore/bugfix] Switch markdown from blackfriday to goldmark (#1267)
Co-authored-by: Autumn! <autumnull@posteo.net>
Diffstat (limited to 'internal/util/statustools.go')
-rw-r--r-- | internal/util/statustools.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/internal/util/statustools.go b/internal/util/statustools.go index b1fd7968b..7479fbff5 100644 --- a/internal/util/statustools.go +++ b/internal/util/statustools.go @@ -78,14 +78,14 @@ func FindHashtagSpansInText(text string) []Span { inTag := false for i, r := range text { - if r == '#' && isHashtagBoundary(prev) { + if r == '#' && IsHashtagBoundary(prev) { // Start of hashtag. inTag = true start = i - } else if inTag && !isPermittedInHashtag(r) && !isHashtagBoundary(r) { + } else if inTag && !IsPermittedInHashtag(r) && !IsHashtagBoundary(r) { // Inside the hashtag, but it was a phoney, gottem. inTag = false - } else if inTag && isHashtagBoundary(r) { + } else if inTag && IsHashtagBoundary(r) { // End of hashtag. inTag = false appendTag(&tags, text, start, i) @@ -119,12 +119,12 @@ func DeriveEmojisFromText(text string) []string { return UniqueStrings(emojis) } -func isPermittedInHashtag(r rune) bool { +func IsPermittedInHashtag(r rune) bool { return unicode.IsLetter(r) || unicode.IsNumber(r) } // Decides where to break before or after a hashtag. -func isHashtagBoundary(r rune) bool { +func IsHashtagBoundary(r rune) bool { return r == '#' || // `###lol` should work unicode.IsSpace(r) || // All kinds of Unicode whitespace. unicode.IsControl(r) || // All kinds of control characters, like tab. |