diff options
-rw-r--r-- | CHANGES | 6 | ||||
-rw-r--r-- | setup.py | 1 | ||||
-rw-r--r-- | sphinx/domains/python.py | 2 | ||||
-rw-r--r-- | sphinx/domains/std.py | 8 | ||||
-rw-r--r-- | sphinx/ext/autodoc/directive.py | 4 | ||||
-rw-r--r-- | sphinx/ext/autosummary/__init__.py | 5 | ||||
-rw-r--r-- | sphinx/ext/viewcode.py | 2 | ||||
-rw-r--r-- | sphinx/locale/de/LC_MESSAGES/sphinx.mo | bin | 21590 -> 21603 bytes | |||
-rw-r--r-- | sphinx/locale/de/LC_MESSAGES/sphinx.po | 2 | ||||
-rw-r--r-- | sphinx/locale/pl/LC_MESSAGES/sphinx.mo | bin | 22452 -> 22461 bytes | |||
-rw-r--r-- | sphinx/templates/latex/latex.tex_t | 1 | ||||
-rw-r--r-- | sphinx/texinputs/sphinx.sty | 4 | ||||
-rw-r--r-- | tests/test_build_epub.py | 2 | ||||
-rw-r--r-- | tests/test_build_html.py | 7 | ||||
-rw-r--r-- | tests/test_ext_autosummary.py | 4 | ||||
-rw-r--r-- | tests/test_ext_viewcode.py | 11 |
16 files changed, 42 insertions, 17 deletions
@@ -81,6 +81,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 -------- @@ -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, diff --git a/sphinx/domains/python.py b/sphinx/domains/python.py index d63e5c747..62c0b1df4 100644 --- a/sphinx/domains/python.py +++ b/sphinx/domains/python.py @@ -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) diff --git a/sphinx/domains/std.py b/sphinx/domains/std.py index 8a334f7e5..4658c9995 100644 --- a/sphinx/domains/std.py +++ b/sphinx/domains/std.py @@ -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: diff --git a/sphinx/ext/autodoc/directive.py b/sphinx/ext/autodoc/directive.py index f050b2ac4..0e19516ad 100644 --- a/sphinx/ext/autodoc/directive.py +++ b/sphinx/ext/autodoc/directive.py @@ -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 diff --git a/sphinx/ext/autosummary/__init__.py b/sphinx/ext/autosummary/__init__.py index a942c0aac..b9cde483e 100644 --- a/sphinx/ext/autosummary/__init__.py +++ b/sphinx/ext/autosummary/__init__.py @@ -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: diff --git a/sphinx/ext/viewcode.py b/sphinx/ext/viewcode.py index 673cdf8e8..0836ed56e 100644 --- a/sphinx/ext/viewcode.py +++ b/sphinx/ext/viewcode.py @@ -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 diff --git a/sphinx/locale/de/LC_MESSAGES/sphinx.mo b/sphinx/locale/de/LC_MESSAGES/sphinx.mo Binary files differindex 90279db40..a5fc48e2c 100644 --- a/sphinx/locale/de/LC_MESSAGES/sphinx.mo +++ b/sphinx/locale/de/LC_MESSAGES/sphinx.mo diff --git a/sphinx/locale/de/LC_MESSAGES/sphinx.po b/sphinx/locale/de/LC_MESSAGES/sphinx.po index 20d62cd75..0649d7833 100644 --- a/sphinx/locale/de/LC_MESSAGES/sphinx.po +++ b/sphinx/locale/de/LC_MESSAGES/sphinx.po @@ -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" diff --git a/sphinx/locale/pl/LC_MESSAGES/sphinx.mo b/sphinx/locale/pl/LC_MESSAGES/sphinx.mo Binary files differindex 97c8bd867..03b1761b9 100644 --- a/sphinx/locale/pl/LC_MESSAGES/sphinx.mo +++ b/sphinx/locale/pl/LC_MESSAGES/sphinx.mo diff --git a/sphinx/templates/latex/latex.tex_t b/sphinx/templates/latex/latex.tex_t index 4fd8b1fec..34086b1cb 100644 --- a/sphinx/templates/latex/latex.tex_t +++ b/sphinx/templates/latex/latex.tex_t @@ -14,6 +14,7 @@ \let\sphinxpxdimen\pdfpxdimen\else\newdimen\sphinxpxdimen \fi \sphinxpxdimen=<%= pxunit %>\relax <%= passoptionstopackages %> +\PassOptionsToPackage{warn}{textcomp} <%= inputenc %> <%= utf8extra %> <%= cmappkg %> diff --git a/sphinx/texinputs/sphinx.sty b/sphinx/texinputs/sphinx.sty index 075ae408b..e323b2a5d 100644 --- a/sphinx/texinputs/sphinx.sty +++ b/sphinx/texinputs/sphinx.sty @@ -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}% diff --git a/tests/test_build_epub.py b/tests/test_build_epub.py index ef2e4d87d..3256fcb9f 100644 --- a/tests/test_build_epub.py +++ b/tests/test_build_epub.py @@ -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: diff --git a/tests/test_build_html.py b/tests/test_build_html.py index e70e0fb2f..7b4a61787 100644 --- a/tests/test_build_html.py +++ b/tests/test_build_html.py @@ -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']/" diff --git a/tests/test_ext_autosummary.py b/tests/test_ext_autosummary.py index f988195a9..3c707b65f 100644 --- a/tests/test_ext_autosummary.py +++ b/tests/test_ext_autosummary.py @@ -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 == '' diff --git a/tests/test_ext_viewcode.py b/tests/test_ext_viewcode.py index 3f6612c76..3b7dbdafc 100644 --- a/tests/test_ext_viewcode.py +++ b/tests/test_ext_viewcode.py @@ -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): |