Fix #7112: html: SVG image is not layouted as float even if aligned

This commit is contained in:
Takeshi KOMIYA
2020-02-08 22:04:14 +09:00
parent ebb9a9af46
commit 2dd02729bc
3 changed files with 4 additions and 7 deletions

View File

@@ -71,6 +71,7 @@ Bugs fixed
----------
* #6925: html: Remove redundant type="text/javascript" from <script> elements
* #7112: html: SVG image is not layouted as float even if aligned
* #6906, #6907: autodoc: failed to read the source codes encoeded in cp1251
* #6961: latex: warning for babel shown twice
* #7059: latex: LaTeX compilation falls into infinite loop (wrapfig issue)

View File

@@ -609,7 +609,7 @@ class HTMLTranslator(SphinxTranslator, BaseTranslator):
atts['height'] = int(atts['height']) * scale
atts['alt'] = node.get('alt', uri)
if 'align' in node:
self.body.append('<div align="%s" class="align-%s">' %
self.body.append('<div align="%s" class="img align-%s">' %
(node['align'], node['align']))
self.context.append('</div>\n')
else:

View File

@@ -550,11 +550,7 @@ class HTML5Translator(SphinxTranslator, BaseTranslator):
atts['height'] = int(atts['height']) * scale
atts['alt'] = node.get('alt', uri)
if 'align' in node:
self.body.append('<div align="%s" class="align-%s">' %
(node['align'], node['align']))
self.context.append('</div>\n')
else:
self.context.append('')
atts['class'] = 'align-%s' % node['align']
self.body.append(self.emptytag(node, 'img', '', **atts))
return
@@ -563,7 +559,7 @@ class HTML5Translator(SphinxTranslator, BaseTranslator):
# overwritten
def depart_image(self, node: Element) -> None:
if node['uri'].lower().endswith(('svg', 'svgz')):
self.body.append(self.context.pop())
pass
else:
super().depart_image(node)