mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-26 19:41:11 +00:00
Updates regex on mentions and hashtags
This commit is contained in:
parent
4fcb01805e
commit
fe856bcf2c
1 changed files with 2 additions and 2 deletions
|
@ -143,7 +143,7 @@ def format_mentions(content, mentions):
|
|||
for (mention_text, mention_user) in mentions.items():
|
||||
# turn the mention into a link
|
||||
content = re.sub(
|
||||
rf"{mention_text}\b(?!@)",
|
||||
rf"(?<!/)\B{mention_text}\b(?!@)",
|
||||
rf'<a href="{mention_user.remote_id}">{mention_text}</a>',
|
||||
content,
|
||||
)
|
||||
|
@ -155,7 +155,7 @@ def format_hashtags(content, hashtags):
|
|||
for (mention_text, mention_hashtag) in hashtags.items():
|
||||
# turn the mention into a link
|
||||
content = re.sub(
|
||||
rf"{mention_text}\b(?!@)",
|
||||
rf"(?<!/)\B{mention_text}\b(?!@)",
|
||||
rf'<a href="{mention_hashtag.remote_id}" data-mention="hashtag">'
|
||||
+ rf"{mention_text}</a>",
|
||||
content,
|
||||
|
|
Loading…
Reference in a new issue