mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #6887: Sphinx crashes with docutils-0.16b0
This commit is contained in:
parent
1a54a7229c
commit
faedcc48cc
@ -25,7 +25,8 @@ matrix:
|
||||
- TOXENV=du15
|
||||
- PYTEST_ADDOPTS="--cov ./ --cov-append --cov-config setup.cfg"
|
||||
- python: 'nightly'
|
||||
env: TOXENV=py38
|
||||
env:
|
||||
- TOXENV=du16
|
||||
- python: '3.6'
|
||||
env: TOXENV=docs
|
||||
- python: '3.6'
|
||||
|
1
CHANGES
1
CHANGES
@ -84,6 +84,7 @@ Bugs fixed
|
||||
* #6886: LaTeX: xelatex converts straight double quotes into right curly ones
|
||||
(shows when :confval:`smartquotes` is ``False``)
|
||||
* #6876: LaTeX: multi-line display of authors on title page has ragged edges
|
||||
* #6887: Sphinx crashes with docutils-0.16b0
|
||||
|
||||
Testing
|
||||
--------
|
||||
|
@ -234,14 +234,13 @@ class LaTeXBuilder(Builder):
|
||||
destination = SphinxFileOutput(destination_path=path.join(self.outdir, targetname),
|
||||
encoding='utf-8', overwrite_if_changed=True)
|
||||
with progress_message(__("processing %s") % targetname):
|
||||
toctrees = self.env.get_doctree(docname).traverse(addnodes.toctree)
|
||||
if toctrees:
|
||||
if toctrees[0].get('maxdepth') > 0:
|
||||
tocdepth = toctrees[0].get('maxdepth')
|
||||
else:
|
||||
tocdepth = None
|
||||
doctree = self.env.get_doctree(docname)
|
||||
toctree = next(iter(doctree.traverse(addnodes.toctree)), None)
|
||||
if toctree and toctree.get('maxdepth') > 0:
|
||||
tocdepth = toctree.get('maxdepth')
|
||||
else:
|
||||
tocdepth = None
|
||||
|
||||
doctree = self.assemble_doctree(
|
||||
docname, toctree_only,
|
||||
appendices=((docclass != 'howto') and self.config.latex_appendices or []))
|
||||
|
@ -612,15 +612,13 @@ class StandardDomain(Domain):
|
||||
sectname = self.get_numfig_title(node)
|
||||
if not sectname:
|
||||
continue
|
||||
elif node.traverse(addnodes.toctree):
|
||||
n = node.traverse(addnodes.toctree)[0]
|
||||
if n.get('caption'):
|
||||
sectname = n['caption']
|
||||
else:
|
||||
continue
|
||||
else:
|
||||
# anonymous-only labels
|
||||
continue
|
||||
toctree = next(iter(node.traverse(addnodes.toctree)), None)
|
||||
if toctree and toctree.get('caption'):
|
||||
sectname = toctree.get('caption')
|
||||
else:
|
||||
# anonymous-only labels
|
||||
continue
|
||||
self.labels[name] = docname, labelid, sectname
|
||||
|
||||
def add_object(self, objtype: str, name: str, docname: str, labelid: str) -> None:
|
||||
|
@ -148,7 +148,7 @@ def apply_source_workaround(node: Element) -> None:
|
||||
logger.debug('[i18n] PATCH: %r to have rawsource: %s',
|
||||
get_full_module_name(node), repr_domxml(node))
|
||||
# strip classifier from rawsource of term
|
||||
for classifier in reversed(node.parent.traverse(nodes.classifier)):
|
||||
for classifier in reversed(list(node.parent.traverse(nodes.classifier))):
|
||||
node.rawsource = re.sub(r'\s*:\s*%s' % re.escape(classifier.astext()),
|
||||
'', node.rawsource)
|
||||
|
||||
|
@ -573,7 +573,7 @@ def test_literalinclude_pydecorators(app, status, warning):
|
||||
def test_code_block_highlighted(app, status, warning):
|
||||
app.builder.build(['highlight'])
|
||||
doctree = app.env.get_doctree('highlight')
|
||||
codeblocks = doctree.traverse(nodes.literal_block)
|
||||
codeblocks = list(doctree.traverse(nodes.literal_block))
|
||||
|
||||
assert codeblocks[0]['language'] == 'default'
|
||||
assert codeblocks[1]['language'] == 'python2'
|
||||
|
Loading…
Reference in New Issue
Block a user