From e4f634705b9f9a21d0c0f9413390faca1151f244 Mon Sep 17 00:00:00 2001 From: Mitarashi Date: Mon, 24 Jan 2022 21:53:59 +0200 Subject: [PATCH 1/2] Fix #521 --- src/parserutils.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/parserutils.nim b/src/parserutils.nim index 0e7c8b5..d4a0aca 100644 --- a/src/parserutils.nim +++ b/src/parserutils.nim @@ -8,7 +8,7 @@ let unRegex = re"(^|[^A-z0-9-_./?])@([A-z0-9_]{1,15})" unReplace = "$1@$2" - htRegex = re"(^|[^\w-_./?])([##$])([\w_]+)" + htRegex = re"(^|[^\w-_./?])([#$]|#)([\w_]+)" htReplace = "$1$2$3" type @@ -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) From d56628ed2f245e043efff9e053b6a4b3b9ccbb9c Mon Sep 17 00:00:00 2001 From: Mitarashi Date: Mon, 24 Jan 2022 21:55:14 +0200 Subject: [PATCH 2/2] removed spaces --- src/parserutils.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parserutils.nim b/src/parserutils.nim index d4a0aca..a605ea4 100644 --- a/src/parserutils.nim +++ b/src/parserutils.nim @@ -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)