' in content
+ else:
+ global_toc = (
+ '
'
+ )
+ local_toc = (
+ '
'
+ )
+ assert global_toc in content
+ assert local_toc not in content
+ else:
+ global_toc = '
\n
'
+ local_toc = (
+ '
'
+ )
+ assert global_toc in content
+ assert local_toc not in content
+
+
+def test_missing_toctree():
+ """Local TOC is showing, as toctree was missing"""
+ for (app, status, warning) in build_all('test-missing-toctree'):
+ assert app.env.get_doctree('index').traverse(addnodes.toctree) == []
+ content = open(os.path.join(app.outdir, 'index.html')).read()
+ assert '
' in content
diff --git a/doc/source/_themes/sphinx_rtd_theme/tests/util.py b/doc/source/_themes/sphinx_rtd_theme/tests/util.py
new file mode 100644
index 00000000000..cf81029b8d8
--- /dev/null
+++ b/doc/source/_themes/sphinx_rtd_theme/tests/util.py
@@ -0,0 +1,60 @@
+from __future__ import print_function
+
+import os
+import tempfile
+import shutil
+from contextlib import contextmanager
+
+import pytest
+from sphinx.application import Sphinx
+
+try:
+ from StringIO import StringIO
+except ImportError:
+ from io import StringIO
+
+
+@contextmanager
+def build(root, builder='html', **kwargs):
+ tmpdir = tempfile.mkdtemp()
+
+ srcdir = os.path.join(os.path.dirname(__file__), 'roots', root)
+ destdir = os.path.join(tmpdir, builder)
+ doctreedir = os.path.join(tmpdir, 'doctree/')
+
+ status = StringIO()
+ warning = StringIO()
+
+ kwargs.update({
+ 'status': status,
+ 'warning': warning,
+ })
+
+ confoverrides = kwargs.pop('confoverrides', {})
+ confoverrides['html_theme'] = 'sphinx_rtd_theme'
+ extensions = confoverrides.get('extensions', [])
+ extensions.append('readthedocs_ext.readthedocs')
+ confoverrides['extensions'] = extensions
+ kwargs['confoverrides'] = confoverrides
+
+ try:
+ app = Sphinx(srcdir, srcdir, destdir, doctreedir, builder, **kwargs)
+ app.builder.build_all()
+ yield (app, status.getvalue(), warning.getvalue())
+ except Exception as e:
+ print('# root:', root)
+ print('# builder:', builder)
+ print('# source:', srcdir)
+ print('# destination:', destdir)
+ print('# status:', '\n' + status.getvalue())
+ print('# warning:', '\n' + warning.getvalue())
+ raise
+ finally:
+ shutil.rmtree(tmpdir)
+
+
+def build_all(root, **kwargs):
+ for builder in ['html', 'singlehtml', 'readthedocs', 'readthedocsdirhtml',
+ 'readthedocssinglehtml', 'readthedocssinglehtmllocalmedia']:
+ with build(root, builder, **kwargs) as ret:
+ yield ret
diff --git a/doc/source/_themes/sphinx_rtd_theme/tox.ini b/doc/source/_themes/sphinx_rtd_theme/tox.ini
new file mode 100644
index 00000000000..d6a0a034c89
--- /dev/null
+++ b/doc/source/_themes/sphinx_rtd_theme/tox.ini
@@ -0,0 +1,23 @@
+[tox]
+envlist = py{27,34,35,36}-sphinx{13,14,15,16}
+
+[travis]
+python =
+ 2.7: py27-sphinx{13,14,15,16}
+ 3.4: py34-sphinx{13,14,15,16}
+ 3.5: py35-sphinx{13,14,15,16}
+ 3.6: py36-sphinx{13,14,15,16}
+
+[testenv]
+setev =
+ LANG=C
+deps =
+ .
+ readthedocs-sphinx-ext
+ pytest
+ sphinx13: Sphinx < 1.4
+ sphinx14: Sphinx < 1.5
+ sphinx15: Sphinx < 1.6
+ sphinx16: Sphinx < 1.7
+commands =
+ py.test {posargs}
diff --git a/doc/source/conf.py b/doc/source/conf.py
index f94a5ec8960..538b9763b8b 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -18,6 +18,7 @@
#
import os
import sys
+#import sphinx_rtd_theme
sys.path.insert(0, os.path.abspath('../../scripts/lib'))
sys.path.insert(1, os.path.abspath('../../scripts'))
@@ -64,9 +65,9 @@
# built documents.
#
# The short X.Y version.
-version = u'5.6'
+version = u'master'
# The full version, including alpha/beta/rc tags.
-release = u'5.6'
+release = u'master'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
@@ -78,7 +79,7 @@
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
-exclude_patterns = []
+exclude_patterns = ["_themes/**"]
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
@@ -94,15 +95,25 @@
#
#html_theme = 'alabaster'
#html_theme = 'bizstyle'
-html_theme = 'classic'
-#html_theme = 'sphinx_rtd_theme'
+#html_theme = 'classic'
+html_theme = 'sphinx_rtd_theme'
+html_theme_path = ["_themes/sphinx_rtd_theme", ]
#html_theme = 'sphinxdoc'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
-html_theme_options = {"stickysidebar": "true"}
+#html_theme_options = {"stickysidebar": "true"}
+
+# The 'versions' option needs to have at least two versions to work, but it doesn't need
+# to have all versions: others will be added dynamically. Note that this maps from version
+# names to html links. The current version can link to the current location (i.e., do
+# nothing). For the other version, we just add a place-holder; its name and value are
+# unimportant because these versions will get replaced dynamically.
+html_theme_options = {}
+html_theme_options['versions'] = {version: ''}
+html_theme_options['versions']['[placeholder]'] = ''
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,