mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #2763, add default alt attribute to svg images
Add uri as default alt attribute to images in svg format
This commit is contained in:
parent
3807eda6df
commit
edfdd3ec78
@ -458,15 +458,14 @@ class HTMLTranslator(BaseTranslator):
|
|||||||
node['uri'] = posixpath.join(self.builder.imgpath,
|
node['uri'] = posixpath.join(self.builder.imgpath,
|
||||||
self.builder.images[olduri])
|
self.builder.images[olduri])
|
||||||
|
|
||||||
if node['uri'].lower().endswith('svg') or \
|
uri = node['uri']
|
||||||
node['uri'].lower().endswith('svgz'):
|
if uri.lower().endswith('svg') or uri.lower().endswith('svgz'):
|
||||||
atts = {'src': node['uri']}
|
atts = {'src': uri}
|
||||||
if 'width' in node:
|
if 'width' in node:
|
||||||
atts['width'] = node['width']
|
atts['width'] = node['width']
|
||||||
if 'height' in node:
|
if 'height' in node:
|
||||||
atts['height'] = node['height']
|
atts['height'] = node['height']
|
||||||
if 'alt' in node:
|
atts['alt'] = node.get('alt', uri)
|
||||||
atts['alt'] = node['alt']
|
|
||||||
if 'align' in node:
|
if 'align' in node:
|
||||||
self.body.append('<div align="%s" class="align-%s">' %
|
self.body.append('<div align="%s" class="align-%s">' %
|
||||||
(node['align'], node['align']))
|
(node['align'], node['align']))
|
||||||
|
Loading…
Reference in New Issue
Block a user