' 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
deleted file mode 100644
index cf81029b..00000000
--- a/doc/source/_themes/sphinx_rtd_theme/tests/util.py
+++ /dev/null
@@ -1,60 +0,0 @@
-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
deleted file mode 100644
index d6a0a034..00000000
--- a/doc/source/_themes/sphinx_rtd_theme/tox.ini
+++ /dev/null
@@ -1,23 +0,0 @@
-[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
deleted file mode 100644
index 37102fa1..00000000
--- a/doc/source/conf.py
+++ /dev/null
@@ -1,173 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# cismdoc documentation build configuration file, created by
-# sphinx-quickstart on Mon Mar 6 15:53:20 2017.
-#
-# This file is execfile()d with the current directory set to its
-# containing dir.
-#
-# Note that not all possible configuration values are present in this
-# autogenerated file.
-#
-# All configuration values have a default; values that are commented out
-# serve to show the default.
-
-# If extensions (or modules to document with autodoc) are in another directory,
-# add these directories to sys.path here. If the directory is relative to the
-# documentation root, use os.path.abspath to make it absolute, like shown here.
-#
-# import os
-# import sys
-# sys.path.insert(0, os.path.abspath('.'))
-
-
-# -- General configuration ------------------------------------------------
-
-# If your documentation needs a minimal Sphinx version, state it here.
-#
-# needs_sphinx = '1.0'
-
-# Add any Sphinx extension module names here, as strings. They can be
-# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
-# ones.
-extensions = ['sphinx.ext.doctest',
- 'sphinx.ext.autodoc',
- 'sphinx.ext.intersphinx',
- 'sphinx.ext.todo',
- 'sphinx.ext.coverage',
- 'sphinx.ext.mathjax',
- 'sphinx.ext.githubpages']
-
-# Add any paths that contain templates here, relative to this directory.
-templates_path = ['_templates']
-
-# The suffix(es) of source filenames.
-# You can specify multiple suffix as a list of string:
-#
-# source_suffix = ['.rst', '.md']
-source_suffix = '.rst'
-
-# The master toctree document.
-master_doc = 'index'
-
-# General information about the project.
-project = u'CESM Land Ice'
-copyright = u'2018, Gunter Leguy, William Lipscomb, Bill Sacks'
-author = u'Gunter Leguy, William Lipscomb, Bill Sacks'
-
-# The version info for the project you're documenting, acts as replacement for
-# |version| and |release|, also used in various other places throughout the
-# built documents.
-#
-# The short X.Y version.
-version = u'master'
-# The full version, including alpha/beta/rc tags.
-release = u'master'
-
-# The language for content autogenerated by Sphinx. Refer to documentation
-# for a list of supported languages.
-#
-# This is also used if you do content translation via gettext catalogs.
-# Usually you set "language" from the command line for these cases.
-language = None
-
-# 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 = ["_themes/**"]
-
-# The name of the Pygments (syntax highlighting) style to use.
-pygments_style = 'sphinx'
-
-# If true, `todo` and `todoList` produce output, else they produce nothing.
-todo_include_todos = True
-
-
-# -- Options for HTML output ----------------------------------------------
-
-# The theme to use for HTML and HTML Help pages. See the documentation for
-# a list of builtin themes.
-#
-html_theme = "sphinx_rtd_theme"
-html_theme_path = ["_themes/sphinx_rtd_theme", ]
-
-# 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 = {}
-# 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['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,
-# so a file named "default.css" will overwrite the builtin "default.css".
-html_static_path = ['_static']
-
-
-# -- Options for HTMLHelp output ------------------------------------------
-
-# Output file base name for HTML help builder.
-htmlhelp_basename = 'cism_in_cesm_doc'
-
-
-# -- Options for LaTeX output ---------------------------------------------
-
-latex_elements = {
- # The paper size ('letterpaper' or 'a4paper').
- #
- # 'papersize': 'letterpaper',
-
- # The font size ('10pt', '11pt' or '12pt').
- #
- # 'pointsize': '10pt',
-
- # Additional stuff for the LaTeX preamble.
- #
- # 'preamble': '',
-
- # Latex figure (float) alignment
- #
- # 'figure_align': 'htbp',
-}
-
-# Grouping the document tree into LaTeX files. List of tuples
-# (source start file, target name, title,
-# author, documentclass [howto, manual, or own class]).
-latex_documents = [
- (master_doc, 'cismdoc.tex', u'CESM Land Ice Documentation',
- u'Gunter Leguy, William Lipscomb, Bill Sacks', 'manual'),
-]
-
-
-# -- Options for manual page output ---------------------------------------
-
-# One entry per manual page. List of tuples
-# (source start file, name, description, authors, manual section).
-man_pages = [
- (master_doc, 'cismdoc', u'CESM Land Ice Documentation',
- [author], 1)
-]
-
-
-# -- Options for Texinfo output -------------------------------------------
-
-# Grouping the document tree into Texinfo files. List of tuples
-# (source start file, target name, title, author,
-# dir menu entry, description, category)
-texinfo_documents = [
- (master_doc, 'cismdoc', u'cismdoc Documentation',
- author, 'cismdoc', 'One line description of project.',
- 'Miscellaneous'),
-]
-
-
-
-
-# Example configuration for intersphinx: refer to the Python standard library.
-intersphinx_mapping = {'https://docs.python.org/': None}
diff --git a/doc/substitutions.py b/doc/substitutions.py
new file mode 100644
index 00000000..b5cd20bd
--- /dev/null
+++ b/doc/substitutions.py
@@ -0,0 +1,76 @@
+"""
+Substitutions for Sphinx
+"""
+
+# The version info for the project you're documenting, acts as replacement for
+# |version| and |release|, also used in various other places throughout the
+# built documents.
+
+# pylint: disable=invalid-name
+
+#################################
+### Standard Sphinx variables ###
+#################################
+
+# General information about the project.
+project = u'CESM Land Ice'
+copyright = u'2018, Gunter Leguy, William Lipscomb, Bill Sacks' # pylint: disable=redefined-builtin
+author = u'Gunter Leguy, William Lipscomb, Bill Sacks'
+
+# The short X.Y version.
+version = u'master'
+
+# The full version, including alpha/beta/rc tags.
+release = u'master'
+
+#####################################################
+### Custom variables needed for doc-builder setup ###
+#####################################################
+
+# Version label used at the top of some pages.
+version_label = "the latest development code"
+
+#######################################################
+### Custom variables optional for doc-builder setup ###
+#######################################################
+
+tex_category = "Miscellaneous"
+
+# Used by HTML help builder
+htmlhelp = {
+ "basename": "cismwrapdocdoc", # Output file base name
+}
+
+# Used for LaTeX output
+latex = {
+ "target_name": "cismwrapdoc.tex",
+ "title": "CISM Wrapper Documentation",
+ "documentclass": "manual", # howto, manual, or own class
+ "category": tex_category,
+}
+
+# Used for man_pages and texinfo_documents
+mantex = {
+ "name": "cismwrapdoc",
+ "title": "cismwrapdoc Documentation",
+}
+
+# Used for texinfo_documents
+tex = {
+ "dirmenu_entry": "cismwrapdoc",
+ "description": "One line description of project.",
+ "category": tex_category,
+}
+
+###############################
+### Purely custom variables ###
+###############################
+
+nonparamfile_disclaimer_md = (
+ "**Note:** The values here should be up-to-date with those used in {{version_label}},"
+ " but there may be mistakes."
+)
+nonparamfile_disclaimer_rst = (
+ "**Note:** The values here should be up-to-date with those used in |version_label|,"
+ " but there may be mistakes."
+)
diff --git a/doc/version_list.py b/doc/version_list.py
new file mode 100644
index 00000000..20a5202c
--- /dev/null
+++ b/doc/version_list.py
@@ -0,0 +1,36 @@
+"""
+Define the versions we want to build
+"""
+import sys
+import os
+dir2add = os.path.join(os.path.dirname(__file__), "doc-builder")
+if not os.path.exists(dir2add):
+ raise FileNotFoundError(dir2add)
+sys.path.insert(0, dir2add)
+# pylint: disable=wrong-import-position
+from doc_builder.docs_version import DocsVersion # pylint: disable=import-error,no-name-in-module
+from doc_builder.sys_utils import get_git_head_or_branch # pylint: disable=import-error,no-name-in-module
+
+# Branch name, tag, or commit SHA whose version of certain files we want to preserve
+LATEST_REF = get_git_head_or_branch()
+
+# List of version definitions
+VERSION_LIST = [
+ DocsVersion(
+ short_name="latest",
+ display_name="Latest development code",
+ landing_version=True,
+ ref=LATEST_REF,
+ ),
+ DocsVersion(
+ short_name="release-cesm2.0",
+ display_name="CESM2.0",
+ ref="release-cesm2.0-build-docs",
+ ),
+ DocsVersion(
+ short_name="cism-release-cesm2.1",
+ display_name="CESM2.1",
+ ref="cism-release-cesm2.1-build-docs",
+ ),
+]
+# End version definitions (keep this comment; Sphinx is looking for it)