mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2026-09-03 20:52:55 -05:00
Refactor depart_image()
This commit is contained in:
@@ -535,13 +535,10 @@ class HTMLTranslator(BaseTranslator):
|
|||||||
|
|
||||||
# overwritten
|
# overwritten
|
||||||
def depart_image(self, node):
|
def depart_image(self, node):
|
||||||
if sphinx.util.docutils.__version_info__ >= (0, 13):
|
if node['uri'].lower().endswith(('svg', 'svgz')):
|
||||||
# since docutils-0.13, HTMLWriter does not push context data on visit_image()
|
|
||||||
if node['uri'].lower().endswith(('svg', 'svgz')):
|
|
||||||
self.body.append(self.context.pop())
|
|
||||||
else:
|
|
||||||
# docutils-0.12 or below, HTML Writer always push context data on visit_image()
|
|
||||||
self.body.append(self.context.pop())
|
self.body.append(self.context.pop())
|
||||||
|
else:
|
||||||
|
BaseTranslator.depart_image(self, node)
|
||||||
|
|
||||||
def visit_toctree(self, node):
|
def visit_toctree(self, node):
|
||||||
# this only happens when formatting a toc from env.tocs -- in this
|
# this only happens when formatting a toc from env.tocs -- in this
|
||||||
|
|||||||
Reference in New Issue
Block a user