Skip to content

Commit

Permalink
chore(github): Change syntax and fix typing in convert_links method.
Browse files Browse the repository at this point in the history
  • Loading branch information
Magnesium12 committed Sep 11, 2022
1 parent b32adb0 commit dd64d04
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bot/github/github_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,9 +601,9 @@ def convert_links(x: str) -> str:
:return: Formatted text.
"""
reg: str = r'\[([a-zA-Z0-9!@#$%^&*,./?\'";:_=~` ]+)\]\(([(http(s)?):\/\/(www\.)?a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b[-a-zA-Z0-9@:%_\+.~#?&//=]*)\)'
gh_links: list[tuple(str)] = re.findall(reg, x)
gh_links: list[tuple(str, str)] = re.findall(reg, x)
for (txt, link) in gh_links:
old: str = "[" + str(txt) + "]" + "(" + str(link) + ")"
old: str = f"[{txt}]({link})"
txt = str(txt).strip()
link = str(link).strip()
new: str = f"<{link}|{txt}>"
Expand Down

0 comments on commit dd64d04

Please sign in to comment.