mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge commit '6694981dd6939ab876b27d4e20a8128561c307ac'
This commit is contained in:
commit
4cebc4399c
6
CHANGES
6
CHANGES
@ -79,6 +79,12 @@ Bugs fixed
|
||||
|
||||
* #4669: sphinx.build_main and sphinx.make_main throw NameError
|
||||
* #4685: autosummary emits meaningless warnings
|
||||
* autodoc: crashed when invalid options given
|
||||
* pydomain: always strip parenthesis if empty (refs: #1042)
|
||||
* #4689: autosummary: unexpectedly strips docstrings containing "i.e."
|
||||
* #4701: viewcode: Misplaced ``<div>`` in viewcode html output
|
||||
* #4444: Don't require numfig to use :numref: on sections
|
||||
* #4727: Option clash for package textcomp
|
||||
|
||||
Testing
|
||||
--------
|
||||
|
1
setup.py
1
setup.py
@ -222,6 +222,7 @@ setup(
|
||||
'build_sphinx = sphinx.setup_command:BuildDoc',
|
||||
],
|
||||
},
|
||||
python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
|
||||
install_requires=install_requires,
|
||||
extras_require=extras_require,
|
||||
cmdclass=cmdclass,
|
||||
|
@ -39,7 +39,7 @@ logger = logging.getLogger(__name__)
|
||||
py_sig_re = re.compile(
|
||||
r'''^ ([\w.]*\.)? # class name(s)
|
||||
(\w+) \s* # thing name
|
||||
(?: \((.*)\) # optional: arguments
|
||||
(?: \(\s*(.*)\s*\) # optional: arguments
|
||||
(?:\s* -> \s* (.*))? # return annotation
|
||||
)? $ # and nothing more
|
||||
''', re.VERBOSE)
|
||||
|
@ -725,15 +725,15 @@ class StandardDomain(Domain):
|
||||
if not docname:
|
||||
return None
|
||||
|
||||
if env.config.numfig is False:
|
||||
logger.warning(__('numfig is disabled. :numref: is ignored.'), location=node)
|
||||
return contnode
|
||||
|
||||
target_node = env.get_doctree(docname).ids.get(labelid)
|
||||
figtype = self.get_figtype(target_node)
|
||||
if figtype is None:
|
||||
return None
|
||||
|
||||
if figtype != 'section' and env.config.numfig is False:
|
||||
logger.warning(__('numfig is disabled. :numref: is ignored.'), location=node)
|
||||
return contnode
|
||||
|
||||
try:
|
||||
fignumber = self.get_fignumber(env, builder, figtype, docname, target_node)
|
||||
if fignumber is None:
|
||||
|
@ -58,7 +58,7 @@ class DocumenterBridge(object):
|
||||
|
||||
def warn(self, msg):
|
||||
# type: (unicode) -> None
|
||||
logger.warning(msg, line=self.lineno)
|
||||
logger.warning(msg, location=(self.env.docname, self.lineno))
|
||||
|
||||
|
||||
def process_documenter_options(documenter, config, options):
|
||||
@ -125,7 +125,7 @@ class AutodocDirective(Directive):
|
||||
except (KeyError, ValueError, TypeError) as exc:
|
||||
# an option is either unknown or has a wrong type
|
||||
logger.error('An option to %s is either unknown or has an invalid value: %s' %
|
||||
(self.name, exc), line=lineno)
|
||||
(self.name, exc), location=(source, lineno))
|
||||
return []
|
||||
|
||||
# generate the output
|
||||
|
@ -91,6 +91,9 @@ if TYPE_CHECKING:
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
periods_re = re.compile('\.(?:\s+)')
|
||||
|
||||
|
||||
# -- autosummary_toc node ------------------------------------------------------
|
||||
|
||||
class autosummary_toc(nodes.comment):
|
||||
@ -469,7 +472,7 @@ def extract_summary(doc, document):
|
||||
break
|
||||
|
||||
# Try to find the "first sentence", which may span multiple lines
|
||||
sentences = " ".join(doc).split('.')
|
||||
sentences = periods_re.split(" ".join(doc)) # type: ignore
|
||||
if len(sentences) == 1:
|
||||
summary = sentences[0].strip()
|
||||
else:
|
||||
|
@ -178,7 +178,7 @@ def collect_pages(app):
|
||||
'<div class="viewcode-block" id="%s"><a class="viewcode-back" '
|
||||
'href="%s">%s</a>' % (name, backlink, _('[docs]')) +
|
||||
lines[start])
|
||||
lines[min(end - 1, maxindex)] += '</div>'
|
||||
lines[min(end, maxindex)] += '</div>'
|
||||
# try to find parents (for submodules)
|
||||
parents = []
|
||||
parent = modname
|
||||
|
Binary file not shown.
@ -1331,7 +1331,7 @@ msgstr "Release"
|
||||
|
||||
#: sphinx/writers/latex.py:714
|
||||
msgid "continues on next page"
|
||||
msgstr ""
|
||||
msgstr "Fortsetzung auf der nächsten Seite"
|
||||
|
||||
#: sphinx/writers/latex.py:718
|
||||
msgid "page"
|
||||
|
Binary file not shown.
@ -14,6 +14,7 @@
|
||||
\let\sphinxpxdimen\pdfpxdimen\else\newdimen\sphinxpxdimen
|
||||
\fi \sphinxpxdimen=<%= pxunit %>\relax
|
||||
<%= passoptionstopackages %>
|
||||
\PassOptionsToPackage{warn}{textcomp}
|
||||
<%= inputenc %>
|
||||
<%= utf8extra %>
|
||||
<%= cmappkg %>
|
||||
|
@ -6,7 +6,7 @@
|
||||
%
|
||||
|
||||
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
|
||||
\ProvidesPackage{sphinx}[2017/12/12 v1.7 LaTeX package (Sphinx markup)]
|
||||
\ProvidesPackage{sphinx}[2018/03/11 v1.7.2 LaTeX package (Sphinx markup)]
|
||||
|
||||
% provides \ltx@ifundefined
|
||||
% (many packages load ltxcmds: graphicx does for pdftex and lualatex but
|
||||
@ -39,7 +39,7 @@
|
||||
\@ifclassloaded{memoir}{}{\RequirePackage{fancyhdr}}
|
||||
% for \text macro and \iffirstchoice@ conditional even if amsmath not loaded
|
||||
\RequirePackage{amstext}
|
||||
\RequirePackage[warn]{textcomp}
|
||||
\RequirePackage{textcomp}% "warn" option issued from template
|
||||
\RequirePackage{titlesec}
|
||||
\@ifpackagelater{titlesec}{2016/03/15}%
|
||||
{\@ifpackagelater{titlesec}{2016/03/21}%
|
||||
|
@ -267,7 +267,7 @@ def test_run_epubcheck(app):
|
||||
|
||||
epubcheck = os.environ.get('EPUBCHECK_PATH', '/usr/share/java/epubcheck.jar')
|
||||
if runnable('java') and os.path.exists(epubcheck):
|
||||
p = Popen(['java', '-jar', epubcheck, app.outdir / 'Sphinx.epub'],
|
||||
p = Popen(['java', '-jar', epubcheck, app.outdir / 'SphinxTests.epub'],
|
||||
stdout=PIPE, stderr=PIPE)
|
||||
stdout, stderr = p.communicate()
|
||||
if p.returncode != 0:
|
||||
|
@ -506,7 +506,6 @@ def test_numfig_disabled_warn(app, warning):
|
||||
app.build()
|
||||
warnings = warning.getvalue()
|
||||
assert 'index.rst:47: WARNING: numfig is disabled. :numref: is ignored.' in warnings
|
||||
assert 'index.rst:55: WARNING: no number is assigned for section: index' not in warnings
|
||||
assert 'index.rst:56: WARNING: invalid numfig_format: invalid' not in warnings
|
||||
assert 'index.rst:57: WARNING: invalid numfig_format: Fig %s %s' not in warnings
|
||||
|
||||
@ -524,10 +523,10 @@ def test_numfig_disabled_warn(app, warning):
|
||||
(".//li/code/span", '^Table:%s$', True),
|
||||
(".//li/code/span", '^CODE_1$', True),
|
||||
(".//li/code/span", '^Code-%s$', True),
|
||||
(".//li/code/span", '^foo$', True),
|
||||
(".//li/code/span", '^bar_a$', True),
|
||||
(".//li/a/span", '^Section 1$', True),
|
||||
(".//li/a/span", '^Section 2.1$', True),
|
||||
(".//li/code/span", '^Fig.{number}$', True),
|
||||
(".//li/code/span", '^Sect.{number}$', True),
|
||||
(".//li/a/span", '^Sect.1 Foo$', True),
|
||||
],
|
||||
'foo.html': [
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
|
@ -77,6 +77,10 @@ def test_extract_summary(capsys):
|
||||
'it does not break sentence.']
|
||||
assert extract_summary(doc, document) == ' '.join(doc)
|
||||
|
||||
# abbreviations
|
||||
doc = ['Blabla, i.e. bla.']
|
||||
assert extract_summary(doc, document) == 'Blabla, i.e.'
|
||||
|
||||
_, err = capsys.readouterr()
|
||||
assert err == ''
|
||||
|
||||
|
@ -38,6 +38,17 @@ def test_viewcode(app, status, warning):
|
||||
# the next assert fails, until the autodoc bug gets fixed
|
||||
assert result.count('this is the class attribute class_attr') == 2
|
||||
|
||||
result = (app.outdir / '_modules/spam/mod1.html').text(encoding='utf-8')
|
||||
result = re.sub('<span class=".*?">', '<span>', result) # filter pygments classes
|
||||
assert ('<div class="viewcode-block" id="Class1"><a class="viewcode-back" '
|
||||
'href="../../index.html#spam.Class1">[docs]</a>'
|
||||
'<span>@decorator</span>\n'
|
||||
'<span>class</span> <span>Class1</span>'
|
||||
'<span>(</span><span>object</span><span>):</span>\n'
|
||||
' <span>"""</span>\n'
|
||||
'<span> this is Class1</span>\n'
|
||||
'<span> """</span></div>\n') in result
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='ext-viewcode', tags=['test_linkcode'])
|
||||
def test_linkcode(app, status, warning):
|
||||
|
Loading…
Reference in New Issue
Block a user