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.
Ah, it’s been fixed in https://sourceforge.net/p/docutils/patches/195/ / v0.20
Last edit: flying sheep 2023-06-05
This is a duplicate of [patches:#195], fixed in Docutils 0.20.
Thanks for reporting, anyway.
Related
Patches:
#195