Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[misc] fix blog post generator quirks #18601

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions misc/gen_blog_post_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def convert(src: str) -> str:
h = re.sub(r"`\*\*`", "<tt>**</tt>", h)

# Paragraphs
h = re.sub(r"\n([A-Z])", r"\n<p>\1", h)
h = re.sub(r"\n\n([A-Z])", r"\n\n<p>\1", h)

# Bullet lists
h = format_lists(h)
Expand All @@ -104,6 +104,7 @@ def convert(src: str) -> str:
h = format_code(h)

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

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

# Markdown links
Expand Down