diff --git a/.gitignore b/.gitignore
index 9d163ff7b..0f9acd743 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,7 @@
*.swp
.dir-locals.el
+.mypy_cache/
.ropeproject/
TAGS
.tags
diff --git a/.travis.yml b/.travis.yml
index 82bcb9f23..09b89a7ae 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -7,6 +7,7 @@ python:
- "2.7"
- "3.4"
- "3.5"
+ - "3.6"
- "nightly"
- "pypy"
env:
@@ -17,6 +18,16 @@ env:
matrix:
- DOCUTILS=0.12
- DOCUTILS=0.13.1
+matrix:
+ exclude:
+ - python: "3.4"
+ env: DOCUTILS=0.12
+ - python: "3.5"
+ env: DOCUTILS=0.12
+ - python: nightly
+ env: DOCUTILS=0.12
+ - python: pypy
+ env: DOCUTILS=0.12
addons:
apt:
packages:
@@ -31,8 +42,7 @@ install:
- pip install -U pip setuptools
- pip install docutils==$DOCUTILS
- pip install -r test-reqs.txt
-before_script:
- - if [[ $TRAVIS_PYTHON_VERSION != '2.6' ]]; then flake8; fi
script:
- - if [[ $TRAVIS_PYTHON_VERSION == '3.5' ]]; then make style-check test-async; fi
- - if [[ $TRAVIS_PYTHON_VERSION != '3.5' ]]; then make test; fi
+ - flake8
+ - if [[ $TRAVIS_PYTHON_VERSION == '3.6' ]]; then make style-check test-async; fi
+ - if [[ $TRAVIS_PYTHON_VERSION != '3.6' ]]; then make test; fi
diff --git a/CHANGES b/CHANGES
index c24b83655..3baa9c17c 100644
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,7 @@ Features added
* #3241: emit latex warning if buggy titlesec (ref #3210)
* #3194: Refer the $MAKE environment variable to determine ``make`` command
+* Emit warning for nested numbered toctrees (refs: #3142)
Bugs fixed
----------
@@ -17,6 +18,10 @@ Bugs fixed
* #3255: In Py3.4 environment, autodoc doesn't support documentation for
attributes of Enum class correctly.
* #3261: ``latex_use_parts`` makes sphinx crash
+* The warning type ``misc.highlighting_failure`` does not work
+* #3294: ``add_latex_package()`` make crashes non-LaTeX builders
+* The caption of table are rendered as invalid HTML (refs: #3287)
+
Release 1.5.1 (released Dec 13, 2016)
=====================================
diff --git a/doc/config.rst b/doc/config.rst
index 647aa6bc7..3a375eeeb 100644
--- a/doc/config.rst
+++ b/doc/config.rst
@@ -233,6 +233,7 @@ General configuration
* ref.citation
* ref.doc
* misc.highlighting_failure
+ * toc.secnum
* epub.unknown_project_files
You can choose from these types.
diff --git a/doc/install.rst b/doc/install.rst
index b3519e1ba..2eb44b809 100644
--- a/doc/install.rst
+++ b/doc/install.rst
@@ -79,8 +79,8 @@ sidebar and under "Quick Links", click "Windows Installer" to download.
.. note::
- Currently, Python offers two major versions, 2.x and 3.x. Sphinx 1.3 can run
- under Python 2.7, 3.4, 3.5, with the recommended version being 2.7. This
+ Currently, Python offers two major versions, 2.x and 3.x. Sphinx 1.5 can run
+ under Python 2.7, 3.4, 3.5, 3.6, with the recommended version being 2.7. This
chapter assumes you have installed Python 2.7.
Follow the Windows installer for Python.
diff --git a/setup.cfg b/setup.cfg
index f87dcc178..2aad0c177 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -26,4 +26,4 @@ universal = 1
[flake8]
max-line-length = 95
ignore = E113,E116,E221,E226,E241,E251,E901
-exclude = tests/*,build/*,sphinx/search/*,sphinx/pycode/pgen2/*,doc/ext/example*.py
+exclude = .git,.tox,tests/*,build/*,sphinx/search/*,sphinx/pycode/pgen2/*,doc/ext/example*.py
\ No newline at end of file
diff --git a/sphinx/application.py b/sphinx/application.py
index 00661aa61..f3bc381bc 100644
--- a/sphinx/application.py
+++ b/sphinx/application.py
@@ -806,7 +806,8 @@ class Sphinx(object):
def add_latex_package(self, packagename, options=None):
self.debug('[app] adding latex package: %r', packagename)
- self.builder.usepackages.append((packagename, options))
+ if hasattr(self.builder, 'usepackages'): # only for LaTeX builder
+ self.builder.usepackages.append((packagename, options))
def add_lexer(self, alias, lexer):
self.debug('[app] adding lexer: %r', (alias, lexer))
diff --git a/sphinx/builders/latex.py b/sphinx/builders/latex.py
index 4e86ef19f..bfd002be5 100644
--- a/sphinx/builders/latex.py
+++ b/sphinx/builders/latex.py
@@ -268,13 +268,28 @@ def validate_config_values(app):
app.config.latex_elements['postamble'] = app.config.latex_elements['footer']
+def default_latex_engine(config):
+ """ Better default latex_engine settings for specific languages. """
+ if config.language == 'ja':
+ return 'platex'
+ else:
+ return 'pdflatex'
+
+
+def default_latex_docclass(config):
+ """ Better default latex_docclass settings for specific languages. """
+ if config.language == 'ja':
+ return {'manual': 'jsbook',
+ 'howto': 'jreport'}
+ else:
+ return {}
+
+
def setup(app):
app.add_builder(LaTeXBuilder)
app.connect('builder-inited', validate_config_values)
- app.add_config_value('latex_engine',
- lambda self: 'pdflatex' if self.language != 'ja' else 'platex',
- None,
+ app.add_config_value('latex_engine', default_latex_engine, None,
ENUM('pdflatex', 'xelatex', 'lualatex', 'platex'))
app.add_config_value('latex_documents',
lambda self: [(self.master_doc, make_filename(self.project) + '.tex',
@@ -297,11 +312,7 @@ def setup(app):
app.add_config_value('latex_elements', {}, None)
app.add_config_value('latex_additional_files', [], None)
- japanese_default = {'manual': 'jsbook',
- 'howto': 'jreport'}
- app.add_config_value('latex_docclass',
- lambda self: japanese_default if self.language == 'ja' else {},
- None)
+ app.add_config_value('latex_docclass', default_latex_docclass, None)
# now deprecated - use latex_elements
app.add_config_value('latex_preamble', '', None)
diff --git a/sphinx/environment/managers/toctree.py b/sphinx/environment/managers/toctree.py
index e96143754..67fbfa7b6 100644
--- a/sphinx/environment/managers/toctree.py
+++ b/sphinx/environment/managers/toctree.py
@@ -464,10 +464,14 @@ class Toctree(EnvironmentManager):
if depth == 0:
return
for (title, ref) in toctreenode['entries']:
- if url_re.match(ref) or ref == 'self' or ref in assigned:
+ if url_re.match(ref) or ref == 'self':
# don't mess with those
continue
- if ref in self.tocs:
+ elif ref in assigned:
+ self.env.warn_node('%s is already assigned section numbers '
+ '(nested numbered toctree?)' % ref,
+ toctreenode, type='toc', subtype='secnum')
+ elif ref in self.tocs:
secnums = self.toc_secnumbers[ref] = {}
assigned.add(ref)
_walk_toc(self.tocs[ref], secnums, depth,
diff --git a/sphinx/highlighting.py b/sphinx/highlighting.py
index 4b4ba87da..198939197 100644
--- a/sphinx/highlighting.py
+++ b/sphinx/highlighting.py
@@ -144,7 +144,7 @@ class PygmentsBridge(object):
elif warn:
warn('Could not lex literal_block as "%s". '
'Highlighting skipped.' % lang,
- type='misc', subtype='higlighting_failure')
+ type='misc', subtype='highlighting_failure')
else:
raise exc
hlsource = highlight(source, lexers['none'], formatter)
diff --git a/sphinx/search/__init__.py b/sphinx/search/__init__.py
index 23dc869ee..8f2935227 100644
--- a/sphinx/search/__init__.py
+++ b/sphinx/search/__init__.py
@@ -414,7 +414,7 @@ class IndexBuilder(object):
def get_js_stemmer_rawcode(self):
if self.lang.js_stemmer_rawcode:
return path.join(
- path.dirname(path.abspath(__file__)),
+ sphinx.package_dir, 'search',
'non-minified-js',
self.lang.js_stemmer_rawcode
)
diff --git a/sphinx/util/__init__.py b/sphinx/util/__init__.py
index d682ad522..e650f7aa9 100644
--- a/sphinx/util/__init__.py
+++ b/sphinx/util/__init__.py
@@ -211,9 +211,10 @@ def save_traceback(app):
modfile = getattr(extmod, '__file__', 'unknown')
if isinstance(modfile, bytes):
modfile = modfile.decode(fs_encoding, 'replace')
- os.write(fd, ('# %s (%s) from %s\n' % (
- extname, app._extension_metadata[extname]['version'],
- modfile)).encode('utf-8'))
+ version = app._extension_metadata[extname]['version']
+ if version != 'builtin':
+ os.write(fd, ('# %s (%s) from %s\n' %
+ (extname, version, modfile)).encode('utf-8'))
os.write(fd, exc_format.encode('utf-8'))
os.close(fd)
return path
diff --git a/sphinx/writers/html.py b/sphinx/writers/html.py
index ebffa2f28..016c04bd6 100644
--- a/sphinx/writers/html.py
+++ b/sphinx/writers/html.py
@@ -343,6 +343,27 @@ class HTMLTranslator(BaseTranslator):
if isinstance(node.parent, nodes.table):
self.body.append('')
+ def depart_title(self, node):
+ close_tag = self.context[-1]
+ if (self.permalink_text and self.builder.add_permalinks and
+ node.parent.hasattr('ids') and node.parent['ids']):
+ # add permalink anchor
+ if close_tag.startswith('')
+ self.add_permalink_ref(node.parent, _('Permalink to this table'))
+ elif isinstance(node.parent, nodes.table):
+ self.body.append('')
+
+ BaseTranslator.depart_title(self, node)
+
# overwritten
def visit_literal_block(self, node):
if node.rawsource != node.astext():
@@ -709,25 +730,6 @@ class HTMLTranslator(BaseTranslator):
def depart_manpage(self, node):
return self.depart_literal_emphasis(node)
- def depart_title(self, node):
- close_tag = self.context[-1]
- if (self.permalink_text and self.builder.add_permalinks and
- node.parent.hasattr('ids') and node.parent['ids']):
- # add permalink anchor
- if close_tag.startswith('