Skip to content

Commit

Permalink
Just pass along every attribute to the ing (except empty values)
Browse files Browse the repository at this point in the history
  • Loading branch information
gjtorikian committed Apr 12, 2014
1 parent f2f9917 commit 7a9da18
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
7 changes: 7 additions & 0 deletions lib/github/commands/foo.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

.. image:: https://scan.coverity.com/projects/621/badge.svg
:target: https://scan.coverity.com/projects/621
:alt: Coverity Scan Build Status

.. image:: https://scan.coverity.com/projects/621/badge.svg
:alt: Coverity Scan Build Status
21 changes: 11 additions & 10 deletions lib/github/commands/rest2html
Original file line number Diff line number Diff line change
Expand Up @@ -93,21 +93,22 @@ class GitHubHTMLTranslator(HTMLTranslator):
def depart_image(self, node):
uri = node['uri']
ext = os.path.splitext(uri)[1].lower()
# we need to swap RST's obj with img tags
# we need to swap RST's use of `object` with `img` tags
# see http://git.io/5me3dA
if ext == ".svg":
# preserve essential attributes
atts = {}
atts['src'] = node['uri']
atts['alt'] = node.get('alt', uri)
if 'width' in node:
atts['width'] = node['width']
if 'height' in node:
atts['height'] = node['height']

# toss off obj tag
for attribute, value in node.attributes.items():
# we have no time for empty values
if value:
if attribute == "uri":
atts['src'] = value
else:
atts[attribute] = value

# toss off `object` tag
self.body.pop()
# add on img with attributes
# add on `img` with attributes
self.body.append(self.starttag(node, 'img', **atts))
self.body.append(self.context.pop())

Expand Down

0 comments on commit 7a9da18

Please sign in to comment.