Deas Sphinx developers,
the new Docutils release 0.13 if finally out. It includes many bugfixes
and the new HTML5 writer (no need to ship a copy).
See
http://docutils.sourceforge.net/RELEASE-NOTES.html
Unfortunately, it also leads to an error with the "image" directive, due to
* dropping the use of the "heterogenous stack" ``self.context``
in the visit_image() / depart_image() functions
* Sphinx unsafe "partial overwriting" of this function pair:
While most overwriting in ``sphinx/writers/html.py`` is pairwise
(also in cases where only one function is changed:
# overwritten (but not changed) to keep pair of visit/depart_term
# overwritten (but not changed) to keep pair of visit/depart_definition
), this is not the case for visit_image(), where the matching parent function
`depart_image()` is not overwritten.
The following patch will make Sphinx fit for both, Docutils 0.13 and earlier
versions:
--- /usr/lib/python2.7/dist-packages/sphinx/writers/html.py 2016-10-01 17:14:37.000000000 +0200
+++ /tmp/
html28485.1990.py 2016-12-12 08:44:52.914722357 +0100
@@ -498,6 +498,10 @@
node['height'] = str(size[1])
BaseTranslator.visit_image(self, node)
+ # overwritten (but not changed) to keep pair of visit/depart_image
+ def depart_image(self, node):
+ self.body.append(self.context.pop())
+
def visit_toctree(self, node):
# this only happens when formatting a toc from env.tocs -- in this
# case we don't want to include the subtree
This patch should replace the restriction on the Docutils version
https://github.com/sphinx-doc/sphinx/pull/3217
and related.
Sorry for the trouble,
Günter Milde