Fixes extra spaces after urls
This commit is contained in:
@@ -257,7 +257,7 @@ class RichTextParser() {
|
|||||||
parseHash(word, tags)
|
parseHash(word, tags)
|
||||||
} else if (word.contains(".") && schemelessMatcher.find()) {
|
} else if (word.contains(".") && schemelessMatcher.find()) {
|
||||||
val url = schemelessMatcher.group(1) // url
|
val url = schemelessMatcher.group(1) // url
|
||||||
val additionalChars = schemelessMatcher.group(4) // additional chars
|
val additionalChars = schemelessMatcher.group(4).ifEmpty { null } // additional chars
|
||||||
val pattern =
|
val pattern =
|
||||||
"""^([A-Za-z0-9-_]+(\.[A-Za-z0-9-_]+)+)(:[0-9]+)?(/[^?#]*)?(\?[^#]*)?(#.*)?"""
|
"""^([A-Za-z0-9-_]+(\.[A-Za-z0-9-_]+)+)(:[0-9]+)?(/[^?#]*)?(\?[^#]*)?(#.*)?"""
|
||||||
.toRegex(RegexOption.IGNORE_CASE)
|
.toRegex(RegexOption.IGNORE_CASE)
|
||||||
@@ -307,7 +307,7 @@ class RichTextParser() {
|
|||||||
if (hashtagMatcher.find()) {
|
if (hashtagMatcher.find()) {
|
||||||
val hashtag = hashtagMatcher.group(1)
|
val hashtag = hashtagMatcher.group(1)
|
||||||
if (hashtag != null) {
|
if (hashtag != null) {
|
||||||
return HashTagSegment(word, hashtag, hashtagMatcher.group(2))
|
return HashTagSegment(word, hashtag, hashtagMatcher.group(2).ifEmpty { null })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
|||||||
Reference in New Issue
Block a user