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,
|
||||
self.builder.images[olduri])
|
||||
|
||||
if node['uri'].lower().endswith('svg') or \
|
||||
node['uri'].lower().endswith('svgz'):
|
||||
atts = {'src': node['uri']}
|
||||
uri = node['uri']
|
||||
if uri.lower().endswith('svg') or uri.lower().endswith('svgz'):
|
||||
atts = {'src': uri}
|
||||
if 'width' in node:
|
||||
atts['width'] = node['width']
|
||||
if 'height' in node:
|
||||
atts['height'] = node['height']
|
||||
if 'alt' in node:
|
||||
atts['alt'] = node['alt']
|
||||
atts['alt'] = node.get('alt', uri)
|
||||
if 'align' in node:
|
||||
self.body.append('<div align="%s" class="align-%s">' %
|
||||
(node['align'], node['align']))
|
||||
|
Loading…
Reference in New Issue
Block a user