Skip to content

Commit

Permalink
Fix sphinx-doc#7112: html: SVG image is not layouted as float even if…
Browse files Browse the repository at this point in the history
… aligned
  • Loading branch information
tk0miya committed Feb 9, 2020
1 parent ebb9a9a commit 2dd0272
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGES
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion sphinx/writers/html.py
Expand Up @@ -609,7 +609,7 @@ def visit_image(self, node: Element) -> None:
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:
Expand Down
8 changes: 2 additions & 6 deletions sphinx/writers/html5.py
Expand Up @@ -550,11 +550,7 @@ def visit_image(self, node: Element) -> None:
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

Expand All @@ -563,7 +559,7 @@ def visit_image(self, node: Element) -> None:
# 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)

Expand Down

0 comments on commit 2dd0272

Please sign in to comment.