mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Refactor depart_image()
This commit is contained in:
parent
4054b0b3a5
commit
b98e2e39bb
@ -535,13 +535,10 @@ class HTMLTranslator(BaseTranslator):
|
||||
|
||||
# overwritten
|
||||
def depart_image(self, node):
|
||||
if sphinx.util.docutils.__version_info__ >= (0, 13):
|
||||
# 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()
|
||||
if node['uri'].lower().endswith(('svg', 'svgz')):
|
||||
self.body.append(self.context.pop())
|
||||
else:
|
||||
BaseTranslator.depart_image(self, node)
|
||||
|
||||
def visit_toctree(self, node):
|
||||
# this only happens when formatting a toc from env.tocs -- in this
|
||||
|
Loading…
Reference in New Issue
Block a user