mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge branch '1.8'
This commit is contained in:
commit
342de4f0fd
24
CHANGES
24
CHANGES
@ -43,6 +43,9 @@ Dependencies
|
|||||||
Incompatible changes
|
Incompatible changes
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
|
* #5282: html theme: refer ``pygments_style`` settings of HTML themes
|
||||||
|
preferentially
|
||||||
|
|
||||||
Deprecated
|
Deprecated
|
||||||
----------
|
----------
|
||||||
|
|
||||||
@ -60,6 +63,10 @@ Bugs fixed
|
|||||||
* #5325: latex: cross references has been broken by multiply labeled objects
|
* #5325: latex: cross references has been broken by multiply labeled objects
|
||||||
* C++, fixes for symbol addition and lookup. Lookup should no longer break
|
* C++, fixes for symbol addition and lookup. Lookup should no longer break
|
||||||
in partial builds. See also #5337.
|
in partial builds. See also #5337.
|
||||||
|
* #5348: download reference to remote file is not displayed
|
||||||
|
* #5282: html theme: ``pygments_style`` of theme was overrided by ``conf.py``
|
||||||
|
by default
|
||||||
|
* #4379: toctree shows confusible warning when document is excluded
|
||||||
|
|
||||||
Testing
|
Testing
|
||||||
--------
|
--------
|
||||||
@ -313,8 +320,8 @@ Documentation
|
|||||||
* #5083: Fix wrong make.bat option for internationalization.
|
* #5083: Fix wrong make.bat option for internationalization.
|
||||||
* #5115: napoleon: add admonitions added by #4613 to the docs.
|
* #5115: napoleon: add admonitions added by #4613 to the docs.
|
||||||
|
|
||||||
Release 1.7.9 (in development)
|
Release 1.7.10 (in development)
|
||||||
==============================
|
===============================
|
||||||
|
|
||||||
Dependencies
|
Dependencies
|
||||||
------------
|
------------
|
||||||
@ -334,6 +341,19 @@ Bugs fixed
|
|||||||
Testing
|
Testing
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
Release 1.7.9 (released Sep 05, 2018)
|
||||||
|
=====================================
|
||||||
|
|
||||||
|
Features added
|
||||||
|
--------------
|
||||||
|
|
||||||
|
* #5359: Make generated texinfo files reproducible by sorting the anchors
|
||||||
|
|
||||||
|
Bugs fixed
|
||||||
|
----------
|
||||||
|
|
||||||
|
* #5361: crashed on incremental build if document uses include directive
|
||||||
|
|
||||||
Release 1.7.8 (released Aug 29, 2018)
|
Release 1.7.8 (released Aug 29, 2018)
|
||||||
=====================================
|
=====================================
|
||||||
|
|
||||||
|
@ -208,6 +208,8 @@ The following variables available in the templates:
|
|||||||
List containing names of all inherited members of class. Only available for
|
List containing names of all inherited members of class. Only available for
|
||||||
classes.
|
classes.
|
||||||
|
|
||||||
|
.. versionadded:: 1.8.0
|
||||||
|
|
||||||
.. data:: functions
|
.. data:: functions
|
||||||
|
|
||||||
List containing names of "public" functions in the module. Here, "public"
|
List containing names of "public" functions in the module. Here, "public"
|
||||||
|
@ -22,7 +22,7 @@ from sphinx.domains.changeset import VersionChange # NOQA # for compatibility
|
|||||||
from sphinx.locale import _
|
from sphinx.locale import _
|
||||||
from sphinx.util import url_re, docname_join
|
from sphinx.util import url_re, docname_join
|
||||||
from sphinx.util.docutils import SphinxDirective
|
from sphinx.util.docutils import SphinxDirective
|
||||||
from sphinx.util.matching import patfilter
|
from sphinx.util.matching import Matcher, patfilter
|
||||||
from sphinx.util.nodes import explicit_title_re, set_source_info, \
|
from sphinx.util.nodes import explicit_title_re, set_source_info, \
|
||||||
process_index_entry
|
process_index_entry
|
||||||
|
|
||||||
@ -96,6 +96,7 @@ class TocTree(SphinxDirective):
|
|||||||
all_docnames.remove(self.env.docname) # remove current document
|
all_docnames.remove(self.env.docname) # remove current document
|
||||||
|
|
||||||
ret = []
|
ret = []
|
||||||
|
excluded = Matcher(self.config.exclude_patterns)
|
||||||
for entry in self.content:
|
for entry in self.content:
|
||||||
if not entry:
|
if not entry:
|
||||||
continue
|
continue
|
||||||
@ -131,9 +132,13 @@ class TocTree(SphinxDirective):
|
|||||||
if url_re.match(ref) or ref == 'self':
|
if url_re.match(ref) or ref == 'self':
|
||||||
toctree['entries'].append((title, ref))
|
toctree['entries'].append((title, ref))
|
||||||
elif docname not in self.env.found_docs:
|
elif docname not in self.env.found_docs:
|
||||||
ret.append(self.state.document.reporter.warning(
|
if excluded(self.env.doc2path(docname, None)):
|
||||||
'toctree contains reference to nonexisting '
|
message = 'toctree contains reference to excluded document %r'
|
||||||
'document %r' % docname, line=self.lineno))
|
else:
|
||||||
|
message = 'toctree contains reference to nonexisting document %r'
|
||||||
|
|
||||||
|
ret.append(self.state.document.reporter.warning(message % docname,
|
||||||
|
line=self.lineno))
|
||||||
self.env.note_reread()
|
self.env.note_reread()
|
||||||
else:
|
else:
|
||||||
all_docnames.discard(docname)
|
all_docnames.discard(docname)
|
||||||
|
@ -17,7 +17,7 @@ from copy import copy
|
|||||||
from os import path
|
from os import path
|
||||||
|
|
||||||
from six import BytesIO, next
|
from six import BytesIO, next
|
||||||
from six.moves import cPickle as pickle, reduce
|
from six.moves import cPickle as pickle
|
||||||
|
|
||||||
from sphinx import addnodes
|
from sphinx import addnodes
|
||||||
from sphinx.deprecation import RemovedInSphinx30Warning
|
from sphinx.deprecation import RemovedInSphinx30Warning
|
||||||
@ -64,7 +64,7 @@ default_settings = {
|
|||||||
# or changed to properly invalidate pickle files.
|
# or changed to properly invalidate pickle files.
|
||||||
#
|
#
|
||||||
# NOTE: increase base version by 2 to have distinct numbers for Py2 and 3
|
# NOTE: increase base version by 2 to have distinct numbers for Py2 and 3
|
||||||
ENV_VERSION = 53 + (sys.version_info[0] - 2)
|
ENV_VERSION = 54 + (sys.version_info[0] - 2)
|
||||||
|
|
||||||
# config status
|
# config status
|
||||||
CONFIG_OK = 1
|
CONFIG_OK = 1
|
||||||
@ -662,7 +662,7 @@ class BuildEnvironment(object):
|
|||||||
def check_consistency(self):
|
def check_consistency(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
"""Do consistency checks."""
|
"""Do consistency checks."""
|
||||||
included = reduce(lambda x, y: x | y, self.included.values(), set()) # type: Set[unicode] # NOQA
|
included = set().union(*self.included.values()) # type: ignore
|
||||||
for docname in sorted(self.all_docs):
|
for docname in sorted(self.all_docs):
|
||||||
if docname not in self.files_to_rebuild:
|
if docname not in self.files_to_rebuild:
|
||||||
if docname == self.config.master_doc:
|
if docname == self.config.master_doc:
|
||||||
|
@ -15,6 +15,7 @@ from six import iteritems
|
|||||||
from sphinx import addnodes
|
from sphinx import addnodes
|
||||||
from sphinx.locale import __
|
from sphinx.locale import __
|
||||||
from sphinx.util import url_re, logging
|
from sphinx.util import url_re, logging
|
||||||
|
from sphinx.util.matching import Matcher
|
||||||
from sphinx.util.nodes import clean_astext, process_only_nodes
|
from sphinx.util.nodes import clean_astext, process_only_nodes
|
||||||
|
|
||||||
if False:
|
if False:
|
||||||
@ -83,6 +84,7 @@ class TocTree(object):
|
|||||||
# interactions between marking and pruning the tree (see bug #1046).
|
# interactions between marking and pruning the tree (see bug #1046).
|
||||||
|
|
||||||
toctree_ancestors = self.get_toctree_ancestors(docname)
|
toctree_ancestors = self.get_toctree_ancestors(docname)
|
||||||
|
excluded = Matcher(self.env.config.exclude_patterns)
|
||||||
|
|
||||||
def _toctree_add_classes(node, depth):
|
def _toctree_add_classes(node, depth):
|
||||||
# type: (nodes.Node, int) -> None
|
# type: (nodes.Node, int) -> None
|
||||||
@ -172,8 +174,12 @@ class TocTree(object):
|
|||||||
ref, location=toctreenode)
|
ref, location=toctreenode)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
# this is raised if the included file does not exist
|
# this is raised if the included file does not exist
|
||||||
logger.warning(__('toctree contains reference to nonexisting document %r'),
|
if excluded(self.env.doc2path(ref, None)):
|
||||||
ref, location=toctreenode)
|
message = __('toctree contains reference to excluded document %r')
|
||||||
|
else:
|
||||||
|
message = __('toctree contains reference to nonexisting document %r')
|
||||||
|
|
||||||
|
logger.warning(message, ref, location=toctreenode)
|
||||||
else:
|
else:
|
||||||
# if titles_only is given, only keep the main title and
|
# if titles_only is given, only keep the main title and
|
||||||
# sub-toctrees
|
# sub-toctrees
|
||||||
|
@ -128,6 +128,9 @@ class DownloadFileCollector(EnvironmentCollector):
|
|||||||
"""Process downloadable file paths. """
|
"""Process downloadable file paths. """
|
||||||
for node in doctree.traverse(addnodes.download_reference):
|
for node in doctree.traverse(addnodes.download_reference):
|
||||||
targetname = node['reftarget']
|
targetname = node['reftarget']
|
||||||
|
if '://' in targetname:
|
||||||
|
node['refuri'] = targetname
|
||||||
|
else:
|
||||||
rel_filename, filename = app.env.relfn2path(targetname, app.env.docname)
|
rel_filename, filename = app.env.relfn2path(targetname, app.env.docname)
|
||||||
app.env.dependencies[app.env.docname].add(rel_filename)
|
app.env.dependencies[app.env.docname].add(rel_filename)
|
||||||
if not os.access(filename, os.R_OK):
|
if not os.access(filename, os.R_OK):
|
||||||
|
@ -79,6 +79,7 @@ from sphinx.util import import_object, rst, logging
|
|||||||
from sphinx.util.docutils import (
|
from sphinx.util.docutils import (
|
||||||
NullReporter, SphinxDirective, new_document, switch_source_input
|
NullReporter, SphinxDirective, new_document, switch_source_input
|
||||||
)
|
)
|
||||||
|
from sphinx.util.matching import Matcher
|
||||||
|
|
||||||
if False:
|
if False:
|
||||||
# For type annotation
|
# For type annotation
|
||||||
@ -249,10 +250,15 @@ class Autosummary(SphinxDirective):
|
|||||||
|
|
||||||
tree_prefix = self.options['toctree'].strip()
|
tree_prefix = self.options['toctree'].strip()
|
||||||
docnames = []
|
docnames = []
|
||||||
|
excluded = Matcher(self.config.exclude_patterns)
|
||||||
for name, sig, summary, real_name in items:
|
for name, sig, summary, real_name in items:
|
||||||
docname = posixpath.join(tree_prefix, real_name)
|
docname = posixpath.join(tree_prefix, real_name)
|
||||||
docname = posixpath.normpath(posixpath.join(dirname, docname))
|
docname = posixpath.normpath(posixpath.join(dirname, docname))
|
||||||
if docname not in self.env.found_docs:
|
if docname not in self.env.found_docs:
|
||||||
|
if excluded(self.env.doc2path(docname, None)):
|
||||||
|
self.warn('toctree references excluded document %r'
|
||||||
|
% docname)
|
||||||
|
else:
|
||||||
self.warn('toctree references unknown document %r'
|
self.warn('toctree references unknown document %r'
|
||||||
% docname)
|
% docname)
|
||||||
docnames.append(docname)
|
docnames.append(docname)
|
||||||
|
@ -78,7 +78,7 @@ language = {{ language | repr }}
|
|||||||
exclude_patterns = [{{ exclude_patterns }}]
|
exclude_patterns = [{{ exclude_patterns }}]
|
||||||
|
|
||||||
# The name of the Pygments (syntax highlighting) style to use.
|
# The name of the Pygments (syntax highlighting) style to use.
|
||||||
pygments_style = 'sphinx'
|
pygments_style = None
|
||||||
|
|
||||||
|
|
||||||
# -- Options for HTML output -------------------------------------------------
|
# -- Options for HTML output -------------------------------------------------
|
||||||
|
@ -564,10 +564,20 @@ class HTMLTranslator(BaseTranslator):
|
|||||||
|
|
||||||
def visit_download_reference(self, node):
|
def visit_download_reference(self, node):
|
||||||
# type: (nodes.Node) -> None
|
# type: (nodes.Node) -> None
|
||||||
if self.builder.download_support and node.hasattr('filename'):
|
atts = {'class': 'reference download',
|
||||||
self.body.append(
|
'download': ''}
|
||||||
'<a class="reference download internal" href="%s" download="">' %
|
|
||||||
posixpath.join(self.builder.dlpath, node['filename']))
|
if not self.builder.download_support:
|
||||||
|
self.context.append('')
|
||||||
|
elif 'refuri' in node:
|
||||||
|
atts['class'] += ' external'
|
||||||
|
atts['href'] = node['refuri']
|
||||||
|
self.body.append(self.starttag(node, 'a', '', **atts))
|
||||||
|
self.context.append('</a>')
|
||||||
|
elif 'filename' in node:
|
||||||
|
atts['class'] += ' internal'
|
||||||
|
atts['href'] = posixpath.join(self.builder.dlpath, node['filename'])
|
||||||
|
self.body.append(self.starttag(node, 'a', '', **atts))
|
||||||
self.context.append('</a>')
|
self.context.append('</a>')
|
||||||
else:
|
else:
|
||||||
self.context.append('')
|
self.context.append('')
|
||||||
|
@ -510,10 +510,20 @@ class HTML5Translator(BaseTranslator):
|
|||||||
|
|
||||||
def visit_download_reference(self, node):
|
def visit_download_reference(self, node):
|
||||||
# type: (nodes.Node) -> None
|
# type: (nodes.Node) -> None
|
||||||
if self.builder.download_support and node.hasattr('filename'):
|
atts = {'class': 'reference download',
|
||||||
self.body.append(
|
'download': ''}
|
||||||
'<a class="reference download internal" href="%s" download="">' %
|
|
||||||
posixpath.join(self.builder.dlpath, node['filename']))
|
if not self.builder.download_support:
|
||||||
|
self.context.append('')
|
||||||
|
elif 'refuri' in node:
|
||||||
|
atts['class'] += ' external'
|
||||||
|
atts['href'] = node['refuri']
|
||||||
|
self.body.append(self.starttag(node, 'a', '', **atts))
|
||||||
|
self.context.append('</a>')
|
||||||
|
elif 'filename' in node:
|
||||||
|
atts['class'] += ' internal'
|
||||||
|
atts['href'] = posixpath.join(self.builder.dlpath, node['filename'])
|
||||||
|
self.body.append(self.starttag(node, 'a', '', **atts))
|
||||||
self.context.append('</a>')
|
self.context.append('</a>')
|
||||||
else:
|
else:
|
||||||
self.context.append('')
|
self.context.append('')
|
||||||
|
@ -612,7 +612,7 @@ class TexinfoTranslator(nodes.NodeVisitor):
|
|||||||
node_name = node['node_name']
|
node_name = node['node_name']
|
||||||
pointers = tuple([node_name] + self.rellinks[node_name])
|
pointers = tuple([node_name] + self.rellinks[node_name])
|
||||||
self.body.append('\n@node %s,%s,%s,%s\n' % pointers) # type: ignore
|
self.body.append('\n@node %s,%s,%s,%s\n' % pointers) # type: ignore
|
||||||
for id in self.next_section_ids:
|
for id in sorted(self.next_section_ids):
|
||||||
self.add_anchor(id, node)
|
self.add_anchor(id, node)
|
||||||
|
|
||||||
self.next_section_ids.clear()
|
self.next_section_ids.clear()
|
||||||
|
7
tests/roots/test-roles-download/conf.py
Normal file
7
tests/roots/test-roles-download/conf.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
master_doc = 'index'
|
||||||
|
|
||||||
|
latex_documents = [
|
||||||
|
(master_doc, 'test.tex', 'The basic Sphinx documentation for testing', 'Sphinx', 'report')
|
||||||
|
]
|
0
tests/roots/test-roles-download/dummy.dat
Normal file
0
tests/roots/test-roles-download/dummy.dat
Normal file
6
tests/roots/test-roles-download/index.rst
Normal file
6
tests/roots/test-roles-download/index.rst
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
test-roles-download
|
||||||
|
===================
|
||||||
|
|
||||||
|
* :download:`dummy.dat`
|
||||||
|
* :download:`not_found.dat`
|
||||||
|
* :download:`Sphinx logo <http://www.sphinx-doc.org/en/master/_static/sphinxheader.png>`
|
@ -354,6 +354,22 @@ def test_epub_css_files(app):
|
|||||||
'href="https://example.com/custom.css" />' not in content)
|
'href="https://example.com/custom.css" />' not in content)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.sphinx('epub', testroot='roles-download')
|
||||||
|
def test_html_download_role(app, status, warning):
|
||||||
|
app.build()
|
||||||
|
assert not (app.outdir / '_downloads' / 'dummy.dat').exists()
|
||||||
|
|
||||||
|
content = (app.outdir / 'index.xhtml').text()
|
||||||
|
assert ('<li><p><code class="xref download docutils literal notranslate">'
|
||||||
|
'<span class="pre">dummy.dat</span></code></p></li>' in content)
|
||||||
|
assert ('<li><p><code class="xref download docutils literal notranslate">'
|
||||||
|
'<span class="pre">not_found.dat</span></code></p></li>' in content)
|
||||||
|
assert ('<li><p><code class="xref download docutils literal notranslate">'
|
||||||
|
'<span class="pre">Sphinx</span> <span class="pre">logo</span></code>'
|
||||||
|
'<span class="link-target"> [http://www.sphinx-doc.org/en/master'
|
||||||
|
'/_static/sphinxheader.png]</span></p></li>' in content)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.sphinx('epub')
|
@pytest.mark.sphinx('epub')
|
||||||
def test_run_epubcheck(app):
|
def test_run_epubcheck(app):
|
||||||
app.build()
|
app.build()
|
||||||
|
@ -1387,3 +1387,23 @@ def test_html_math_renderer_is_mismatched(make_app, app_params):
|
|||||||
assert False
|
assert False
|
||||||
except ConfigError as exc:
|
except ConfigError as exc:
|
||||||
assert str(exc) == "Unknown math_renderer 'imgmath' is given."
|
assert str(exc) == "Unknown math_renderer 'imgmath' is given."
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.sphinx('html', testroot='basic')
|
||||||
|
def test_html_pygments_style_default(app):
|
||||||
|
style = app.builder.highlighter.formatter_args.get('style')
|
||||||
|
assert style.__name__ == 'Alabaster'
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.sphinx('html', testroot='basic',
|
||||||
|
confoverrides={'pygments_style': 'sphinx'})
|
||||||
|
def test_html_pygments_style_manually(app):
|
||||||
|
style = app.builder.highlighter.formatter_args.get('style')
|
||||||
|
assert style.__name__ == 'SphinxStyle'
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.sphinx('html', testroot='basic',
|
||||||
|
confoverrides={'html_theme': 'classic'})
|
||||||
|
def test_html_pygments_for_classic_theme(app):
|
||||||
|
style = app.builder.highlighter.formatter_args.get('style')
|
||||||
|
assert style.__name__ == 'SphinxStyle'
|
||||||
|
@ -321,3 +321,23 @@ def test_html5_output(app, cached_etree_parse, fname, expect):
|
|||||||
app.build()
|
app.build()
|
||||||
print(app.outdir / fname)
|
print(app.outdir / fname)
|
||||||
check_xpath(cached_etree_parse(app.outdir / fname), fname, *expect)
|
check_xpath(cached_etree_parse(app.outdir / fname), fname, *expect)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.sphinx('html', testroot='roles-download',
|
||||||
|
confoverrides={'html_experimental_html5_writer': True})
|
||||||
|
def test_html_download_role(app, status, warning):
|
||||||
|
app.build()
|
||||||
|
assert (app.outdir / '_downloads' / 'dummy.dat').exists()
|
||||||
|
|
||||||
|
content = (app.outdir / 'index.html').text()
|
||||||
|
assert ('<li><p><a class="reference download internal" download="" '
|
||||||
|
'href="_downloads/dummy.dat">'
|
||||||
|
'<code class="xref download docutils literal notranslate">'
|
||||||
|
'<span class="pre">dummy.dat</span></code></a></p></li>' in content)
|
||||||
|
assert ('<li><p><code class="xref download docutils literal notranslate">'
|
||||||
|
'<span class="pre">not_found.dat</span></code></p></li>' in content)
|
||||||
|
assert ('<li><p><a class="reference download external" download="" '
|
||||||
|
'href="http://www.sphinx-doc.org/en/master/_static/sphinxheader.png">'
|
||||||
|
'<code class="xref download docutils literal notranslate">'
|
||||||
|
'<span class="pre">Sphinx</span> <span class="pre">logo</span>'
|
||||||
|
'</code></a></p></li>' in content)
|
||||||
|
@ -50,6 +50,10 @@ def test_texinfo_warnings(app, status, warning):
|
|||||||
def test_texinfo(app, status, warning):
|
def test_texinfo(app, status, warning):
|
||||||
TexinfoTranslator.ignore_missing_images = True
|
TexinfoTranslator.ignore_missing_images = True
|
||||||
app.builder.build_all()
|
app.builder.build_all()
|
||||||
|
result = (app.outdir / 'SphinxTests.texi').text(encoding='utf8')
|
||||||
|
assert ('@anchor{markup doc}@anchor{12}'
|
||||||
|
'@anchor{markup id1}@anchor{13}'
|
||||||
|
'@anchor{markup testing-various-markup}@anchor{14}' in result)
|
||||||
# now, try to run makeinfo over it
|
# now, try to run makeinfo over it
|
||||||
cwd = os.getcwd()
|
cwd = os.getcwd()
|
||||||
os.chdir(app.outdir)
|
os.chdir(app.outdir)
|
||||||
|
Loading…
Reference in New Issue
Block a user