[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/1f983f0eca94a8f81727ad2b7fbea7ec41ca5ed2.patches@docutils.p.sourceforge.net> |
- **status**: open --> open-fixed
- **Comment**:
Fixed in [r9126].
Thank you for report, analysis, and patch.
---
** [patches:#195] invalid html for citation nodes with no siblings**
**Status:** open-fixed
**Group:** None
**Created:** Thu Aug 25, 2022 08:46 AM UTC by Matthias C. M. Troffaes
**Last Updated:** Tue Oct 11, 2022 02:02 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.