mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-11 08:07:28 -06:00
[feature] Allow partial-word hashtags using non-breaking spaces (#3606)
* [feature] Allow partial-word hashtags using non-breaking spaces * update docs
This commit is contained in:
parent
642f5230e6
commit
9477fd7eba
3 changed files with 44 additions and 2 deletions
|
|
@ -38,8 +38,34 @@ func isPermittedInHashtag(r rune) bool {
|
|||
// is a recognized break character for before
|
||||
// or after a #hashtag.
|
||||
func isHashtagBoundary(r rune) bool {
|
||||
return unicode.IsSpace(r) ||
|
||||
(unicode.IsPunct(r) && r != '_')
|
||||
switch {
|
||||
|
||||
// Zero width space.
|
||||
case r == '\u200B':
|
||||
return true
|
||||
|
||||
// Zero width no-break space.
|
||||
case r == '\uFEFF':
|
||||
return true
|
||||
|
||||
// Pipe character sometimes
|
||||
// used as workaround.
|
||||
case r == '|':
|
||||
return true
|
||||
|
||||
// Standard Unicode white space.
|
||||
case unicode.IsSpace(r):
|
||||
return true
|
||||
|
||||
// Non-underscore punctuation.
|
||||
case unicode.IsPunct(r) && r != '_':
|
||||
return true
|
||||
|
||||
// Not recognized
|
||||
// hashtag boundary.
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// isMentionBoundary returns true if rune r
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue