Fix whitespace / line length issues reported by "make test"

This commit is contained in:
Jonathan Waltman 2012-11-03 11:04:32 -05:00
parent e1209ecd90
commit 55b28b0198
7 changed files with 18 additions and 15 deletions

View File

@ -13,14 +13,14 @@ somewhere on the web. The intent is similar to the
``sphinx.ext.viewcode`` extension, but assumes the source code can be ``sphinx.ext.viewcode`` extension, but assumes the source code can be
found somewhere on the Internet. found somewhere on the Internet.
In your configuration, you need to specify a :confval:`linkcode_resolve` In your configuration, you need to specify a :confval:`linkcode_resolve`
function that returns an URL based on the object. function that returns an URL based on the object.
.. confval:: linkcode_resolve .. confval:: linkcode_resolve
This is a function ``linkcode_resolve(domain, info)``, This is a function ``linkcode_resolve(domain, info)``,
which should return the URL to source code corresponding to which should return the URL to source code corresponding to
the object in given domain with given information. the object in given domain with given information.
The function should return ``None`` if no link is to be added. The function should return ``None`` if no link is to be added.
@ -40,7 +40,7 @@ function that returns an URL based on the object.
def linkcode_resolve(domain, info): def linkcode_resolve(domain, info):
if domain != 'py': if domain != 'py':
return None return None
if not info['module']: if not info['module']:
return None return None
filename = info['module'].replace('.', '/') filename = info['module'].replace('.', '/')
return "http://somesite/sourcerepo/%s.py" % filename return "http://somesite/sourcerepo/%s.py" % filename

View File

@ -102,7 +102,8 @@ class CheckExternalLinksBuilder(Builder):
def check(): def check():
# check for various conditions without bothering the network # check for various conditions without bothering the network
if len(uri) == 0 or uri[0] == '#' or uri[0:7] == 'mailto:' or uri[0:4] == 'ftp:': if len(uri) == 0 or uri[0] == '#' or \
uri[0:7] == 'mailto:' or uri[0:4] == 'ftp:':
return 'unchecked', '' return 'unchecked', ''
elif not (uri[0:5] == 'http:' or uri[0:6] == 'https:'): elif not (uri[0:5] == 'http:' or uri[0:6] == 'https:'):
return 'local', '' return 'local', ''

View File

@ -125,7 +125,7 @@ def render_dot(self, code, options, format, prefix='graphviz'):
str(self.builder.config.graphviz_dot) + \ str(self.builder.config.graphviz_dot) + \
str(self.builder.config.graphviz_dot_args) str(self.builder.config.graphviz_dot_args)
).encode('utf-8') ).encode('utf-8')
fname = '%s-%s.%s' % (prefix, sha(hashkey).hexdigest(), format) fname = '%s-%s.%s' % (prefix, sha(hashkey).hexdigest(), format)
if hasattr(self.builder, 'imgpath'): if hasattr(self.builder, 'imgpath'):
# HTML # HTML

View File

@ -401,7 +401,7 @@ help:
\t@echo " epub to make an epub" \t@echo " epub to make an epub"
\t@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" \t@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
\t@echo " latexpdf to make LaTeX files and run them through pdflatex" \t@echo " latexpdf to make LaTeX files and run them through pdflatex"
\t@echo " latexpdfja to make LaTeX files and run them through platex and dvipdfmx" \t@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
\t@echo " text to make text files" \t@echo " text to make text files"
\t@echo " man to make manual pages" \t@echo " man to make manual pages"
\t@echo " texinfo to make Texinfo files" \t@echo " texinfo to make Texinfo files"

View File

@ -44,14 +44,14 @@ def extract_messages(doctree):
"""Extract translatable messages from a document tree.""" """Extract translatable messages from a document tree."""
for node in doctree.traverse(nodes.TextElement): for node in doctree.traverse(nodes.TextElement):
# workaround: nodes.term doesn't have source, line and rawsource # workaround: nodes.term doesn't have source, line and rawsource
# It should be fixed in Docutils. There is a patch for it in Docutils # (fixed in Docutils r7495)
# tracker: https://sourceforge.net/tracker/?func=detail&aid=3548418&group_id=38414&atid=422032
if isinstance(node, nodes.term) and not node.source: if isinstance(node, nodes.term) and not node.source:
definition_list_item = node.parent definition_list_item = node.parent
if definition_list_item.line is not None: if definition_list_item.line is not None:
node.source = definition_list_item.source node.source = definition_list_item.source
node.line = definition_list_item.line - 1 node.line = definition_list_item.line - 1
node.rawsource = definition_list_item.rawsource.split("\n", 2)[0] node.rawsource = definition_list_item.\
rawsource.split("\n", 2)[0]
if not node.source: if not node.source:
continue # built-in message continue # built-in message
if isinstance(node, IGNORED_NODES): if isinstance(node, IGNORED_NODES):

View File

@ -51,7 +51,7 @@ def relative_uri(base, to):
# returns '', not 'index.html' # returns '', not 'index.html'
return '' return ''
if len(b2) == 1 and t2 == ['']: if len(b2) == 1 and t2 == ['']:
# Special case: relative_uri('f/index.html','f/') should # Special case: relative_uri('f/index.html','f/') should
# return './', not '' # return './', not ''
return '.' + SEP return '.' + SEP
return ('..' + SEP) * (len(b2)-1) + SEP.join(t2) return ('..' + SEP) * (len(b2)-1) + SEP.join(t2)

View File

@ -100,8 +100,9 @@ class LaTeXWriter(writers.Writer):
class ExtBabel(Babel): class ExtBabel(Babel):
def get_shorthandoff(self): def get_shorthandoff(self):
shortlang = self.language.split('_')[0] shortlang = self.language.split('_')[0]
if shortlang in ('de', 'ngerman', 'sl', 'slovene', 'pt', 'portuges', 'es', 'spanish', if shortlang in ('de', 'ngerman', 'sl', 'slovene', 'pt', 'portuges',
'nl', 'dutch', 'pl', 'polish', 'it', 'italian'): 'es', 'spanish', 'nl', 'dutch', 'pl', 'polish', 'it',
'italian'):
return '\\shorthandoff{"}' return '\\shorthandoff{"}'
return '' return ''
@ -217,7 +218,8 @@ class LaTeXTranslator(nodes.NodeVisitor):
# allow the user to override them all # allow the user to override them all
self.elements.update(builder.config.latex_elements) self.elements.update(builder.config.latex_elements)
if self.elements['extraclassoptions']: if self.elements['extraclassoptions']:
self.elements['classoptions'] += ',' + self.elements['extraclassoptions'] self.elements['classoptions'] += ',' + \
self.elements['extraclassoptions']
self.highlighter = highlighting.PygmentsBridge('latex', self.highlighter = highlighting.PygmentsBridge('latex',
builder.config.pygments_style, builder.config.trim_doctest_flags) builder.config.pygments_style, builder.config.trim_doctest_flags)