Merge pull request #7114 from tk0miya/7112_svg_not_floated

Fix #7112: html: SVG image is not layouted as float even if aligned
This commit is contained in:
Takeshi KOMIYA 2020-02-09 15:26:49 +09:00 committed by GitHub
commit d07985ed85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 12 deletions

View File

@ -73,6 +73,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,11 +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">' %
(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
@ -622,7 +618,7 @@ class HTMLTranslator(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)

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)