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

Conversation

wesleywright
Copy link
Collaborator

@wesleywright wesleywright commented Feb 5, 2025

While preparing the 1.15 release blog posts, I noticed a few quirks with our maarkdown converter:

  • We treat any \n followed by a capital letter as a new paragraph, which can cause too many <p> tags to be inserted at times (a common cause in this blog post was a line break followed by the word "PR").
  • Using multiple consecutive backticks for an inline code section is valid markdown (it's commonly used for strings where you need to include single backticks, eg ``a string with a single ` :)``), but our script was confused by this and generated lots of erroneous <tt> sections where they didn't belong.
  • Including a #\d in the middle of a word caused the script to assume it was a PR that it should link. In this specific case, the changelog contains several occurrences of mypy_mypyc-wheels#<PR number>, which the script was stomping on.

This PR contains some minor tweaks for the blog post generation script that attempt to address these quirks.

@wesleywright wesleywright requested a review from JukkaL February 5, 2025 00:02
@wesleywright wesleywright changed the title [misc] fix spurious newlines generated by gen_blog_post_html.py [misc] fix blog post generator quirks Feb 5, 2025
Copy link
Collaborator

@svalentin svalentin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please test on the previous release’s release notes to make sure it still looks correct as an extra validation

@wesleywright
Copy link
Collaborator Author

1.14 only seems to be affected by line break changes:

diff -u *.html.old *.html.new
--- 1.14-blog-post.html.old     2025-02-05 14:29:34
+++ 1.14-blog-post.html.new     2025-02-05 14:29:27
@@ -7,8 +7,8 @@
 <h1>Mypy 1.14 Released</h1>
 
 <p>We’ve just uploaded mypy 1.14 to the Python Package Index (<a href="https://pypi.org/project/mypy/">PyPI</a>).
-<p>Mypy is a static type checker for Python. This release includes new features and bug fixes.
-<p>You can install it as follows:
+Mypy is a static type checker for Python. This release includes new features and bug fixes.
+You can install it as follows:
 
 <pre><code>python3 -m pip install -U mypy
 </code></pre>
\ No newline at end of file
@@ -60,7 +60,7 @@
 </code></pre>
 
 <p>Contributed by Terence Honles (PR <a href="https://github.com/python/mypy/pull/17207">17207</a>) and
-<p>Shantanu Jain (PR <a href="https://github.com/python/mypy/pull/18068">18068</a>).
+Shantanu Jain (PR <a href="https://github.com/python/mypy/pull/18068">18068</a>).
 
 <h2>Support for @deprecated Decorator (PEP 702)</h2>
 
\ No newline at end of file
@@ -71,7 +71,7 @@
 
 <p>You can enable the error code via <tt>--enable-error-code=deprecated</tt> on the mypy
 command line or <tt>enable_error_code = deprecated</tt> in the mypy config file.
-<p>Use the command line flag <tt>--report-deprecated-as-note</tt> or config file option
+Use the command line flag <tt>--report-deprecated-as-note</tt> or config file option
 <tt>report_deprecated_as_note=True</tt> to turn all such errors into notes.
 
 <p>Deprecation errors will be enabled by default in a future mypy version.
\ No newline at end of file

I saw one minor discrepancy with spacing on the 1.11 release post, which I'll push a fix for now (just adding back the extra whitespace character that my change ate).

@wesleywright wesleywright merged commit e9a813c into python:master Feb 5, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants