From b32ee5ee464a7d790cf929f5dc0ba38a92d795bc Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 24 Aug 2022 15:00:39 +0530 Subject: [PATCH] Forgot to change code to remove markup for github links --- kitty/conf/types.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/kitty/conf/types.py b/kitty/conf/types.py index 8538cc3fa..7798f4c7c 100644 --- a/kitty/conf/types.py +++ b/kitty/conf/types.py @@ -84,6 +84,8 @@ def resolve_ref(ref: str, website_url: Callable[[str], str] = website_url) -> st def remove_markup(text: str) -> str: + imap = {'iss': 'issues-', 'pull': 'pull-', 'disc': 'discussions-'} + def extract(m: 'Match[str]') -> Tuple[str, str]: parts = m.group(2).split('<') t = parts[0].strip() @@ -93,12 +95,7 @@ def remove_markup(text: str) -> str: def sub(m: 'Match[str]') -> str: if m.group(1) in ('ref', 'iss', 'pull', 'disc'): t, q = extract(m) - if m.group(1) == 'iss': - q = f'github-issue-{q}' - elif m.group(1) == 'pull': - q = f'github-pr-{q}' - elif m.group(1) == 'disc': - q = f'github-discussion-{q}' + q = imap.get(m.group(1), '') + q url = resolve_ref(q) if not url: raise KeyError(f'Failed to resolve :{m.group(1)}: {q}')