This could fix https://github.com/sphinx-doc/sphinx/issues/2262
The 1.3.5 Verbatim environment from sphinx.sty has many places allowing
a page break after the caption: from the \smallskip, from the list
environment, and from the \MakeFramed: indeed framed package
documentation explains that it encourages page breaks above it.
The only way to avoid the pagebreaks is to put the caption inside the
environment whic is started by \MakeFramed. However, as this environment
typesets multiple times its contents, we must inhibit within it the
increase of counters (only the literal-block counter is concerned), this
is done thanks to a switch provided by the package amsmath which is
already loaded by sphinx.sty.
modified: sphinx/texinputs/sphinx.sty
modified: sphinx/writers/latex.py
modified: tests/test_directive_code.py
Otherwise the build can fail with the following error:
File "/usr/lib/python2.7/dist-packages/sphinx/environment.py", line 791, in read_doc
pub.publish()
File "/usr/lib/python2.7/dist-packages/docutils/core.py", line 218, in publish
self.apply_transforms()
File "/usr/lib/python2.7/dist-packages/docutils/core.py", line 199, in apply_transforms
self.document.transformer.apply_transforms()
File "/usr/lib/python2.7/dist-packages/docutils/transforms/__init__.py", line 171, in apply_transforms
transform.apply(**kwargs)
File "/usr/lib/python2.7/dist-packages/sphinx/transforms.py", line 124, in apply
if has_child(node.parent, nodes.caption):
File "/usr/lib/python2.7/dist-packages/sphinx/transforms.py", line 117, in has_child
return any(isinstance(child, cls) for child in node)
TypeError: 'NoneType' object is not iterable
The error could be reproduced with lp:autopilot/legacy branch from Launchpad.
There is no need to pull these dependencies if i.e. the documentation is
using the classic theme.
There will be no change in behavior for projects using alabaster or
sphinx_rtd_theme.
In my current environment with Win10+Py2.7.10, SpoofOut result string doesn't necessary to decode. This commit might cause regression in older python versions....