[Python-modules-commits] [sphinx] 01/01: Import sphinx_1.4.8.orig.tar.gz

Dmitry Shachnev mitya57 at moszumanska.debian.org
Sun Oct 2 14:13:36 UTC 2016


This is an automated email from the git hooks/post-receive script.

mitya57 pushed a commit to branch upstream
in repository sphinx.

commit ecdbc233bfba392d5233197cf39f5f9e58eaa0d7
Author: Dmitry Shachnev <mitya57 at gmail.com>
Date:   Sun Oct 2 17:11:40 2016 +0300

    Import sphinx_1.4.8.orig.tar.gz
---
 CHANGES                                      |  35 ++++++++++++++++
 Makefile                                     |   5 ++-
 PKG-INFO                                     |   2 +-
 Sphinx.egg-info/PKG-INFO                     |   2 +-
 Sphinx.egg-info/SOURCES.txt                  |   4 ++
 doc/extdev/markupapi.rst                     |   2 +
 doc/theming.rst                              |  57 ++++++++++++++++-----------
 sphinx/__init__.py                           |   6 +--
 sphinx/builders/epub.py                      |  18 ++++++++-
 sphinx/builders/html.py                      |  16 +++++++-
 sphinx/builders/linkcheck.py                 |   4 +-
 sphinx/directives/code.py                    |   2 -
 sphinx/ext/autodoc.py                        |   6 +--
 sphinx/ext/autosummary/__init__.py           |   3 +-
 sphinx/ext/intersphinx.py                    |   2 +-
 sphinx/ext/mathbase.py                       |   4 +-
 sphinx/jinja2glue.py                         |  22 +++++++++++
 sphinx/locale/fr/LC_MESSAGES/sphinx.mo       | Bin 11350 -> 11353 bytes
 sphinx/locale/fr/LC_MESSAGES/sphinx.po       |   2 +-
 sphinx/locale/it/LC_MESSAGES/sphinx.mo       | Bin 11105 -> 11108 bytes
 sphinx/locale/it/LC_MESSAGES/sphinx.po       |   2 +-
 sphinx/locale/ne/LC_MESSAGES/sphinx.mo       | Bin 13412 -> 13415 bytes
 sphinx/locale/ne/LC_MESSAGES/sphinx.po       |   2 +-
 sphinx/locale/pt_BR/LC_MESSAGES/sphinx.mo    | Bin 11150 -> 11153 bytes
 sphinx/locale/pt_BR/LC_MESSAGES/sphinx.po    |   2 +-
 sphinx/locale/pt_PT/LC_MESSAGES/sphinx.mo    | Bin 11199 -> 11202 bytes
 sphinx/locale/pt_PT/LC_MESSAGES/sphinx.po    |   2 +-
 sphinx/locale/ro/LC_MESSAGES/sphinx.mo       | Bin 11193 -> 11196 bytes
 sphinx/locale/ro/LC_MESSAGES/sphinx.po       |   2 +-
 sphinx/locale/sk/LC_MESSAGES/sphinx.mo       | Bin 10997 -> 11000 bytes
 sphinx/locale/sk/LC_MESSAGES/sphinx.po       |   2 +-
 sphinx/pycode/Grammar-py2-sphinx1.2.pickle   | Bin 0 -> 18705 bytes
 sphinx/pycode/Grammar-py2-sphinx1.4.pickle   | Bin 0 -> 18705 bytes
 sphinx/quickstart.py                         |   6 +--
 sphinx/texinputs/sphinx.sty                  |   3 ++
 sphinx/themes/basic/genindex.html            |   2 +-
 sphinx/themes/basic/static/basic.css_t       |   7 ++++
 sphinx/themes/basic/static/searchtools.js_t  |   2 +-
 sphinx/util/jsdump.py                        |   2 +-
 sphinx/util/rst.py                           |  18 +++++++++
 sphinx/writers/latex.py                      |   2 +
 tests/roots/test-autosummary/dummy_module.py |   4 ++
 tests/roots/test-directive-code/caption.rst  |   2 +-
 tests/test_directive_code.py                 |  16 ++++----
 tests/test_ext_intersphinx.py                |  15 +++++++
 tests/test_util_jsdump.py                    |  19 +++++++--
 tests/test_util_rst.py                       |  16 ++++++++
 47 files changed, 251 insertions(+), 67 deletions(-)

diff --git a/CHANGES b/CHANGES
index d50bbbf..a8552e8 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,38 @@
+Release 1.4.8 (released Oct 1, 2016)
+====================================
+
+Bugs fixed
+----------
+
+* #2996: The wheel package of Sphinx got crash with ImportError
+
+Release 1.4.7 (released Oct 1, 2016)
+====================================
+
+Bugs fixed
+----------
+
+* #2890: Quickstart should return an error consistently on all error conditions
+* #2870: flatten genindex columns' heights.
+* #2856: Search on generated HTML site doesnt find some symbols
+* #2882: Fall back to a GET request on 403 status in linkcheck
+* #2902: jsdump.loads fails to load search index if keywords starts with
+  underscore
+* #2900: Fix epub content.opf: add auto generated orphan files to spine.
+* #2899: Fix ``hasdoc()`` function in Jinja2 template. It can detect ``genindex``, ``search`` collectly.
+* #2901: Fix epub result: skip creating links from image tags to original image files.
+* #2917: inline code is hyphenated on HTML
+* #1462: autosummary warns for namedtuple with attribute with trailing underscore
+* Could not reference equations if ``:nowrap:`` option specified
+* #2873: code-block overflow in latex (due to commas)
+* #1060, #2056: sphinx.ext.intersphinx: broken links are generated if relative
+  paths are used in `intersphinx_mapping`
+* #2931: code-block directive with same :caption: causes warning of duplicate
+  target.  Now `code-block` and `literalinclude` does not define hyperlink
+  target using its caption automatially.
+* #2962: latex: missing label of longtable
+* #2968: autodoc: show-inheritance option breaks docstrings
+
 Release 1.4.6 (released Aug 20, 2016)
 =====================================
 
diff --git a/Makefile b/Makefile
index adaf964..fa2a846 100644
--- a/Makefile
+++ b/Makefile
@@ -34,7 +34,7 @@ all: clean-pyc clean-backupfiles style-check test
 style-check:
 	@$(PYTHON) utils/check_sources.py $(DONT_CHECK) .
 
-clean: clean-pyc clean-pycache clean-patchfiles clean-backupfiles clean-generated clean-testfiles
+clean: clean-pyc clean-pycache clean-patchfiles clean-backupfiles clean-generated clean-testfiles clean-buildfiles
 
 clean-pyc:
 	find . -name '*.pyc' -exec rm -f {} +
@@ -58,6 +58,9 @@ clean-testfiles:
 	rm -rf tests/build
 	rm -rf .tox/
 
+clean-buildfiles:
+	rm -rf build
+
 pylint:
 	@pylint --rcfile utils/pylintrc sphinx
 
diff --git a/PKG-INFO b/PKG-INFO
index 9f5b717..73f9672 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: Sphinx
-Version: 1.4.6
+Version: 1.4.8
 Summary: Python documentation generator
 Home-page: http://sphinx-doc.org/
 Author: Georg Brandl
diff --git a/Sphinx.egg-info/PKG-INFO b/Sphinx.egg-info/PKG-INFO
index 9f5b717..73f9672 100644
--- a/Sphinx.egg-info/PKG-INFO
+++ b/Sphinx.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: Sphinx
-Version: 1.4.6
+Version: 1.4.8
 Summary: Python documentation generator
 Home-page: http://sphinx-doc.org/
 Author: Georg Brandl
diff --git a/Sphinx.egg-info/SOURCES.txt b/Sphinx.egg-info/SOURCES.txt
index 84b4b9e..f4887a8 100644
--- a/Sphinx.egg-info/SOURCES.txt
+++ b/Sphinx.egg-info/SOURCES.txt
@@ -331,6 +331,8 @@ sphinx/locale/zh_CN/LC_MESSAGES/sphinx.po
 sphinx/locale/zh_TW/LC_MESSAGES/sphinx.js
 sphinx/locale/zh_TW/LC_MESSAGES/sphinx.mo
 sphinx/locale/zh_TW/LC_MESSAGES/sphinx.po
+sphinx/pycode/Grammar-py2-sphinx1.2.pickle
+sphinx/pycode/Grammar-py2-sphinx1.4.pickle
 sphinx/pycode/Grammar-py2.pickle
 sphinx/pycode/Grammar-py2.txt
 sphinx/pycode/Grammar-py3.pickle
@@ -508,6 +510,7 @@ sphinx/util/osutil.py
 sphinx/util/parallel.py
 sphinx/util/png.py
 sphinx/util/pycompat.py
+sphinx/util/rst.py
 sphinx/util/smartypants.py
 sphinx/util/stemmer.py
 sphinx/util/tags.py
@@ -589,6 +592,7 @@ tests/test_util_inspect.py
 tests/test_util_jsdump.py
 tests/test_util_logging.py
 tests/test_util_nodes.py
+tests/test_util_rst.py
 tests/test_versioning.py
 tests/test_websupport.py
 tests/typing_test_data.py
diff --git a/doc/extdev/markupapi.rst b/doc/extdev/markupapi.rst
index 99a1ae9..533660c 100644
--- a/doc/extdev/markupapi.rst
+++ b/doc/extdev/markupapi.rst
@@ -125,6 +125,8 @@ Both APIs parse the content into a given node. They are used like this::
 
    node = docutils.nodes.paragraph()
    # either
+   from sphinx.ext.autodoc import AutodocReporter
+   self.state.memo.reporter = AutodocReporter(self.result, self.state.memo.reporter)  # override reporter to avoid errors from "include" directive
    nested_parse_with_titles(self.state, self.result, node)
    # or
    self.state.nested_parse(self.result, 0, node)
diff --git a/doc/theming.rst b/doc/theming.rst
index d778992..bb7dd83 100644
--- a/doc/theming.rst
+++ b/doc/theming.rst
@@ -86,33 +86,28 @@ Builtin themes
 +--------------------+--------------------+
 | **Theme overview** |                    |
 +--------------------+--------------------+
-| |alabaster|        | |sphinx_rtd_theme| |
+| |alabaster|        | |classic|          |
 |                    |                    |
-| *alabaster*        | *sphinx_rtd_theme* |
+| *alabaster*        | *classic*          |
 +--------------------+--------------------+
-| |classic|          | |sphinxdoc|        |
+| |sphinxdoc|        | |scrolls|          |
 |                    |                    |
-| *classic*          | *sphinxdoc*        |
+| *sphinxdoc*        | *scrolls*          |
 +--------------------+--------------------+
-| |scrolls|          | |agogo|            |
+| |agogo|            | |traditional|      |
 |                    |                    |
-| *scrolls*          | *agogo*            |
+| *agogo*            | *traditional*      |
 +--------------------+--------------------+
-| |traditional|      | |nature|           |
+| |nature|           | |haiku|            |
 |                    |                    |
-| *traditional*      | *nature*           |
+| *nature*           | *haiku*            |
 +--------------------+--------------------+
-| |haiku|            | |pyramid|          |
+| |pyramid|          | |bizstyle|         |
 |                    |                    |
-| *haiku*            | *pyramid*          |
-+--------------------+--------------------+
-| |bizstyle|         |                    |
-|                    |                    |
-| *bizstyle*         |                    |
+| *pyramid*          | *bizstyle*         |
 +--------------------+--------------------+
 
 .. |alabaster|        image:: themes/alabaster.png
-.. |sphinx_rtd_theme| image:: themes/sphinx_rtd_theme.png
 .. |classic|          image:: themes/classic.png
 .. |sphinxdoc|        image:: themes/sphinxdoc.png
 .. |scrolls|          image:: themes/scrolls.png
@@ -147,13 +142,6 @@ These themes are:
 
   .. _Alabaster theme: https://pypi.python.org/pypi/alabaster
 
-* **sphinx_rtd_theme** -- `Read the Docs Sphinx Theme`_.
-  This is a mobile-friendly sphinx theme that was made for readthedocs.org.
-  View a working demo over on readthedocs.org. You can get options information
-  at `Read the Docs Sphinx Theme`_ page.
-
-  .. _Read the Docs Sphinx Theme: https://pypi.python.org/pypi/sphinx_rtd_theme
-
 * **classic** -- This is the classic theme, which looks like `the Python 2
   documentation <https://docs.python.org/2/>`_.  It can be customized via
   these options:
@@ -359,3 +347,28 @@ is built with the classic theme, the output directory will contain a
 .. [1] It is not an executable Python file, as opposed to :file:`conf.py`,
        because that would pose an unnecessary security risk if themes are
        shared.
+
+Third Party Themes
+------------------
+
+.. cssclass:: longtable
+
++--------------------+--------------------+
+| **Theme overview** |                    |
++--------------------+--------------------+
+| |sphinx_rtd_theme| |                    |
+|                    |                    |
+| *sphinx_rtd_theme* |                    |
++--------------------+--------------------+
+
+.. |sphinx_rtd_theme| image:: themes/sphinx_rtd_theme.png
+
+* **sphinx_rtd_theme** -- `Read the Docs Sphinx Theme`_.
+  This is a mobile-friendly sphinx theme that was made for readthedocs.org.
+  View a working demo over on readthedocs.org. You can get install and options
+  information at `Read the Docs Sphinx Theme`_ page.
+
+  .. _Read the Docs Sphinx Theme: https://pypi.python.org/pypi/sphinx_rtd_theme
+
+  .. versionchanged:: 1.4
+     **sphinx_rtd_theme** has become optional.
diff --git a/sphinx/__init__.py b/sphinx/__init__.py
index ddb5f49..228565f 100644
--- a/sphinx/__init__.py
+++ b/sphinx/__init__.py
@@ -15,13 +15,13 @@
 import sys
 from os import path
 
-__version__  = '1.4.6'
-__released__ = '1.4.6'  # used when Sphinx builds its own docs
+__version__  = '1.4.8'
+__released__ = '1.4.8'  # used when Sphinx builds its own docs
 
 # version info for better programmatic use
 # possible values for 3rd element: 'alpha', 'beta', 'rc', 'final'
 # 'final' has 0 as the last element
-version_info = (1, 4, 6, 'final', 0)
+version_info = (1, 4, 8, 'final', 0)
 
 package_dir = path.abspath(path.dirname(__file__))
 
diff --git a/sphinx/builders/epub.py b/sphinx/builders/epub.py
index f5f0d80..ade887e 100644
--- a/sphinx/builders/epub.py
+++ b/sphinx/builders/epub.py
@@ -123,6 +123,9 @@ FILE_TEMPLATE = u'''\
 SPINE_TEMPLATE = u'''\
     <itemref idref="%(idref)s" />'''
 
+NO_LINEAR_SPINE_TEMPLATE = u'''\
+    <itemref idref="%(idref)s" linear="no" />'''
+
 GUIDE_TEMPLATE = u'''\
     <reference type="%(type)s" title="%(title)s" href="%(uri)s" />'''
 
@@ -187,7 +190,8 @@ class EpubBuilder(StandaloneHTMLBuilder):
     add_permalinks = False
     # don't add sidebar etc.
     embedded = True
-
+    # dont' create links to original images from images
+    html_scaled_image_link = False
     # don't generate search index or include search page
     search = False
 
@@ -202,6 +206,7 @@ class EpubBuilder(StandaloneHTMLBuilder):
     coverpage_name = COVERPAGE_NAME
     file_template = FILE_TEMPLATE
     spine_template = SPINE_TEMPLATE
+    no_linear_spine_template = NO_LINEAR_SPINE_TEMPLATE
     guide_template = GUIDE_TEMPLATE
     toctree_template = TOCTREE_TEMPLATE
     doctype = DOCTYPE
@@ -584,6 +589,7 @@ class EpubBuilder(StandaloneHTMLBuilder):
 
         # spine
         spine = []
+        spinefiles = set()
         for item in self.refnodes:
             if '#' in item['refuri']:
                 continue
@@ -592,14 +598,23 @@ class EpubBuilder(StandaloneHTMLBuilder):
             spine.append(self.spine_template % {
                 'idref': self.esc(self.make_id(item['refuri']))
             })
+            spinefiles.add(item['refuri'])
         for info in self.domain_indices:
             spine.append(self.spine_template % {
                 'idref': self.esc(self.make_id(info[0] + self.out_suffix))
             })
+            spinefiles.add(info[0] + self.out_suffix)
         if self.get_builder_config('use_index', 'epub'):
             spine.append(self.spine_template % {
                 'idref': self.esc(self.make_id('genindex' + self.out_suffix))
             })
+            spinefiles.add('genindex' + self.out_suffix)
+        # add auto generated files
+        for name in self.files:
+            if name not in spinefiles and name.endswith(self.out_suffix):
+                spine.append(self.no_linear_spine_template % {
+                    'idref': self.esc(self.make_id(name))
+                })
 
         # add the optional cover
         content_tmpl = self.content_template
@@ -626,6 +641,7 @@ class EpubBuilder(StandaloneHTMLBuilder):
                 ctx = {'image': self.esc(image), 'title': self.config.project}
                 self.handle_page(
                     path.splitext(self.coverpage_name)[0], ctx, html_tmpl)
+                spinefiles.add(self.coverpage_name)
 
         guide = []
         auto_add_cover = True
diff --git a/sphinx/builders/html.py b/sphinx/builders/html.py
index e19da22..d1f5792 100644
--- a/sphinx/builders/html.py
+++ b/sphinx/builders/html.py
@@ -74,6 +74,8 @@ class StandaloneHTMLBuilder(Builder):
     link_suffix = '.html'  # defaults to matching out_suffix
     indexer_format = js_index
     indexer_dumps_unicode = True
+    # create links to original images from images [True/False]
+    html_scaled_image_link = True
     supported_image_types = ['image/svg+xml', 'image/png',
                              'image/gif', 'image/jpeg']
     searchindex_filename = 'searchindex.js'
@@ -678,7 +680,7 @@ class StandaloneHTMLBuilder(Builder):
         """
         Builder.post_process_images(self, doctree)
 
-        if self.config.html_scaled_image_link:
+        if self.config.html_scaled_image_link and self.html_scaled_image_link:
             for node in doctree.traverse(nodes.image):
                 scale_keys = ('scale', 'width', 'height')
                 if not any((key in node) for key in scale_keys) or \
@@ -785,7 +787,17 @@ class StandaloneHTMLBuilder(Builder):
             uri = relative_uri(baseuri, otheruri) or '#'
             return uri
         ctx['pathto'] = pathto
-        ctx['hasdoc'] = lambda name: name in self.env.all_docs
+
+        def hasdoc(name):
+            if name in self.env.all_docs:
+                return True
+            elif name == 'search' and self.search:
+                return True
+            elif name == 'genindex' and self.get_builder_config('use_index', 'html'):
+                return True
+            return False
+        ctx['hasdoc'] = hasdoc
+
         if self.name != 'htmlhelp':
             ctx['encoding'] = encoding = self.config.html_output_encoding
         else:
diff --git a/sphinx/builders/linkcheck.py b/sphinx/builders/linkcheck.py
index 0f1716a..5ceb8d7 100644
--- a/sphinx/builders/linkcheck.py
+++ b/sphinx/builders/linkcheck.py
@@ -183,10 +183,10 @@ class CheckExternalLinksBuilder(Builder):
                         f = opener.open(req, **kwargs)
                         f.close()
                     except HTTPError as err:
-                        if err.code != 405:
+                        if err.code not in (403, 405):
                             raise
                         # retry with GET if that fails, some servers
-                        # don't like HEAD requests and reply with 405
+                        # don't like HEAD requests and reply with 403 or 405
                         req = Request(req_url)
                         f = opener.open(req, **kwargs)
                         f.close()
diff --git a/sphinx/directives/code.py b/sphinx/directives/code.py
index 8edfd61..35439ae 100644
--- a/sphinx/directives/code.py
+++ b/sphinx/directives/code.py
@@ -133,7 +133,6 @@ class CodeBlock(Directive):
 
         caption = self.options.get('caption')
         if caption:
-            self.options.setdefault('name', nodes.fully_normalize_name(caption))
             try:
                 literal = container_wrapper(self, literal, caption)
             except ValueError as exc:
@@ -344,7 +343,6 @@ class LiteralInclude(Directive):
         if caption is not None:
             if not caption:
                 caption = self.arguments[0]
-            self.options.setdefault('name', nodes.fully_normalize_name(caption))
             try:
                 retnode = container_wrapper(self, retnode, caption)
             except ValueError as exc:
diff --git a/sphinx/ext/autodoc.py b/sphinx/ext/autodoc.py
index 08bc99c..967bead 100644
--- a/sphinx/ext/autodoc.py
+++ b/sphinx/ext/autodoc.py
@@ -261,6 +261,8 @@ def format_annotation(annotation):
 
     Displaying complex types from ``typing`` relies on its private API.
     """
+    if typing and isinstance(annotation, typing.TypeVar):
+        return annotation.__name__
     if not isinstance(annotation, type):
         return repr(annotation)
 
@@ -270,9 +272,7 @@ def format_annotation(annotation):
     if annotation.__module__ == 'builtins':
         return annotation.__qualname__
     elif typing:
-        if isinstance(annotation, typing.TypeVar):
-            return annotation.__name__
-        elif hasattr(typing, 'GenericMeta') and \
+        if hasattr(typing, 'GenericMeta') and \
                 isinstance(annotation, typing.GenericMeta):
             # In Python 3.5.2+, all arguments are stored in __args__,
             # whereas __parameters__ only contains generic parameters.
diff --git a/sphinx/ext/autosummary/__init__.py b/sphinx/ext/autosummary/__init__.py
index 3635ad0..a941aa3 100644
--- a/sphinx/ext/autosummary/__init__.py
+++ b/sphinx/ext/autosummary/__init__.py
@@ -67,6 +67,7 @@ from docutils import nodes
 
 import sphinx
 from sphinx import addnodes
+from sphinx.util import rst
 from sphinx.util.compat import Directive
 from sphinx.pycode import ModuleAnalyzer, PycodeError
 from sphinx.ext.autodoc import Options
@@ -367,7 +368,7 @@ class Autosummary(Directive):
         for name, sig, summary, real_name in items:
             qualifier = 'obj'
             if 'nosignatures' not in self.options:
-                col1 = ':%s:`%s <%s>`\ %s' % (qualifier, name, real_name, sig)
+                col1 = ':%s:`%s <%s>`\ %s' % (qualifier, name, real_name, rst.escape(sig))
             else:
                 col1 = ':%s:`%s <%s>`' % (qualifier, name, real_name)
             col2 = summary
diff --git a/sphinx/ext/intersphinx.py b/sphinx/ext/intersphinx.py
index 16a487e..7b68b3b 100644
--- a/sphinx/ext/intersphinx.py
+++ b/sphinx/ext/intersphinx.py
@@ -366,7 +366,7 @@ def missing_reference(app, env, node, contnode):
             proj, version, uri, dispname = inventory[objtype][target]
             if '://' not in uri and node.get('refdoc'):
                 # get correct path in case of subdirectories
-                uri = path.join(relative_path(node['refdoc'], env.srcdir), uri)
+                uri = path.join(relative_path(node['refdoc'], '.'), uri)
             newnode = nodes.reference('', '', internal=False, refuri=uri,
                                       reftitle=_('(in %s v%s)') % (proj, version))
             if node.get('refexplicit'):
diff --git a/sphinx/ext/mathbase.py b/sphinx/ext/mathbase.py
index ddcec49..430813a 100644
--- a/sphinx/ext/mathbase.py
+++ b/sphinx/ext/mathbase.py
@@ -131,10 +131,12 @@ def latex_visit_math(self, node):
 
 
 def latex_visit_displaymath(self, node):
+    label = node['label'] and node['docname'] + '-' + node['label'] or None
     if node['nowrap']:
+        if label:
+            self.body.append(r'\label{%s}' % label)
         self.body.append(node['latex'])
     else:
-        label = node['label'] and node['docname'] + '-' + node['label'] or None
         self.body.append(wrap_displaymath(node['latex'], label,
                                           self.builder.config.math_number_all))
     raise nodes.SkipNode
diff --git a/sphinx/jinja2glue.py b/sphinx/jinja2glue.py
index f3ce87a..df1aa49 100644
--- a/sphinx/jinja2glue.py
+++ b/sphinx/jinja2glue.py
@@ -35,6 +35,27 @@ def _toint(val):
         return 0
 
 
+def _slice_index(values, slices):
+    seq = list(values)
+    length = 0
+    for value in values:
+        length += 1 + len(value[1][1])  # count includes subitems
+    items_per_slice = length // slices
+    offset = 0
+    for slice_number in range(slices):
+        count = 0
+        start = offset
+        if slices == slice_number + 1:  # last column
+            offset = len(seq)
+        else:
+            for value in values[offset:]:
+                count += 1 + len(value[1][1])
+                offset += 1
+                if count >= items_per_slice:
+                    break
+        yield seq[start:offset]
+
+
 def accesskey(context, key):
     """Helper to output each access key only once."""
     if '_accesskeys' not in context:
@@ -127,6 +148,7 @@ class BuiltinTemplateLoader(TemplateBridge, BaseLoader):
                                                 extensions=extensions)
         self.environment.filters['tobool'] = _tobool
         self.environment.filters['toint'] = _toint
+        self.environment.filters['slice_index'] = _slice_index
         self.environment.globals['debug'] = contextfunction(pformat)
         self.environment.globals['accesskey'] = contextfunction(accesskey)
         self.environment.globals['idgen'] = idgen
diff --git a/sphinx/locale/fr/LC_MESSAGES/sphinx.mo b/sphinx/locale/fr/LC_MESSAGES/sphinx.mo
index 2fc0530..d3c3535 100644
Binary files a/sphinx/locale/fr/LC_MESSAGES/sphinx.mo and b/sphinx/locale/fr/LC_MESSAGES/sphinx.mo differ
diff --git a/sphinx/locale/fr/LC_MESSAGES/sphinx.po b/sphinx/locale/fr/LC_MESSAGES/sphinx.po
index 1a2b17b..c476663 100644
--- a/sphinx/locale/fr/LC_MESSAGES/sphinx.po
+++ b/sphinx/locale/fr/LC_MESSAGES/sphinx.po
@@ -446,7 +446,7 @@ msgstr "Page de recherche"
 #: sphinx/ext/autodoc.py:1265
 #, python-format
 msgid "   Bases: %s"
-msgstr "Bases: %s"
+msgstr "   Bases: %s"
 
 #: sphinx/ext/autodoc.py:1318
 #, python-format
diff --git a/sphinx/locale/it/LC_MESSAGES/sphinx.mo b/sphinx/locale/it/LC_MESSAGES/sphinx.mo
index b94e7dd..271ff6a 100644
Binary files a/sphinx/locale/it/LC_MESSAGES/sphinx.mo and b/sphinx/locale/it/LC_MESSAGES/sphinx.mo differ
diff --git a/sphinx/locale/it/LC_MESSAGES/sphinx.po b/sphinx/locale/it/LC_MESSAGES/sphinx.po
index a767531..b37c441 100644
--- a/sphinx/locale/it/LC_MESSAGES/sphinx.po
+++ b/sphinx/locale/it/LC_MESSAGES/sphinx.po
@@ -441,7 +441,7 @@ msgstr "Cerca"
 #: sphinx/ext/autodoc.py:1265
 #, python-format
 msgid "   Bases: %s"
-msgstr "Basi: %s"
+msgstr "   Basi: %s"
 
 #: sphinx/ext/autodoc.py:1318
 #, python-format
diff --git a/sphinx/locale/ne/LC_MESSAGES/sphinx.mo b/sphinx/locale/ne/LC_MESSAGES/sphinx.mo
index e3407aa..bc42545 100644
Binary files a/sphinx/locale/ne/LC_MESSAGES/sphinx.mo and b/sphinx/locale/ne/LC_MESSAGES/sphinx.mo differ
diff --git a/sphinx/locale/ne/LC_MESSAGES/sphinx.po b/sphinx/locale/ne/LC_MESSAGES/sphinx.po
index f6a888e..d1be56a 100644
--- a/sphinx/locale/ne/LC_MESSAGES/sphinx.po
+++ b/sphinx/locale/ne/LC_MESSAGES/sphinx.po
@@ -439,7 +439,7 @@ msgstr "पानामा खोज्नुहोस्"
 #: sphinx/ext/autodoc.py:1265
 #, python-format
 msgid "   Bases: %s"
-msgstr "Bases: %s"
+msgstr "   Bases: %s"
 
 #: sphinx/ext/autodoc.py:1318
 #, python-format
diff --git a/sphinx/locale/pt_BR/LC_MESSAGES/sphinx.mo b/sphinx/locale/pt_BR/LC_MESSAGES/sphinx.mo
index 7258992..73c921d 100644
Binary files a/sphinx/locale/pt_BR/LC_MESSAGES/sphinx.mo and b/sphinx/locale/pt_BR/LC_MESSAGES/sphinx.mo differ
diff --git a/sphinx/locale/pt_BR/LC_MESSAGES/sphinx.po b/sphinx/locale/pt_BR/LC_MESSAGES/sphinx.po
index 8b9504a..b920ec6 100644
--- a/sphinx/locale/pt_BR/LC_MESSAGES/sphinx.po
+++ b/sphinx/locale/pt_BR/LC_MESSAGES/sphinx.po
@@ -440,7 +440,7 @@ msgstr "Página de Busca"
 #: sphinx/ext/autodoc.py:1265
 #, python-format
 msgid "   Bases: %s"
-msgstr "Bases: %s"
+msgstr "   Bases: %s"
 
 #: sphinx/ext/autodoc.py:1318
 #, python-format
diff --git a/sphinx/locale/pt_PT/LC_MESSAGES/sphinx.mo b/sphinx/locale/pt_PT/LC_MESSAGES/sphinx.mo
index d9784a0..3f664cf 100644
Binary files a/sphinx/locale/pt_PT/LC_MESSAGES/sphinx.mo and b/sphinx/locale/pt_PT/LC_MESSAGES/sphinx.mo differ
diff --git a/sphinx/locale/pt_PT/LC_MESSAGES/sphinx.po b/sphinx/locale/pt_PT/LC_MESSAGES/sphinx.po
index 73e010b..e64c81c 100644
--- a/sphinx/locale/pt_PT/LC_MESSAGES/sphinx.po
+++ b/sphinx/locale/pt_PT/LC_MESSAGES/sphinx.po
@@ -439,7 +439,7 @@ msgstr "Página de Pesquisa"
 #: sphinx/ext/autodoc.py:1265
 #, python-format
 msgid "   Bases: %s"
-msgstr "Bases: %s"
+msgstr "   Bases: %s"
 
 #: sphinx/ext/autodoc.py:1318
 #, python-format
diff --git a/sphinx/locale/ro/LC_MESSAGES/sphinx.mo b/sphinx/locale/ro/LC_MESSAGES/sphinx.mo
index 756b656..50b1b0f 100644
Binary files a/sphinx/locale/ro/LC_MESSAGES/sphinx.mo and b/sphinx/locale/ro/LC_MESSAGES/sphinx.mo differ
diff --git a/sphinx/locale/ro/LC_MESSAGES/sphinx.po b/sphinx/locale/ro/LC_MESSAGES/sphinx.po
index 79f0f65..01b56c2 100644
--- a/sphinx/locale/ro/LC_MESSAGES/sphinx.po
+++ b/sphinx/locale/ro/LC_MESSAGES/sphinx.po
@@ -439,7 +439,7 @@ msgstr "Pagină de Căutare"
 #: sphinx/ext/autodoc.py:1265
 #, python-format
 msgid "   Bases: %s"
-msgstr "Baze: %s"
+msgstr "   Baze: %s"
 
 #: sphinx/ext/autodoc.py:1318
 #, python-format
diff --git a/sphinx/locale/sk/LC_MESSAGES/sphinx.mo b/sphinx/locale/sk/LC_MESSAGES/sphinx.mo
index a4a69b2..9cbffc9 100644
Binary files a/sphinx/locale/sk/LC_MESSAGES/sphinx.mo and b/sphinx/locale/sk/LC_MESSAGES/sphinx.mo differ
diff --git a/sphinx/locale/sk/LC_MESSAGES/sphinx.po b/sphinx/locale/sk/LC_MESSAGES/sphinx.po
index 236ab86..d685b82 100644
--- a/sphinx/locale/sk/LC_MESSAGES/sphinx.po
+++ b/sphinx/locale/sk/LC_MESSAGES/sphinx.po
@@ -440,7 +440,7 @@ msgstr "Stránka hľadania"
 #: sphinx/ext/autodoc.py:1265
 #, python-format
 msgid "   Bases: %s"
-msgstr "Základné: %s"
+msgstr "   Základné: %s"
 
 #: sphinx/ext/autodoc.py:1318
 #, python-format
diff --git a/sphinx/pycode/Grammar-py2-sphinx1.2.pickle b/sphinx/pycode/Grammar-py2-sphinx1.2.pickle
new file mode 100644
index 0000000..f4369e2
Binary files /dev/null and b/sphinx/pycode/Grammar-py2-sphinx1.2.pickle differ
diff --git a/sphinx/pycode/Grammar-py2-sphinx1.4.pickle b/sphinx/pycode/Grammar-py2-sphinx1.4.pickle
new file mode 100644
index 0000000..c0b8265
Binary files /dev/null and b/sphinx/pycode/Grammar-py2-sphinx1.4.pickle differ
diff --git a/sphinx/quickstart.py b/sphinx/quickstart.py
index 4680fec..751f87b 100644
--- a/sphinx/quickstart.py
+++ b/sphinx/quickstart.py
@@ -1646,7 +1646,7 @@ def main(argv=sys.argv):
             if not set(['project', 'author', 'version']).issubset(d):
                 print('''"quiet" is specified, but any of "project", \
 "author" or "version" is not specified.''')
-                return
+                return 1
 
         if set(['quiet', 'project', 'author', 'version']).issubset(d):
             # quiet mode with all required params satisfied, use default
@@ -1666,13 +1666,13 @@ def main(argv=sys.argv):
                            ' files already exist.'))
                 print('sphinx-quickstart only generate into a empty directory.'
                       ' Please specify a new root path.')
-                return
+                return 1
         else:
             ask_user(d)
     except (KeyboardInterrupt, EOFError):
         print()
         print('[Interrupted.]')
-        return
+        return 130  # 128 + SIGINT
 
     # decode values in d if value is a Python string literal
     for key, value in d.items():
diff --git a/sphinx/texinputs/sphinx.sty b/sphinx/texinputs/sphinx.sty
index a645836..d025a07 100644
--- a/sphinx/texinputs/sphinx.sty
+++ b/sphinx/texinputs/sphinx.sty
@@ -290,6 +290,7 @@
     \def\PYGZti{\discretionary{\char`\~}{\sphinxafterbreak}{\char`\~}}%
 }
 
+\def\sphinx at verbatim@nolig at list {\do \`}%
 % Some characters . , ; ? ! / are not pygmentized.
 % This macro makes them "active" and they will insert potential linebreaks
 \newcommand*\sphinxbreaksatpunct {%
@@ -387,6 +388,8 @@
      % For grid placement from \strut's in \FancyVerbFormatLine
      \lineskip\z at skip
      % Breaks at punctuation characters . , ; ? ! and / need catcode=\active
+     % and the active comma should not be overwritten by \@noligs
+     \let\verbatim at nolig@list \sphinx at verbatim@nolig at list
      \OriginalVerbatim[#1,codes*=\sphinxbreaksatpunct]%
 }
 \renewcommand{\endVerbatim}{%
diff --git a/sphinx/themes/basic/genindex.html b/sphinx/themes/basic/genindex.html
index fac7f18..c72d980 100644
--- a/sphinx/themes/basic/genindex.html
+++ b/sphinx/themes/basic/genindex.html
@@ -44,7 +44,7 @@
 {%- for key, entries in genindexentries %}
 <h2 id="{{ key }}">{{ key }}</h2>
 <table style="width: 100%" class="indextable genindextable"><tr>
-  {%- for column in entries|slice(2) if column %}
+  {%- for column in entries|slice_index(2) if column %}
   <td style="width: 33%" valign="top"><dl>
     {%- for entryname, (links, subitems, _) in column %}
       {{ indexentries(entryname, links) }}
diff --git a/sphinx/themes/basic/static/basic.css_t b/sphinx/themes/basic/static/basic.css_t
index cdc703b..54f5e51 100644
--- a/sphinx/themes/basic/static/basic.css_t
+++ b/sphinx/themes/basic/static/basic.css_t
@@ -494,6 +494,13 @@ pre {
     overflow-y: hidden;  /* fixes display issues on Chrome browsers */
 }
 
+span.pre {
+    -moz-hyphens: none;
+    -ms-hyphens: none;
+    -webkit-hyphens: none;
+    hyphens: none;
+}
+
 td.linenos pre {
     padding: 5px 0px;
     border: 0;
diff --git a/sphinx/themes/basic/static/searchtools.js_t b/sphinx/themes/basic/static/searchtools.js_t
index 8a150b2..45ff1e4 100644
--- a/sphinx/themes/basic/static/searchtools.js_t
+++ b/sphinx/themes/basic/static/searchtools.js_t
@@ -145,7 +145,7 @@ var Search = {
     var searchterms = [];
     var excluded = [];
     var hlterms = [];
-    var tmp = query.split(/\s+/);
+    var tmp = query.split(/\W+/);
     var objectterms = [];
     for (i = 0; i < tmp.length; i++) {
       if (tmp[i] !== "") {
diff --git a/sphinx/util/jsdump.py b/sphinx/util/jsdump.py
index 43c2962..5a2148c 100644
--- a/sphinx/util/jsdump.py
+++ b/sphinx/util/jsdump.py
@@ -18,7 +18,7 @@ from sphinx.util.pycompat import u
 
 _str_re  = re.compile(r'"(\\\\|\\"|[^"])*"')
 _int_re  = re.compile(r'\d+')
-_name_re = re.compile(r'[a-zA-Z]\w*')
+_name_re = re.compile(r'[a-zA-Z_]\w*')
 _nameonly_re = re.compile(r'[a-zA-Z_][a-zA-Z0-9_]*$')
 
 # escape \, ", control characters and everything outside ASCII
diff --git a/sphinx/util/rst.py b/sphinx/util/rst.py
new file mode 100644
index 0000000..437ba51
--- /dev/null
+++ b/sphinx/util/rst.py
@@ -0,0 +1,18 @@
+# -*- coding: utf-8 -*-
+"""
+    sphinx.util.rst
+    ~~~~~~~~~~~~~~~
+
+    reST helper functions.
+
+    :copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS.
+    :license: BSD, see LICENSE for details.
+"""
+
+import re
+
+symbols_re = re.compile('([!-/:-@\[-`{-~])')
+
+
+def escape(text):
+    return symbols_re.sub(r'\\\1', text)
diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py
index d46d65b..08afb1b 100644
--- a/sphinx/writers/latex.py
+++ b/sphinx/writers/latex.py
@@ -1029,6 +1029,8 @@ class LaTeXTranslator(nodes.NodeVisitor):
             self.body.append('}')
             for id in self.pop_hyperlink_ids('table'):
                 self.body.append(self.hypertarget(id, anchor=False))
+            if node['ids']:
+                self.body.append(self.hypertarget(node['ids'][0], anchor=False))
             self.body.append(u'\\\\\n')
         if self.table.longtable:
             self.body.append('\\hline\n')
diff --git a/tests/roots/test-autosummary/dummy_module.py b/tests/roots/test-autosummary/dummy_module.py
index a64035d..1f4a473 100644
--- a/tests/roots/test-autosummary/dummy_module.py
+++ b/tests/roots/test-autosummary/dummy_module.py
@@ -69,3 +69,7 @@ class C:
         '''
         This is a nested inner class docstring
         '''
+
+
+def func(arg_):
+    """Test function take an argument ended with underscore."""
diff --git a/tests/roots/test-directive-code/caption.rst b/tests/roots/test-directive-code/caption.rst
index e8389b9..77c5c38 100644
--- a/tests/roots/test-directive-code/caption.rst
+++ b/tests/roots/test-directive-code/caption.rst
@@ -4,7 +4,7 @@ Caption
 References
 ----------
 
-See :numref:`caption *test* rb` and :numref:`caption **test** py`.
+See :numref:`name *test* rb` and :numref:`name **test** py`.
 
 See :ref:`Ruby <name *test* rb>` and :ref:`Python <name **test** py>`.
 
diff --git a/tests/test_directive_code.py b/tests/test_directive_code.py
index 5871f03..8209e8f 100644
--- a/tests/test_directive_code.py
+++ b/tests/test_directive_code.py
@@ -56,7 +56,7 @@ def test_code_block_caption_html(app, status, warning):
     caption = (u'<div class="code-block-caption">'
                u'<span class="caption-number">Listing 1 </span>'
                u'<span class="caption-text">caption <em>test</em> rb'
-               u'</span><a class="headerlink" href="#caption-test-rb" '
+               u'</span><a class="headerlink" href="#id1" '
                u'title="Permalink to this code">\xb6</a></div>')
     assert caption in html
 
@@ -66,9 +66,9 @@ def test_code_block_caption_latex(app, status, warning):
     app.builder.build_all()
     latex = (app.outdir / 'Python.tex').text(encoding='utf-8')
     caption = '\\sphinxSetupCaptionForVerbatim{literal-block}{caption \\emph{test} rb}'
-    label = '\\def\\sphinxLiteralBlockLabel{\\label{caption:caption-test-rb}}'
-    link  = '\hyperref[caption:caption-test-rb]' \
-            '{Listing \\ref{caption:caption-test-rb}}'
+    label = '\\def\\sphinxLiteralBlockLabel{\\label{caption:id1}}'
+    link  = '\hyperref[caption:name-test-rb]' \
+            '{Listing \\ref{caption:name-test-rb}}'
     assert caption in latex
     assert label in latex
     assert link in latex
@@ -243,7 +243,7 @@ def test_literalinclude_caption_html(app, status, warning):
     caption = (u'<div class="code-block-caption">'
                u'<span class="caption-number">Listing 2 </span>'
                u'<span class="caption-text">caption <strong>test</strong> py'
-               u'</span><a class="headerlink" href="#caption-test-py" '
+               u'</span><a class="headerlink" href="#id2" '
                u'title="Permalink to this code">\xb6</a></div>')
     assert caption in html
 
@@ -253,9 +253,9 @@ def test_literalinclude_caption_latex(app, status, warning):
     app.builder.build('index')
     latex = (app.outdir / 'Python.tex').text(encoding='utf-8')
     caption = '\\sphinxSetupCaptionForVerbatim{literal-block}{caption \\textbf{test} py}'
-    label = '\\def\\sphinxLiteralBlockLabel{\\label{caption:caption-test-py}}'
-    link  = '\hyperref[caption:caption-test-py]' \
-            '{Listing \\ref{caption:caption-test-py}}'
+    label = '\\def\\sphinxLiteralBlockLabel{\\label{caption:id2}}'
+    link  = '\hyperref[caption:name-test-py]' \
+            '{Listing \\ref{caption:name-test-py}}'
     assert caption in latex
     assert label in latex
     assert link in latex
diff --git a/tests/test_ext_intersphinx.py b/tests/test_ext_intersphinx.py
index 334d539..deec5a3 100644
--- a/tests/test_ext_intersphinx.py
+++ b/tests/test_ext_intersphinx.py
@@ -135,6 +135,8 @@ def test_missing_reference(tempdir, app, status, warning):
     app.config.intersphinx_mapping = {
         'https://docs.python.org/': inv_file,
         'py3k': ('https://docs.python.org/py3k/', inv_file),
+        'py3krel': ('py3k', inv_file),  # relative path
+        'py3krelparent': ('../../py3k', inv_file),  # relative path, parent dir
     }
     app.config.intersphinx_cache_limit = 0
 
@@ -202,6 +204,19 @@ def test_missing_reference(tempdir, app, status, warning):
     assert rn is None
     assert contnode[0].astext() == 'py3k:unknown'
 
+    # check relative paths
+    rn = reference_check('py', 'mod', 'py3krel:module1', 'foo')
+    assert rn['refuri'] == 'py3k/foo.html#module-module1'
+
+    rn = reference_check('py', 'mod', 'py3krelparent:module1', 'foo')
+    assert rn['refuri'] == '../../py3k/foo.html#module-module1'
+
+    rn = reference_check('py', 'mod', 'py3krel:module1', 'foo', refdoc='sub/dir/test')
+    assert rn['refuri'] == '../../py3k/foo.html#module-module1'
+
+    rn = reference_check('py', 'mod', 'py3krelparent:module1', 'foo', refdoc='sub/dir/test')
+    assert rn['refuri'] == '../../../../py3k/foo.html#module-module1'
+
 
 @with_app()
 @with_tempdir
diff --git a/tests/test_util_jsdump.py b/tests/test_util_jsdump.py
index f8d3156..8f98c79 100644
--- a/tests/test_util_jsdump.py
+++ b/tests/test_util_jsdump.py
@@ -1,9 +1,20 @@
 # -*- coding: utf-8 -*-
+from sphinx.util.jsdump import dumps, loads
+
 
 def test_jsdump():
-    from sphinx.util.jsdump import dumps
+    data = {'1a': 1}
+    assert dumps(data) == '{"1a":1}'
+    assert data == loads(dumps(data))
+
+    data = {'a1': 1}
+    assert dumps(data) == '{a1:1}'
+    assert data == loads(dumps(data))
 
-    assert dumps({'1a': 1}) == '{"1a":1}'
-    assert dumps({'a1': 1}) == '{a1:1}'
+    data = {u'a\xe8': 1}
+    assert dumps(data) == '{"a\\u00e8":1}'
+    assert data == loads(dumps(data))
 
-    assert dumps({u'a\xe8': 1}) == '{"a\\u00e8":1}'
+    data = {'_foo': 1}
+    assert dumps(data) == '{_foo:1}'
+    assert data == loads(dumps(data))
diff --git a/tests/test_util_rst.py b/tests/test_util_rst.py
new file mode 100644
index 0000000..72cd87f
--- /dev/null
+++ b/tests/test_util_rst.py
@@ -0,0 +1,16 @@
+# -*- coding: utf-8 -*-
+"""
+    test_util_rst
+    ~~~~~~~~~~~~~~~
+
+    Tests sphinx.util.rst functions.
+
+    :copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS.
+    :license: BSD, see LICENSE for details.
+"""
+from sphinx.util.rst import escape
+
+
+def test_escape():
+    assert escape(':ref:`id`') == '\:ref\:\`id\`'
+    assert escape('footnote [#]_') == 'footnote \[\#\]\_'

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/sphinx.git



More information about the Python-modules-commits mailing list