Uh oh!
There was an error while loading. Please reload this page.
gh-139257: escape enumerator-like letters to support docutils 0.22 - #140031
gh-139257: escape enumerator-like letters to support docutils 0.22#140031stefanor wants to merge 4 commits into
Conversation
Escape things that look like Roman numerals. Docutils 0.22 includes a new roman-numeral interpreter that falls over some of our content. Escape anything that causes trouble. Python itself isn't using docutils 0.22 yet for its doc generation, but some Linux distributions have updated to it.
picnixz
left a comment
There was a problem hiding this comment.
Well, if this change is actually sufficient it's good. But that means that we need to be careful when adding roman-like text. What I find annoying is the Q/A modifications, but I don't know how we could do otherwise.
AA-Turner
commented
Oct 13, 2025
This feels like a Docutils bug if it requires this much escaping? A |
picnixz
commented
Oct 13, 2025
That's because we have no way of disabling roman numeral handling in docutils >= 0.22, unless we specify compatible enumerator-like objects (that are implementation details in docutils and only in >= 0.22). See the issue for the commit that changed this. |
Note: what would be ideal is for docutils to check first the return value of a converter, and if it is None, then assume that the conversion is disabled. That would be the cleanest way to do it (and our monkey patch would be compatible with older docutils versions) |
stefanor
commented
Oct 13, 2025
Presumably that's what @birkenfeld thought when implementing the monkey-patch in #48813. The alternative here is to re-instate #139258 and update the monkey-patch. |
stefanor
commented
Oct 13, 2025
I added a second commit to remove the monkey-patch entirely. But instead of doing that, we could make it raise an explicit exception, to avoid accidentally introducing Roman-numbered lists. |
hugovk
commented
Oct 13, 2025
Other FAQs use headings for the questions, which also makes them linkable: |
picnixz
commented
Oct 13, 2025
That would indeed be better. I think we have two distinct issues:
|
We don't have a single clean method to disable roman lists across docutils versions, but we can blow up the bulid cleanly...
Docutils 0.22 does not allow referencing a link that was implicitly named earlier in the document, it complains: ERROR: Duplicate target name, cannot be used as a unique reference: "basic authentication".
Docutils 0.22 doesn't allow the contents directive to be used within an only directive, it complains: ERROR: The "contents" directive may not be used within topics or body elements.
stefanor
commented
Oct 15, 2025
Changed to that. Also, added a couple of additional commits for other docutils 0.22 issues. |
hugovk
commented
Nov 29, 2025
See PR #142056 for an alternative. |
Escape things that look like Roman numerals. Docutils 0.22 includes a new roman-numeral interpreter that falls over some of our content. Escape anything that causes trouble.
Python itself isn't using docutils 0.22 yet for its doc generation, but some Linux distributions have updated to it.
An alternative to GH-139258
📚 Documentation preview 📚: https://cpython-previews--140031.org.readthedocs.build/