gh-110631: Fix wrong reST markup and list numbers.#110885
gh-110631: Fix wrong reST markup and list numbers.#110885ezio-melotti wants to merge 2 commits intopython:mainfrom
Conversation
| one by one: | ||
|
|
||
| I. The keyword is looked up as an attribute on the subject. | ||
| 1. The keyword is looked up as an attribute on the subject. |
There was a problem hiding this comment.
Sphinx <7 doesn't seem to support them, so they are actually just regular paragraphs starting with I. .... Letters like a. b. c. ... are also not supported, so we only have numbers left and have to rely on the indentation to distinguish the levels.
There was a problem hiding this comment.
I see.
Well, we need to keep support for older Sphinx for the benefit of Linux distros (and are testing it on CI), but can we use Sphinx 7 for our actual main build and deploy?
The Roman numerals won't cause any errors for for Sphinx <7, and they'll be better rendered for for Sphinx 7.
Re: #99380 and cc @AA-Turner.
There was a problem hiding this comment.
I should be able to fix the indentation/rendering of the nested lists while keeping the roman numerals, the only issue is that since they are rendered as <p>s rather than <li>s, it's technically incorrect (at least on Sphinx <7). Not sure if that matters though (maybe for screen readers or similar cases?).
There was a problem hiding this comment.
Actually if I fix it for <7, once we upgrade to 7 it will break again.
On <7 I could do:
I. The keyword is looked up as an attribute on the subject.
* ...
* ...which will be seen as a paragraph followed by a list, but on 7 it would have to be:
I. The keyword is looked up as an attribute on the subject.
* ...
* ...since it will be seen as a list item followed by a sublist that needs to be indented.
If I leave the indentation on <7, it will render an additional blockquote around the sublist, and it will cause sphinx-lint to complain, so switching to numbers might still be the best compromise.
There was a problem hiding this comment.
I don't mind too much if the display isn't perfect for <7, as long as it still builds and looks reasonable.
Then we can use 7 for our deploys, and sphinx-lint will be happy too.
Would that work?
There was a problem hiding this comment.
sphinx-lint will be sad on 7 too, since the checker currently ignores alphabetic lists (like Sphinx 6 does) and sees this as an incorrectly indented list under a paragraph, regardless of the Sphinx version used.
I tried adding support for alphabetic lists, but it's a can of worms with many false positives.
There was a problem hiding this comment.
Hmm, maybe we should ignore the Sphinx Lint warning here?
There was a problem hiding this comment.
| 1. The keyword is looked up as an attribute on the subject. | |
| I. The keyword is looked up as an attribute on the subject. |
There was a problem hiding this comment.
I haven't looked into this in a while, but if possible we should find a solution that is both rendered correctly and that is not reported by sphinx-lint as error.
Fixing sphinx-lint is also an option if the error is reported mistakenly, but avoiding alphabetic lists and roman numerals might still be a simpler solution.
|
@ezio-melotti @hugovk Is this something that we can move forward? Or should it be closed? |
|
The cited issues were with Sphinx 6 and earlier, which we have now dropped. |
| one by one: | ||
|
|
||
| I. The keyword is looked up as an attribute on the subject. | ||
| 1. The keyword is looked up as an attribute on the subject. |
There was a problem hiding this comment.
| 1. The keyword is looked up as an attribute on the subject. | |
| I. The keyword is looked up as an attribute on the subject. |
|
|
||
|
|
||
| II. If all keyword patterns succeed, the class pattern succeeds. | ||
| 2. If all keyword patterns succeed, the class pattern succeeds. |
There was a problem hiding this comment.
| 2. If all keyword patterns succeed, the class pattern succeeds. | |
| II. If all keyword patterns succeed, the class pattern succeeds. |
| ``name_or_attr`` before matching: | ||
|
|
||
| I. The equivalent of ``getattr(cls, "__match_args__", ())`` is called. | ||
| 1. The equivalent of ``getattr(cls, "__match_args__", ())`` is called. |
There was a problem hiding this comment.
| 1. The equivalent of ``getattr(cls, "__match_args__", ())`` is called. | |
| I. The equivalent of ``getattr(cls, "__match_args__", ())`` is called. |
| 2. Once all positional patterns have been converted to keyword patterns, | ||
| the match proceeds as if there were only keyword patterns. |
There was a problem hiding this comment.
| 2. Once all positional patterns have been converted to keyword patterns, | |
| the match proceeds as if there were only keyword patterns. | |
| II. Once all positional patterns have been converted to keyword patterns, | |
| the match proceeds as if there were only keyword patterns. |
willingc
left a comment
There was a problem hiding this comment.
Looks good to me. Thanks @ezio-melotti and @AA-Turner for moving this forward.


📚 Documentation preview 📚: https://cpython-previews--110885.org.readthedocs.build/