Mercurial > public > mercurial-scm > hg-stable
diff doc/rst2man.py @ 10282:08a0f04b56bd
many, many trivial check-code fixups
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 25 Jan 2010 00:05:27 -0600 |
parents | 9945a39d171f |
children | e433002acb05 |
line wrap: on
line diff
--- a/doc/rst2man.py Mon Jan 25 00:05:22 2010 -0600 +++ b/doc/rst2man.py Mon Jan 25 00:05:27 2010 -0600 @@ -112,7 +112,7 @@ class Table: def __init__(self): self._rows = [] - self._options = ['center', ] + self._options = ['center',] self._tab_char = '\t' self._coldefs = [] def new_row(self): @@ -123,7 +123,7 @@ def append_cell(self, cell_lines): """cell_lines is an array of lines""" start = 0 - if len(cell_lines)>0 and cell_lines[0] == '.sp\n': + if len(cell_lines) > 0 and cell_lines[0] == '.sp\n': start = 1 self._rows[-1].append(cell_lines[start:]) if len(self._coldefs) < len(self._rows[-1]): @@ -223,8 +223,8 @@ 'term' : ('\n.B ', '\n'), 'title_reference' : ('\\fI', '\\fP'), - 'topic-title' : ('.SS ', ), - 'sidebar-title' : ('.SS ', ), + 'topic-title' : ('.SS ',), + 'sidebar-title' : ('.SS ',), 'problematic' : ('\n.nf\n', '\n.fi\n'), } @@ -255,18 +255,18 @@ # ensure we get a ".TH" as viewers require it. self.head.append(self.header()) # filter body - for i in xrange(len(self.body)-1,0,-1): + for i in xrange(len(self.body)-1, 0, -1): # remove superfluous vertical gaps. if self.body[i] == '.sp\n': - if self.body[i-1][:4] in ('.BI ','.IP '): + if self.body[i - 1][:4] in ('.BI ','.IP '): self.body[i] = '.\n' - elif (self.body[i-1][:3] == '.B ' and - self.body[i-2][:4] == '.TP\n'): + elif (self.body[i - 1][:3] == '.B ' and + self.body[i - 2][:4] == '.TP\n'): self.body[i] = '.\n' - elif (self.body[i-1] == '\n' and - self.body[i-2][0] != '.' and - (self.body[i-3][:7] == '.TP\n.B ' - or self.body[i-3][:4] == '\n.B ') + elif (self.body[i - 1] == '\n' and + self.body[i - 2][0] != '.' and + (self.body[i - 3][:7] == '.TP\n.B ' + or self.body[i - 3][:4] == '\n.B ') ): self.body[i] = '.\n' return ''.join(self.head + self.body + self.foot) @@ -451,7 +451,7 @@ depart_caution = depart_admonition def visit_citation(self, node): - num,text = node.astext().split(None,1) + num, text = node.astext().split(None, 1) num = num.strip() self.body.append('.IP [%s] 5\n' % num) @@ -578,19 +578,18 @@ self.defs['indent'][0] % BLOCKQOUTE_INDENT, self._docinfo[name], self.defs['indent'][1], - self.defs['indent'][1], - ) ) + self.defs['indent'][1])) elif not name in skip: if name in self._docinfo_names: label = self._docinfo_names[name] else: label = self.language.labels.get(name, name) - self.body.append("\n%s: %s\n" % (label, self._docinfo[name]) ) + self.body.append("\n%s: %s\n" % (label, self._docinfo[name])) if self._docinfo['copyright']: self.body.append('.SH COPYRIGHT\n%s\n' % self._docinfo['copyright']) - self.body.append( self.comment( - 'Generated by docutils manpage writer.\n' ) ) + self.body.append(self.comment( + 'Generated by docutils manpage writer.\n')) def visit_emphasis(self, node): self.body.append(self.defs['emphasis'][0]) @@ -672,7 +671,7 @@ pass def visit_footnote(self, node): - num,text = node.astext().split(None,1) + num, text = node.astext().split(None, 1) num = num.strip() self.body.append('.IP [%s] 5\n' % self.deunicode(num)) @@ -786,7 +785,7 @@ # man 7 man argues to use ".IP" instead of ".TP" self.body.append('.IP %s %d\n' % ( self._list_char[-1].next(), - self._list_char[-1].get_width(),) ) + self._list_char[-1].get_width(),)) def depart_list_item(self, node): pass @@ -858,7 +857,7 @@ def visit_option(self, node): # each form of the option will be presented separately - if self.context[-1]>0: + if self.context[-1] > 0: self.body.append(', ') if self.context[-3] == '.BI': self.body.append('\\') @@ -877,7 +876,7 @@ def visit_option_argument(self, node): self.context[-3] = '.BI' # bold/italic alternate if node['delimiter'] != ' ': - self.body.append('\\fB%s ' % node['delimiter'] ) + self.body.append('\\fB%s ' % node['delimiter']) elif self.body[len(self.body)-1].endswith('='): # a blank only means no blank in output, just changing font self.body.append(' ')