Skip to content

Commit 7a9da18

Browse files
committed
Just pass along every attribute to the ing (except empty values)
1 parent f2f9917 commit 7a9da18

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

lib/github/commands/foo.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
.. image:: https://scan.coverity.com/projects/621/badge.svg
3+
:target: https://scan.coverity.com/projects/621
4+
:alt: Coverity Scan Build Status
5+
6+
.. image:: https://scan.coverity.com/projects/621/badge.svg
7+
:alt: Coverity Scan Build Status

lib/github/commands/rest2html

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,21 +93,22 @@ class GitHubHTMLTranslator(HTMLTranslator):
9393
def depart_image(self, node):
9494
uri = node['uri']
9595
ext = os.path.splitext(uri)[1].lower()
96-
# we need to swap RST's obj with img tags
96+
# we need to swap RST's use of `object` with `img` tags
9797
# see http://git.io/5me3dA
9898
if ext == ".svg":
9999
# preserve essential attributes
100100
atts = {}
101-
atts['src'] = node['uri']
102-
atts['alt'] = node.get('alt', uri)
103-
if 'width' in node:
104-
atts['width'] = node['width']
105-
if 'height' in node:
106-
atts['height'] = node['height']
107-
108-
# toss off obj tag
101+
for attribute, value in node.attributes.items():
102+
# we have no time for empty values
103+
if value:
104+
if attribute == "uri":
105+
atts['src'] = value
106+
else:
107+
atts[attribute] = value
108+
109+
# toss off `object` tag
109110
self.body.pop()
110-
# add on img with attributes
111+
# add on `img` with attributes
111112
self.body.append(self.starttag(node, 'img', **atts))
112113
self.body.append(self.context.pop())
113114

0 commit comments

Comments
 (0)