Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
LainLayer committed Jan 24, 2022
1 parent c9b451d commit e4f6347
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/parserutils.nim
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,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"(^|[^\w-_./?])([#$]|#)([\w_]+)"
htReplace = "$1<a href=\"/search?q=%23$3\">$2$3</a>"

type
Expand Down Expand Up @@ -210,7 +210,7 @@ proc expandUserEntities*(user: var User; js: JsonNode) =

replacements.deduplicate
replacements.sort(cmp)

user.bio = orig.replacedWith(replacements, 0 .. orig.len)
user.bio = user.bio.replacef(unRegex, unReplace)
.replacef(htRegex, htReplace)
Expand Down

0 comments on commit e4f6347

Please sign in to comment.