Skip to content

Commit

Permalink
explictly check for perseus.tufts.edu hostname
Browse files Browse the repository at this point in the history
  • Loading branch information
No767 committed Oct 27, 2024
1 parent 51787b8 commit 0eb802c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions bot/cogs/dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,10 @@ def format_inline_term_reference(self, content: str, entities: list[str]):
)
elif self.link_regex.match(entity):
# Special case here
if "perseus.tufts.edu" in entity:
keyword = entity.split("=")[-1]
keyword_length = len(keyword) + 1
reference_url = URL(entity[:-keyword_length])
keyword = entity.split("=")[-1]
keyword_length = len(keyword) + 1
reference_url = URL(entity[:-keyword_length])
if reference_url.host and reference_url.host == "www.perseus.tufts.edu":
replacements.update(
{
entity: f"[{keyword}]({reference_url.with_query({'doc': reference_url.query['doc'].replace(')', '%29').replace('(', '%28')})})"
Expand Down

0 comments on commit 0eb802c

Please sign in to comment.