|
From: Günter M. <mi...@us...> - 2023-06-22 14:50:46
|
- **status**: open --> closed-fixed
- **Priority**: 8 --> 5
- **Comment**:
This is a duplicate of [patches:#195], fixed in Docutils 0.20.
Thanks for reporting, anyway.
---
**[bugs:#472] Node.previous_sibling is broken**
**Status:** closed-fixed
**Created:** Mon Jun 05, 2023 03:42 PM UTC by flying sheep
**Last Updated:** Mon Jun 05, 2023 03:53 PM UTC
**Owner:** nobody
It doesn’t work as advertised, as it never returns `None`.
~~~
def previous_sibling(self):
"""Return preceding sibling node or ``None``."""
try:
return self.parent[self.parent.index(self)-1]
except (AttributeError, IndexError):
return None
~~~
This means that when `self` is the first child, i.e. `self.parent.index(self) == 0`, then `self.parent[-1]` is returned. The last child, not `None`. If `len(node.parent) == 1`, that means `node.previous_sibling() is node`.
This in turn means that the HTML writer for `citation` elements will emit broken HTML, see https://github.com/mcmtroffaes/sphinxcontrib-bibtex/issues/329
This is pretty severe since it leads to broken HTML markup and therefore completely broken page layout.
---
Sent from sourceforge.net because doc...@li... is subscribed to https://sourceforge.net/p/docutils/bugs/
To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list. |