[docutils:patches] #195 invalid html for citation nodes with no siblings
"Günter Milde" via Docutils-develop <[email protected]>
| Newsgroups | gmane.text.docutils.devel |
|---|---|
| Message-ID | </p/docutils/patches/195/0a7f3795ea1e8722e82ac8eaaa76fcce1c40fe22.patches@docutils.p.sourceforge.net> |
- Description has changed:
Diff:
~~~~
--- old
+++ new
@@ -1,4 +1,4 @@
-When citations appear in a parent that has no other siblings besides this single citation, a spurious </div> is generated resulting in invalid html code. It appears that this is because the opening <div role="list" class="citation-list"> is not being generated. I've tracked it to this docutils failing to add an opening div for the citation list here:
+When citations appear in a parent that has no other siblings besides this single citation, a spurious `</div>` is generated resulting in invalid html code. It appears that this is because the opening `<div role="list" class="citation-list">` is not being generated. I've tracked it to this docutils failing to add an opening div for the citation list here:
https://github.com/docutils/docutils/blob/master/docutils/docutils/writers/_html_base.py#L632
@@ -8,6 +8,6 @@
Basically, this is due to odd behaviour of previous_sibling: if index relative to parent is zero and there are no other siblings, it returns the node itself instead of None. This looks like a docutils bug, and the attached patch fixes the issue.
-Originally reported here: https://github.com/mcmtroffaes/sphinxcontrib-bibtex/issues/309.
+Originally reported here: https://github.com/mcmtroffaes/sphinxcontrib-bibtex/issues/309 .
-Also reported here: https://github.com/sphinx-doc/sphinx/issues/10784.
+Also reported here: https://github.com/sphinx-doc/sphinx/issues/10784 .
~~~~
---
** [patches:#195] invalid html for citation nodes with no siblings**
**Status:** open
**Group:** None
**Created:** Thu Aug 25, 2022 08:46 AM UTC by Matthias C. M. Troffaes
**Last Updated:** Tue Oct 11, 2022 12:52 PM UTC
**Owner:** nobody
**Attachments:**
- [0001-Fix-previous_sibling-in-case-index-is-0.patch](https://sourceforge.net/p/docutils/patches/195/attachment/0001-Fix-previous_sibling-in-case-index-is-0.patch) (970 Bytes; application/octet-stream)
When citations appear in a parent that has no other siblings besides this single citation, a spurious `</div>` is generated resulting in invalid html code. It appears that this is because the opening `<div role="list" class="citation-list">` is not being generated. I've tracked it to this docutils failing to add an opening div for the citation list here:
https://github.com/docutils/docutils/blob/master/docutils/docutils/writers/_html_base.py#L632
It gets then closed here leading to the extra tag:
https://github.com/docutils/docutils/blob/master/docutils/docutils/writers/_html_base.py#L640
Basically, this is due to odd behaviour of previous_sibling: if index relative to parent is zero and there are no other siblings, it returns the node itself instead of None. This looks like a docutils bug, and the attached patch fixes the issue.
Originally reported here: https://github.com/mcmtroffaes/sphinxcontrib-bibtex/issues/309 .
Also reported here: https://github.com/sphinx-doc/sphinx/issues/10784 .
---
Sent from sourceforge.net because [email protected] is subscribed to https://sourceforge.net/p/docutils/patches/
To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/patches/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.