Sorry, something went wrong.
|
FYI, @pablogsal in case this isn't backported to the release branch by default as a docs change, this will need to be to ensure translations for these blocks work, given the reported bug. |
Sorry, something went wrong.
|
I agree zero-content impl-detail doesn't make sense. A |
Sorry, something went wrong.
There was a problem hiding this comment.
@StevenHsuYL , could you test to confirm that this PR fixes the issue you experienced in python/python-docs-zh-tw#187 and reported in #97607 ? Thanks!
I tested this and can confirm that after updating Doc/library/queue.rst(including the change suggested by @AA-Turner), the translation of the implementation detail is included correctly:
I also tried rebuilding the .po for Doc/library/readline.rst and it added the implementation note that was previously missing:
Expand diff
Sorry, something went wrong.
|
Warning, treated as error: That's an error from the availability custom directive, unrelated to the impl-detail custom directive modified here. Specifically, you're seeing that because that directive was changed in recent versions to be more strict with the input it accepts (only names of known platforms), and evidently the corresponding docs changes weren't backported. If you're going to apply them manually, just copy the ImplementationDetail class, which is the only one that was actually changed here (or merge this branch with 3.10 with Git). |
Sorry, something went wrong.
|
Thanks for the reply. Thanks a lot! |
Sorry, something went wrong.
|
Great, thanks! I've also tested again with the suggested changes locally to confirm. |
Sorry, something went wrong.
|
Thanks @CAM-Gerlach for the PR, and @ezio-melotti for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.11. |
Sorry, something went wrong.
|
GH-97723 is a backport of this pull request to the 3.11 branch. |
Sorry, something went wrong.
|
GH-97724 is a backport of this pull request to the 3.10 branch. |
Sorry, something went wrong.
This fixes #97607 with the custom impl-detail reST directive in the docs, that results in the text being untranslated in translations (e.g. python/python-docs-zh-tw#187 ) when it isn't written as a separate content paragraph under the directive (as opposed to with no or one line break after the directive start ::, as opposed to two).
In particular, currently the directive treats text in the same paragraph as the directive start by capturing it in an optional argument and manually processing it, which results in missing metadata (e.g. raw source, file and line number) in the parsed doctree nodes (that in turn breaks the translation code that requires this metadata). This PR fixes the directive to use the same internal logic as the similar builtin docutils/Sphinx directives (e.g. the various admonition types), taking no arguments and just treating that text as directive content by default, regardless of the number of line breaks.
All three forms (0, 1, and 2 line breaks) are used for e.g. note:: in the os module doc source, and all three render correctly in the translated os module docs, and I also confirmed that the parsed doctree structure, content and attributes are now identical for all three to that previously generated for separate paragraphs, and the untranslated HTML is byte-identical both between source forms and before and after this change. In addition to fixing the issue, this also simplifies the directive code and logic.
Additionally, I also was able to eliminate the related unused branch from the directive code that handled the situation where the directive is used alone with no content at all. This isn't used anywhere in the docs and seems to lack a clear use case, and its use would be more likely to just an unintentional mistake (e.g. due to an indentation mismatch). The behavior is now likewise consistent with the aforementioned built-in directive, being flagged as an error at build time, and the code/logic is further simplified from two (originally three) code paths to one.
@StevenHsuYL , could you test to confirm that this PR fixes the issue you experienced in python/python-docs-zh-tw#187 and reported in #97607 ? Thanks!
Fixes #97607
Closes #97635