Skip to content
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
6 changes: 3 additions & 3 deletions misc/gen_blog_post_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def format_code(h: str) -> str:
indent = a[i].startswith(" ")
if not indent:
i += 1
r.append("<pre>")
r.append("<pre><code>")
while i < len(a) and (
(indent and a[i].startswith(" ")) or (not indent and not a[i].startswith("```"))
):
Expand All @@ -56,7 +56,7 @@ def format_code(h: str) -> str:
line = " " + line
r.append(html.escape(line))
i += 1
r.append("</pre>")
r.append("</code></pre>")
if not indent and a[i].startswith("```"):
i += 1
else:
Expand All @@ -76,7 +76,7 @@ def convert(src: str) -> str:
h = re.sub(r"^## (Mypy [0-9.]+)", r"<h1>\1 Released</h1>", h, flags=re.MULTILINE)

# Subheadings
h = re.sub(r"\n#### ([A-Z`].*)\n", r"\n<h2>\1</h2>\n", h)
h = re.sub(r"\n### ([A-Z`].*)\n", r"\n<h2>\1</h2>\n", h)

# Sub-subheadings
h = re.sub(r"\n\*\*([A-Z_`].*)\*\*\n", r"\n<h3>\1</h3>\n", h)
Expand Down
Loading