mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix whitespace / line length issues reported by "make test"
This commit is contained in:
parent
e1209ecd90
commit
55b28b0198
@ -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
|
||||
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.
|
||||
|
||||
.. confval:: linkcode_resolve
|
||||
|
||||
This is a function ``linkcode_resolve(domain, info)``,
|
||||
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.
|
||||
|
||||
@ -40,7 +40,7 @@ function that returns an URL based on the object.
|
||||
def linkcode_resolve(domain, info):
|
||||
if domain != 'py':
|
||||
return None
|
||||
if not info['module']:
|
||||
return None
|
||||
filename = info['module'].replace('.', '/')
|
||||
if not info['module']:
|
||||
return None
|
||||
filename = info['module'].replace('.', '/')
|
||||
return "http://somesite/sourcerepo/%s.py" % filename
|
||||
|
@ -102,7 +102,8 @@ class CheckExternalLinksBuilder(Builder):
|
||||
|
||||
def check():
|
||||
# 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', ''
|
||||
elif not (uri[0:5] == 'http:' or uri[0:6] == 'https:'):
|
||||
return 'local', ''
|
||||
|
@ -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_args)
|
||||
).encode('utf-8')
|
||||
|
||||
|
||||
fname = '%s-%s.%s' % (prefix, sha(hashkey).hexdigest(), format)
|
||||
if hasattr(self.builder, 'imgpath'):
|
||||
# HTML
|
||||
|
@ -401,7 +401,7 @@ help:
|
||||
\t@echo " epub to make an epub"
|
||||
\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 " 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 " man to make manual pages"
|
||||
\t@echo " texinfo to make Texinfo files"
|
||||
|
@ -44,14 +44,14 @@ def extract_messages(doctree):
|
||||
"""Extract translatable messages from a document tree."""
|
||||
for node in doctree.traverse(nodes.TextElement):
|
||||
# workaround: nodes.term doesn't have source, line and rawsource
|
||||
# It should be fixed in Docutils. There is a patch for it in Docutils
|
||||
# tracker: https://sourceforge.net/tracker/?func=detail&aid=3548418&group_id=38414&atid=422032
|
||||
# (fixed in Docutils r7495)
|
||||
if isinstance(node, nodes.term) and not node.source:
|
||||
definition_list_item = node.parent
|
||||
if definition_list_item.line is not None:
|
||||
node.source = definition_list_item.source
|
||||
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:
|
||||
continue # built-in message
|
||||
if isinstance(node, IGNORED_NODES):
|
||||
|
@ -51,7 +51,7 @@ def relative_uri(base, to):
|
||||
# returns '', not 'index.html'
|
||||
return ''
|
||||
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 '.' + SEP
|
||||
return ('..' + SEP) * (len(b2)-1) + SEP.join(t2)
|
||||
|
@ -100,8 +100,9 @@ class LaTeXWriter(writers.Writer):
|
||||
class ExtBabel(Babel):
|
||||
def get_shorthandoff(self):
|
||||
shortlang = self.language.split('_')[0]
|
||||
if shortlang in ('de', 'ngerman', 'sl', 'slovene', 'pt', 'portuges', 'es', 'spanish',
|
||||
'nl', 'dutch', 'pl', 'polish', 'it', 'italian'):
|
||||
if shortlang in ('de', 'ngerman', 'sl', 'slovene', 'pt', 'portuges',
|
||||
'es', 'spanish', 'nl', 'dutch', 'pl', 'polish', 'it',
|
||||
'italian'):
|
||||
return '\\shorthandoff{"}'
|
||||
return ''
|
||||
|
||||
@ -217,7 +218,8 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
||||
# allow the user to override them all
|
||||
self.elements.update(builder.config.latex_elements)
|
||||
if self.elements['extraclassoptions']:
|
||||
self.elements['classoptions'] += ',' + self.elements['extraclassoptions']
|
||||
self.elements['classoptions'] += ',' + \
|
||||
self.elements['extraclassoptions']
|
||||
|
||||
self.highlighter = highlighting.PygmentsBridge('latex',
|
||||
builder.config.pygments_style, builder.config.trim_doctest_flags)
|
||||
|
Loading…
Reference in New Issue
Block a user