Workaround for .@usernames

This commit is contained in:
Zed 2019-07-03 12:20:23 +02:00
parent 13a9f6cd1f
commit 15826a1e1e
1 changed files with 2 additions and 1 deletions

View File

@ -8,7 +8,7 @@ from unicode import Rune, `$`
const
urlRegex = re"((https?|ftp)://(-\.)?([^\s/?\.#]+\.?)+([/\?][^\s\)]*)?)"
emailRegex = re"([a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+)"
usernameRegex = re"(^|[^A-z])@([A-z0-9_]+)"
usernameRegex = re"(^|[^A-z0-9_?])@([A-z0-9_]+)"
picRegex = re"pic.twitter.com/[^ ]+"
cardRegex = re"(https?://)?cards.twitter.com/[^ ]+"
ellipsisRegex = re" ?…"
@ -55,6 +55,7 @@ proc linkifyText*(text: string): string =
result = result.replace(usernameRegex, reUsernameToLink)
result = result.replace(re"([^\s\(\n%])<a", "$1 <a")
result = result.replace(re"</a>\s+([;.,!\)'%]|&apos;)", "</a>$1")
result = result.replace(re"^\. <a", ".<a")
proc stripTwitterUrls*(text: string): string =
result = text