From: Günter M. <mi...@us...> - 2023-05-10 11:06:19
|
- **status**: open-fixed --> closed-fixed - **Comment**: Fixed in [Docutils 0.20](https://pypi.org/project/docutils/0.20) Thank you for the report and patch. --- **[patches:#195] invalid html for citation nodes with no siblings** **Status:** closed-fixed **Group:** None **Created:** Thu Aug 25, 2022 08:46 AM UTC by Matthias C. M. Troffaes **Last Updated:** Tue Oct 11, 2022 07:04 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 doc...@li... 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. |