From: Abramo B. <abr...@us...> - 2022-10-11 12:52:53
|
I confirm that the patch fixes the problem of unmatched `</div>` generation. --- ** [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:** Thu Aug 25, 2022 08:49 AM 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. |