Skip to content

Commit 5092d64

Browse files
committed
also fix multiple consecutive backticks & r"#\d" in the middle of words
1 parent 60472bb commit 5092d64

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

misc/gen_blog_post_html.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ def convert(src: str) -> str:
104104
h = format_code(h)
105105

106106
# Code fragments
107+
h = re.sub(r"``([^`]+)``", r"<tt>\1</tt>", h)
107108
h = re.sub(r"`([^`]+)`", r"<tt>\1</tt>", h)
108109

109110
# Remove **** noise
@@ -125,7 +126,9 @@ def convert(src: str) -> str:
125126
r'fixes issue <a href="https://github.com/python/mypy/issues/\1">\1</a>',
126127
h,
127128
)
128-
h = re.sub(r"#([0-9]+)", r'PR <a href="https://github.com/python/mypy/pull/\1">\1</a>', h)
129+
# Note the leading space to avoid stomping on strings that contain #\d in the middle (such as
130+
# links to PRs in other repos)
131+
h = re.sub(r" #([0-9]+)", r'PR <a href="https://github.com/python/mypy/pull/\1">\1</a>', h)
129132
h = re.sub(r"\) \(PR", ", PR", h)
130133

131134
# Markdown links

0 commit comments

Comments
 (0)