-
Notifications
You must be signed in to change notification settings - Fork 2k
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
prepend_prolog is broken #10932
Milestone
Comments
It appears that the special handling of |
2bndy5
added a commit
to jbms/sphinx-immaterial
that referenced
this issue
Oct 24, 2022
approved workaround to sphinx-doc/sphinx#10932 is to use a blank line at start of doc before metadata
2bndy5
added a commit
to jbms/sphinx-immaterial
that referenced
this issue
Oct 24, 2022
approved workaround to sphinx-doc/sphinx#10932 is to use a blank line at start of doc before metadata
2bndy5
added a commit
to jbms/sphinx-immaterial
that referenced
this issue
Oct 24, 2022
* update merge script for missing files in git index * updates from upstream v8.5.6 * update official github action versions in CI * resolve #61 - enables linked content tabs and explains/demos how to use them in docs * document how to change the "edit this pg" icon * document changing admonition icons * doc announce block & use announce.dismiss feature * doc user feedback feature * allow use of consent popup (no docs for it though) * revert metadata keys' name changes - approved workaround to sphinx-doc/sphinx#10932 is to use a blank line at start of doc before metadata
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
In sphinx/util/rst.py, the
prepend_prolog
function is used to insert therst_prolog
at the "beginning" of each document:sphinx/sphinx/util/rst.py
Line 76 in 93215f0
sphinx/sphinx/util/rst.py
Line 26 in 93215f0
The intent is for it to be inserted just after the docinfo field list, if one is present, so that the document itself can still specify docinfo/metadata fields, even if
rst_prolog
produces docutils nodes itself (it is not clear to me what the use cases are for anrst_prolog
that produces docutils nodes, but I suppose there may be some).Unfortunately, there are numerous problems with this regular expression:
In fact, in most cases
rst_prolog
does not generate any docutils nodes, and therefore it makes no difference if it gets inserted before or after the docinfo fields. A problem arises, however, if it gets inserted in the middle of the docinfo fields, because the regular expression matches only some, but not all, of the docinfo fields.In that case, the initial fields will be parsed as two separate field lists, and docutils will treat only the first one as the docinfo fields. Consequently, the second field list will remain as a normal field list in the document, and only the first field list will be used as the sphinx metadata.
How to Reproduce
conf.py:
index.rst:
Environment Information
Sphinx extensions
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: