Added cashtags and fixed regex error
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import std/[algorithm, unicode, re, strutils, strformat, options, nre]
|
||||
import std/[algorithm, unicode, re, strutils, strformat, options]
|
||||
import jsony
|
||||
import utils, slices
|
||||
import ../types/user as userType
|
||||
@@ -8,7 +8,7 @@ let
|
||||
unRegex = re.re"(^|[^A-z0-9-_./?])@([A-z0-9_]{1,15})"
|
||||
unReplace = "$1<a href=\"/$2\">@$2</a>"
|
||||
|
||||
htRegex = nre.re"""(*U)(^|[^\w-_.?])([##$])([\w_]*+)(?!</a>|">|#)"""
|
||||
htRegex = re.re"(^|[^a-zA-Z0-9_-_.?])([##$])([a-zA-Z0-9_]+)"
|
||||
htReplace = "$1<a href=\"/search?f=tweets&q=%23$3\">$2$3</a>"
|
||||
|
||||
proc expandUserEntities(user: var User; raw: RawUser) =
|
||||
@@ -29,7 +29,7 @@ proc expandUserEntities(user: var User; raw: RawUser) =
|
||||
|
||||
user.bio = orig.replacedWith(replacements, 0 .. orig.len)
|
||||
.replacef(unRegex, unReplace)
|
||||
.replace(htRegex, htReplace)
|
||||
.replacef(htRegex, htReplace)
|
||||
|
||||
proc getBanner(user: RawUser): string =
|
||||
if user.profileBannerUrl.len > 0:
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ let
|
||||
unRegex = re"(^|[^A-z0-9-_./?])@([A-z0-9_]{1,15})"
|
||||
unReplace = "$1<a href=\"/$2\">@$2</a>"
|
||||
|
||||
htRegex = re"(^|[^\w-_./?])([#$]|#)([\w_]+)"
|
||||
htRegex = re"(^|[^a-zA-Z0-9_-_.?])([#$]|#)([a-zA-Z0-9_]+)"
|
||||
htReplace = "$1<a href=\"/search?f=tweets&q=%23$3\">$2$3</a>"
|
||||
|
||||
type
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ const
|
||||
"media", "images", "twimg", "videos",
|
||||
"native_video", "consumer_video", "spaces",
|
||||
"links", "news", "quote", "mentions",
|
||||
"replies", "retweets", "nativeretweets"
|
||||
"replies", "retweets", "nativeretweets", "cashtags"
|
||||
]
|
||||
|
||||
emptyQuery* = "include:nativeretweets"
|
||||
|
||||
@@ -15,7 +15,8 @@ const toggles = {
|
||||
"links": "Links",
|
||||
"images": "Images",
|
||||
"quote": "Quotes",
|
||||
"spaces": "Spaces"
|
||||
"spaces": "Spaces",
|
||||
"cashtags": "Cashtags"
|
||||
}.toOrderedTable
|
||||
|
||||
proc renderSearch*(): VNode =
|
||||
|
||||
Reference in New Issue
Block a user