mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
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:
commit
d07985ed85
1
CHANGES
1
CHANGES
@ -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)
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user