Skip to content

Commit f34f538

Browse files
committed
pep8 compliance
1 parent 5635af3 commit f34f538

File tree

1 file changed

+31
-27
lines changed

1 file changed

+31
-27
lines changed

lib/github/commands/rest2html

+31-27
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,20 @@ SETTINGS = {
5858
'sectsubtitle_xform': True,
5959
'initial_header_level': 2,
6060
'report_level': 5,
61-
'syntax_highlight' : 'none',
62-
'math_output' : 'latex',
61+
'syntax_highlight': 'none',
62+
'math_output': 'latex',
6363
'field_name_limit': 50,
6464
}
6565

66+
6667
class GitHubHTMLTranslator(HTMLTranslator):
68+
6769
# removes the <div class="document"> tag wrapped around docs
6870
# see also: http://bit.ly/1exfq2h (warning! sourceforge link.)
6971
def depart_document(self, node):
7072
HTMLTranslator.depart_document(self, node)
71-
self.html_body.pop(0) # pop the starting <div> off
72-
self.html_body.pop() # pop the ending </div> off
73+
self.html_body.pop(0) # pop the starting <div> off
74+
self.html_body.pop() # pop the ending </div> off
7375

7476
# technique for visiting sections, without generating additional divs
7577
# see also: http://bit.ly/NHtyRx
@@ -102,36 +104,38 @@ class GitHubHTMLTranslator(HTMLTranslator):
102104
def visit_table(self, node):
103105
classes = ' '.join(['docutils', self.settings.table_style]).strip()
104106
self.body.append(
105-
self.starttag(node, 'table', CLASS=classes))
107+
self.starttag(node, 'table', CLASS=classes))
106108

107109
def depart_table(self, node):
108110
self.body.append('</table>\n')
109111

110112
def depart_image(self, node):
111-
uri = node['uri']
112-
ext = os.path.splitext(uri)[1].lower()
113-
# we need to swap RST's use of `object` with `img` tags
114-
# see http://git.io/5me3dA
115-
if ext == ".svg":
116-
# preserve essential attributes
117-
atts = {}
118-
for attribute, value in node.attributes.items():
119-
# we have no time for empty values
120-
if value:
121-
if attribute == "uri":
122-
atts['src'] = value
123-
else:
124-
atts[attribute] = value
125-
126-
# toss off `object` tag
127-
self.body.pop()
113+
uri = node['uri']
114+
ext = os.path.splitext(uri)[1].lower()
115+
# we need to swap RST's use of `object` with `img` tags
116+
# see http://git.io/5me3dA
117+
if ext == ".svg":
118+
# preserve essential attributes
119+
atts = {}
120+
for attribute, value in node.attributes.items():
121+
# we have no time for empty values
122+
if value:
123+
if attribute == "uri":
124+
atts['src'] = value
125+
else:
126+
atts[attribute] = value
127+
128+
# toss off `object` tag
129+
self.body.pop()
128130
# add on `img` with attributes
129-
self.body.append(self.starttag(node, 'img', **atts))
130-
self.body.append(self.context.pop())
131+
self.body.append(self.starttag(node, 'img', **atts))
132+
self.body.append(self.context.pop())
133+
131134

132135
def kbd(name, rawtext, text, lineno, inliner, options=None, content=None):
133136

134-
return [nodes.raw('', '<kbd>%s</kbd>' % text, format='html')], []
137+
return [nodes.raw('', '<kbd>%s</kbd>' % text, format='html')], []
138+
135139

136140
def main():
137141
"""
@@ -143,9 +147,9 @@ def main():
143147
"""
144148
try:
145149
text = codecs.open(sys.argv[1], 'r', 'utf-8').read()
146-
except IOError: # given filename could not be found
150+
except IOError: # given filename could not be found
147151
return ''
148-
except IndexError: # no filename given
152+
except IndexError: # no filename given
149153
text = sys.stdin.read()
150154

151155
writer = Writer()

0 commit comments

Comments
 (0)