mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge branch 'stable' into 3256_update_release_script
This commit is contained in:
commit
ed6742fe2a
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,6 +4,7 @@
|
|||||||
*.swp
|
*.swp
|
||||||
|
|
||||||
.dir-locals.el
|
.dir-locals.el
|
||||||
|
.mypy_cache/
|
||||||
.ropeproject/
|
.ropeproject/
|
||||||
TAGS
|
TAGS
|
||||||
.tags
|
.tags
|
||||||
|
18
.travis.yml
18
.travis.yml
@ -7,6 +7,7 @@ python:
|
|||||||
- "2.7"
|
- "2.7"
|
||||||
- "3.4"
|
- "3.4"
|
||||||
- "3.5"
|
- "3.5"
|
||||||
|
- "3.6"
|
||||||
- "nightly"
|
- "nightly"
|
||||||
- "pypy"
|
- "pypy"
|
||||||
env:
|
env:
|
||||||
@ -17,6 +18,16 @@ env:
|
|||||||
matrix:
|
matrix:
|
||||||
- DOCUTILS=0.12
|
- DOCUTILS=0.12
|
||||||
- DOCUTILS=0.13.1
|
- 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:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
packages:
|
packages:
|
||||||
@ -31,8 +42,7 @@ install:
|
|||||||
- pip install -U pip setuptools
|
- pip install -U pip setuptools
|
||||||
- pip install docutils==$DOCUTILS
|
- pip install docutils==$DOCUTILS
|
||||||
- pip install -r test-reqs.txt
|
- pip install -r test-reqs.txt
|
||||||
before_script:
|
|
||||||
- if [[ $TRAVIS_PYTHON_VERSION != '2.6' ]]; then flake8; fi
|
|
||||||
script:
|
script:
|
||||||
- if [[ $TRAVIS_PYTHON_VERSION == '3.5' ]]; then make style-check test-async; fi
|
- flake8
|
||||||
- if [[ $TRAVIS_PYTHON_VERSION != '3.5' ]]; then make test; fi
|
- if [[ $TRAVIS_PYTHON_VERSION == '3.6' ]]; then make style-check test-async; fi
|
||||||
|
- if [[ $TRAVIS_PYTHON_VERSION != '3.6' ]]; then make test; fi
|
||||||
|
5
CHANGES
5
CHANGES
@ -6,6 +6,7 @@ Features added
|
|||||||
|
|
||||||
* #3241: emit latex warning if buggy titlesec (ref #3210)
|
* #3241: emit latex warning if buggy titlesec (ref #3210)
|
||||||
* #3194: Refer the $MAKE environment variable to determine ``make`` command
|
* #3194: Refer the $MAKE environment variable to determine ``make`` command
|
||||||
|
* Emit warning for nested numbered toctrees (refs: #3142)
|
||||||
|
|
||||||
Bugs fixed
|
Bugs fixed
|
||||||
----------
|
----------
|
||||||
@ -17,6 +18,10 @@ Bugs fixed
|
|||||||
* #3255: In Py3.4 environment, autodoc doesn't support documentation for
|
* #3255: In Py3.4 environment, autodoc doesn't support documentation for
|
||||||
attributes of Enum class correctly.
|
attributes of Enum class correctly.
|
||||||
* #3261: ``latex_use_parts`` makes sphinx crash
|
* #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)
|
Release 1.5.1 (released Dec 13, 2016)
|
||||||
=====================================
|
=====================================
|
||||||
|
@ -233,6 +233,7 @@ General configuration
|
|||||||
* ref.citation
|
* ref.citation
|
||||||
* ref.doc
|
* ref.doc
|
||||||
* misc.highlighting_failure
|
* misc.highlighting_failure
|
||||||
|
* toc.secnum
|
||||||
* epub.unknown_project_files
|
* epub.unknown_project_files
|
||||||
|
|
||||||
You can choose from these types.
|
You can choose from these types.
|
||||||
|
@ -79,8 +79,8 @@ sidebar and under "Quick Links", click "Windows Installer" to download.
|
|||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
Currently, Python offers two major versions, 2.x and 3.x. Sphinx 1.3 can run
|
Currently, Python offers two major versions, 2.x and 3.x. Sphinx 1.5 can run
|
||||||
under Python 2.7, 3.4, 3.5, with the recommended version being 2.7. This
|
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.
|
chapter assumes you have installed Python 2.7.
|
||||||
|
|
||||||
Follow the Windows installer for Python.
|
Follow the Windows installer for Python.
|
||||||
|
@ -26,4 +26,4 @@ universal = 1
|
|||||||
[flake8]
|
[flake8]
|
||||||
max-line-length = 95
|
max-line-length = 95
|
||||||
ignore = E113,E116,E221,E226,E241,E251,E901
|
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
|
@ -806,7 +806,8 @@ class Sphinx(object):
|
|||||||
|
|
||||||
def add_latex_package(self, packagename, options=None):
|
def add_latex_package(self, packagename, options=None):
|
||||||
self.debug('[app] adding latex package: %r', packagename)
|
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):
|
def add_lexer(self, alias, lexer):
|
||||||
self.debug('[app] adding lexer: %r', (alias, lexer))
|
self.debug('[app] adding lexer: %r', (alias, lexer))
|
||||||
|
@ -268,13 +268,28 @@ def validate_config_values(app):
|
|||||||
app.config.latex_elements['postamble'] = app.config.latex_elements['footer']
|
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):
|
def setup(app):
|
||||||
app.add_builder(LaTeXBuilder)
|
app.add_builder(LaTeXBuilder)
|
||||||
app.connect('builder-inited', validate_config_values)
|
app.connect('builder-inited', validate_config_values)
|
||||||
|
|
||||||
app.add_config_value('latex_engine',
|
app.add_config_value('latex_engine', default_latex_engine, None,
|
||||||
lambda self: 'pdflatex' if self.language != 'ja' else 'platex',
|
|
||||||
None,
|
|
||||||
ENUM('pdflatex', 'xelatex', 'lualatex', 'platex'))
|
ENUM('pdflatex', 'xelatex', 'lualatex', 'platex'))
|
||||||
app.add_config_value('latex_documents',
|
app.add_config_value('latex_documents',
|
||||||
lambda self: [(self.master_doc, make_filename(self.project) + '.tex',
|
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_elements', {}, None)
|
||||||
app.add_config_value('latex_additional_files', [], None)
|
app.add_config_value('latex_additional_files', [], None)
|
||||||
|
|
||||||
japanese_default = {'manual': 'jsbook',
|
app.add_config_value('latex_docclass', default_latex_docclass, None)
|
||||||
'howto': 'jreport'}
|
|
||||||
app.add_config_value('latex_docclass',
|
|
||||||
lambda self: japanese_default if self.language == 'ja' else {},
|
|
||||||
None)
|
|
||||||
# now deprecated - use latex_elements
|
# now deprecated - use latex_elements
|
||||||
app.add_config_value('latex_preamble', '', None)
|
app.add_config_value('latex_preamble', '', None)
|
||||||
|
|
||||||
|
@ -464,10 +464,14 @@ class Toctree(EnvironmentManager):
|
|||||||
if depth == 0:
|
if depth == 0:
|
||||||
return
|
return
|
||||||
for (title, ref) in toctreenode['entries']:
|
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
|
# don't mess with those
|
||||||
continue
|
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] = {}
|
secnums = self.toc_secnumbers[ref] = {}
|
||||||
assigned.add(ref)
|
assigned.add(ref)
|
||||||
_walk_toc(self.tocs[ref], secnums, depth,
|
_walk_toc(self.tocs[ref], secnums, depth,
|
||||||
|
@ -144,7 +144,7 @@ class PygmentsBridge(object):
|
|||||||
elif warn:
|
elif warn:
|
||||||
warn('Could not lex literal_block as "%s". '
|
warn('Could not lex literal_block as "%s". '
|
||||||
'Highlighting skipped.' % lang,
|
'Highlighting skipped.' % lang,
|
||||||
type='misc', subtype='higlighting_failure')
|
type='misc', subtype='highlighting_failure')
|
||||||
else:
|
else:
|
||||||
raise exc
|
raise exc
|
||||||
hlsource = highlight(source, lexers['none'], formatter)
|
hlsource = highlight(source, lexers['none'], formatter)
|
||||||
|
@ -414,7 +414,7 @@ class IndexBuilder(object):
|
|||||||
def get_js_stemmer_rawcode(self):
|
def get_js_stemmer_rawcode(self):
|
||||||
if self.lang.js_stemmer_rawcode:
|
if self.lang.js_stemmer_rawcode:
|
||||||
return path.join(
|
return path.join(
|
||||||
path.dirname(path.abspath(__file__)),
|
sphinx.package_dir, 'search',
|
||||||
'non-minified-js',
|
'non-minified-js',
|
||||||
self.lang.js_stemmer_rawcode
|
self.lang.js_stemmer_rawcode
|
||||||
)
|
)
|
||||||
|
@ -211,9 +211,10 @@ def save_traceback(app):
|
|||||||
modfile = getattr(extmod, '__file__', 'unknown')
|
modfile = getattr(extmod, '__file__', 'unknown')
|
||||||
if isinstance(modfile, bytes):
|
if isinstance(modfile, bytes):
|
||||||
modfile = modfile.decode(fs_encoding, 'replace')
|
modfile = modfile.decode(fs_encoding, 'replace')
|
||||||
os.write(fd, ('# %s (%s) from %s\n' % (
|
version = app._extension_metadata[extname]['version']
|
||||||
extname, app._extension_metadata[extname]['version'],
|
if version != 'builtin':
|
||||||
modfile)).encode('utf-8'))
|
os.write(fd, ('# %s (%s) from %s\n' %
|
||||||
|
(extname, version, modfile)).encode('utf-8'))
|
||||||
os.write(fd, exc_format.encode('utf-8'))
|
os.write(fd, exc_format.encode('utf-8'))
|
||||||
os.close(fd)
|
os.close(fd)
|
||||||
return path
|
return path
|
||||||
|
@ -343,6 +343,27 @@ class HTMLTranslator(BaseTranslator):
|
|||||||
if isinstance(node.parent, nodes.table):
|
if isinstance(node.parent, nodes.table):
|
||||||
self.body.append('<span class="caption-text">')
|
self.body.append('<span class="caption-text">')
|
||||||
|
|
||||||
|
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('</h'):
|
||||||
|
self.add_permalink_ref(node.parent, _('Permalink to this headline'))
|
||||||
|
elif close_tag.startswith('</a></h'):
|
||||||
|
self.body.append(u'</a><a class="headerlink" href="#%s" ' %
|
||||||
|
node.parent['ids'][0] +
|
||||||
|
u'title="%s">%s' % (
|
||||||
|
_('Permalink to this headline'),
|
||||||
|
self.permalink_text))
|
||||||
|
elif isinstance(node.parent, nodes.table):
|
||||||
|
self.body.append('</span>')
|
||||||
|
self.add_permalink_ref(node.parent, _('Permalink to this table'))
|
||||||
|
elif isinstance(node.parent, nodes.table):
|
||||||
|
self.body.append('</span>')
|
||||||
|
|
||||||
|
BaseTranslator.depart_title(self, node)
|
||||||
|
|
||||||
# overwritten
|
# overwritten
|
||||||
def visit_literal_block(self, node):
|
def visit_literal_block(self, node):
|
||||||
if node.rawsource != node.astext():
|
if node.rawsource != node.astext():
|
||||||
@ -709,25 +730,6 @@ class HTMLTranslator(BaseTranslator):
|
|||||||
def depart_manpage(self, node):
|
def depart_manpage(self, node):
|
||||||
return self.depart_literal_emphasis(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('</h'):
|
|
||||||
self.add_permalink_ref(node.parent, _('Permalink to this headline'))
|
|
||||||
elif close_tag.startswith('</a></h'):
|
|
||||||
self.body.append(u'</a><a class="headerlink" href="#%s" ' %
|
|
||||||
node.parent['ids'][0] +
|
|
||||||
u'title="%s">%s' % (
|
|
||||||
_('Permalink to this headline'),
|
|
||||||
self.permalink_text))
|
|
||||||
elif isinstance(node.parent, nodes.table):
|
|
||||||
self.body.append('</span>')
|
|
||||||
self.add_permalink_ref(node.parent, _('Permalink to this table'))
|
|
||||||
|
|
||||||
BaseTranslator.depart_title(self, node)
|
|
||||||
|
|
||||||
# overwritten to add even/odd classes
|
# overwritten to add even/odd classes
|
||||||
|
|
||||||
def visit_table(self, node):
|
def visit_table(self, node):
|
||||||
|
@ -50,7 +50,7 @@ def kpsetest(*filenames):
|
|||||||
except OSError:
|
except OSError:
|
||||||
# no kpsewhich... either no tex distribution is installed or it is
|
# no kpsewhich... either no tex distribution is installed or it is
|
||||||
# a "strange" one -- don't bother running latex
|
# a "strange" one -- don't bother running latex
|
||||||
return None
|
return False
|
||||||
else:
|
else:
|
||||||
p.communicate()
|
p.communicate()
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
@ -84,8 +84,8 @@ def compile_latex_document(app):
|
|||||||
|
|
||||||
def skip_if_stylefiles_notfound(testfunc):
|
def skip_if_stylefiles_notfound(testfunc):
|
||||||
if kpsetest(*STYLEFILES) is False:
|
if kpsetest(*STYLEFILES) is False:
|
||||||
return skip_if(testfunc,
|
msg = 'not running latex, the required styles do not seem to be installed'
|
||||||
'not running latex, the required styles do not seem to be installed')
|
return skip_if(True, msg)(testfunc)
|
||||||
else:
|
else:
|
||||||
return testfunc
|
return testfunc
|
||||||
|
|
||||||
|
18
tox.ini
18
tox.ini
@ -1,20 +1,21 @@
|
|||||||
[tox]
|
[tox]
|
||||||
envlist=flake8,py27,py34,py35,pypy,du12,du11,du10
|
envlist=flake8,py27,py34,py35,py36,pypy,du13,du12,du11
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
deps=
|
deps=
|
||||||
six
|
six
|
||||||
nose
|
nose
|
||||||
docutils
|
|
||||||
sqlalchemy
|
sqlalchemy
|
||||||
whoosh
|
whoosh
|
||||||
html5lib
|
html5lib
|
||||||
mock
|
mock
|
||||||
|
enum34
|
||||||
typing
|
typing
|
||||||
setenv =
|
setenv =
|
||||||
SPHINX_TEST_TEMPDIR = {envdir}/testbuild
|
SPHINX_TEST_TEMPDIR = {envdir}/testbuild
|
||||||
|
PYTHONDONTWRITEBYTECODE = true
|
||||||
commands=
|
commands=
|
||||||
{envpython} -Wall tests/run.py -I py35 -m '^[tT]est' {posargs}
|
{envpython} -Wall tests/run.py --ignore-files=test_autodoc_py35 -m '^[tT]est' {posargs}
|
||||||
sphinx-build -q -W -b html -d {envtmpdir}/doctrees doc {envtmpdir}/html
|
sphinx-build -q -W -b html -d {envtmpdir}/doctrees doc {envtmpdir}/html
|
||||||
|
|
||||||
[testenv:pypy]
|
[testenv:pypy]
|
||||||
@ -22,11 +23,6 @@ deps=
|
|||||||
simplejson
|
simplejson
|
||||||
{[testenv]deps}
|
{[testenv]deps}
|
||||||
|
|
||||||
[testenv:du10]
|
|
||||||
deps=
|
|
||||||
docutils==0.10
|
|
||||||
{[testenv]deps}
|
|
||||||
|
|
||||||
[testenv:du11]
|
[testenv:du11]
|
||||||
deps=
|
deps=
|
||||||
docutils==0.11
|
docutils==0.11
|
||||||
@ -37,13 +33,17 @@ deps=
|
|||||||
docutils==0.12
|
docutils==0.12
|
||||||
{[testenv]deps}
|
{[testenv]deps}
|
||||||
|
|
||||||
|
[testenv:du13]
|
||||||
|
deps=
|
||||||
|
docutils==0.13.1
|
||||||
|
{[testenv]deps}
|
||||||
|
|
||||||
[testenv:flake8]
|
[testenv:flake8]
|
||||||
deps=flake8
|
deps=flake8
|
||||||
commands=flake8
|
commands=flake8
|
||||||
|
|
||||||
[testenv:py27]
|
[testenv:py27]
|
||||||
deps=
|
deps=
|
||||||
enum34
|
|
||||||
{[testenv]deps}
|
{[testenv]deps}
|
||||||
|
|
||||||
[testenv:py35]
|
[testenv:py35]
|
||||||
|
Loading…
Reference in New Issue
Block a user