conf.py

  1# -*- coding: utf-8 -*-
  2
  3# Default settings
  4project = 'Test Builds'
  5extensions = [
  6    'sphinx_autorun',
  7]
  8
  9latex_engine = 'xelatex'  # allow us to build Unicode chars
 10
 11
 12# Include all your settings here
 13html_theme = 'sphinx_rtd_theme'
 14
 15
 16
 17
 18###########################################################################
 19#          auto-created readthedocs.org specific configuration            #
 20###########################################################################
 21
 22
 23#
 24# The following code was added during an automated build on readthedocs.org
 25# It is auto created and injected for every build. The result is based on the
 26# conf.py.tmpl file found in the readthedocs.org codebase:
 27# https://github.com/rtfd/readthedocs.org/blob/main/readthedocs/doc_builder/templates/doc_builder/conf.py.tmpl
 28#
 29# Note: this file shouldn't rely on extra dependencies.
 30
 31import importlib
 32import sys
 33import os.path
 34
 35# Borrowed from six.
 36PY3 = sys.version_info[0] == 3
 37string_types = str if PY3 else basestring
 38
 39from sphinx import version_info
 40
 41# Get suffix for proper linking to GitHub
 42# This is deprecated in Sphinx 1.3+,
 43# as each page can have its own suffix
 44if globals().get('source_suffix', False):
 45    if isinstance(source_suffix, string_types):
 46        SUFFIX = source_suffix
 47    elif isinstance(source_suffix, (list, tuple)):
 48        # Sphinx >= 1.3 supports list/tuple to define multiple suffixes
 49        SUFFIX = source_suffix[0]
 50    elif isinstance(source_suffix, dict):
 51        # Sphinx >= 1.8 supports a mapping dictionary for multiple suffixes
 52        SUFFIX = list(source_suffix.keys())[0]  # make a ``list()`` for py2/py3 compatibility
 53    else:
 54        # default to .rst
 55        SUFFIX = '.rst'
 56else:
 57    SUFFIX = '.rst'
 58
 59# Add RTD Static Path. Add to the end because it overwrites previous files.
 60if not 'html_static_path' in globals():
 61    html_static_path = []
 62if os.path.exists('_static'):
 63    html_static_path.append('_static')
 64
 65# Add RTD Theme only if they aren't overriding it already
 66using_rtd_theme = (
 67    (
 68        'html_theme' in globals() and
 69        html_theme in ['default'] and
 70        # Allow people to bail with a hack of having an html_style
 71        'html_style' not in globals()
 72    ) or 'html_theme' not in globals()
 73)
 74if using_rtd_theme:
 75    theme = importlib.import_module('sphinx_rtd_theme')
 76    html_theme = 'sphinx_rtd_theme'
 77    html_style = None
 78    html_theme_options = {}
 79    if 'html_theme_path' in globals():
 80        html_theme_path.append(theme.get_html_theme_path())
 81    else:
 82        html_theme_path = [theme.get_html_theme_path()]
 83
 84if globals().get('websupport2_base_url', False):
 85    websupport2_base_url = 'https://readthedocs.org/websupport'
 86    websupport2_static_url = 'https://assets.readthedocs.org/static/'
 87
 88
 89#Add project information to the template context.
 90context = {
 91    'using_theme': using_rtd_theme,
 92    'html_theme': html_theme,
 93    'current_version': "sphinx-multipage-html",
 94    'version_slug': "sphinx-multipage-html",
 95    'MEDIA_URL': "https://media.readthedocs.org/",
 96    'STATIC_URL': "https://assets.readthedocs.org/static/",
 97    'PRODUCTION_DOMAIN': "readthedocs.org",
 98    'proxied_static_path': "/_/static/",
 99    'versions': [
100    ("latest", "/en/latest/"),
101    ("4.0", "/en/4.0/"),
102    ("2.0", "/en/2.0/"),
103    ("yaml-v2", "/en/yaml-v2/"),
104    ("wormhole", "/en/wormhole/"),
105    ("use-requirements-from-submodule", "/en/use-requirements-from-submodule/"),
106    ("use-apt", "/en/use-apt/"),
107    ("unicode-filename", "/en/unicode-filename/"),
108    ("d--branch", "/en/d--branch/"),
109    ("ubuntu-22.04", "/en/ubuntu-22.04/"),
110    ("typlog-theme", "/en/typlog-theme/"),
111    ("timetestlarge", "/en/timetestlarge/"),
112    ("timetest", "/en/timetest/"),
113    ("timeout", "/en/timeout/"),
114    ("throw-exception", "/en/throw-exception/"),
115    ("test-paths-with-spaces", "/en/test-paths-with-spaces/"),
116    ("testing-activate-version", "/en/testing-activate-version/"),
117    ("sudo-commands", "/en/sudo-commands/"),
118    ("submodule-not-found", "/en/submodule-not-found/"),
119    ("submodule-https-scheme", "/en/submodule-https-scheme/"),
120    ("submodule-git-scheme", "/en/submodule-git-scheme/"),
121    ("sphinx-tectonic-pdf", "/en/sphinx-tectonic-pdf/"),
122    ("sphinx-tabs", "/en/sphinx-tabs/"),
123    ("sphinx-multipage-html", "/en/sphinx-multipage-html/"),
124    ("sphinx-mkdocstrings", "/en/sphinx-mkdocstrings/"),
125    ("sphinx-latest", "/en/sphinx-latest/"),
126    ("sphinx.ext.duration", "/en/sphinx.ext.duration/"),
127    ("sphinx-es-suggest", "/en/sphinx-es-suggest/"),
128    ("sphinx-docs-zundler", "/en/sphinx-docs-zundler/"),
129    ("sphinx-conf-nonstandard", "/en/sphinx-conf-nonstandard/"),
130    ("sphinx6.x-default", "/en/sphinx6.x-default/"),
131    ("sphinx5.x-default-confpy", "/en/sphinx5.x-default-confpy/"),
132    ("sphinx-5.x", "/en/sphinx-5.x/"),
133    ("skip-build-command", "/en/skip-build-command/"),
134    ("singlehtml", "/en/singlehtml/"),
135    ("shot-scraper", "/en/shot-scraper/"),
136    ("search-with-old-sphinx-and-theme", "/en/search-with-old-sphinx-and-theme/"),
137    ("rust", "/en/rust/"),
138    ("robots-txt", "/en/robots-txt/"),
139    ("requirements-not-found", "/en/requirements-not-found/"),
140    ("regular-404-page", "/en/regular-404-page/"),
141    ("recommonmark", "/en/recommonmark/"),
142    ("pypy3.5", "/en/pypy3.5/"),
143    ("pygments-custom-lexer-apex", "/en/pygments-custom-lexer-apex/"),
144    ("py3.9", "/en/py3.9/"),
145    ("py3.8", "/en/py3.8/"),
146    ("py3.11", "/en/py3.11/"),
147    ("py3.10", "/en/py3.10/"),
148    ("pr-visual-diff", "/en/pr-visual-diff/"),
149    ("pr-homepage-edition", "/en/pr-homepage-edition/"),
150    ("poetry-asdf", "/en/poetry-asdf/"),
151    ("poetry", "/en/poetry/"),
152    ("pelican", "/en/pelican/"),
153    ("path-with-plus", "/en/path-with-plus/"),
154    ("no-conf-py", "/en/no-conf-py/"),
155    ("no-config-file", "/en/no-config-file/"),
156    ("nbsphinx-3d-plot", "/en/nbsphinx-3d-plot/"),
157    ("multiple-source-suffix", "/en/multiple-source-suffix/"),
158    ("mkdocs-python-tags", "/en/mkdocs-python-tags/"),
159    ("mkdocs-pdf", "/en/mkdocs-pdf/"),
160    ("mkdocs-htmlzip", "/en/mkdocs-htmlzip/"),
161    ("mkdocs-config-at-root", "/en/mkdocs-config-at-root/"),
162    ("mkdocs", "/en/mkdocs/"),
163    ("meta-tags", "/en/meta-tags/"),
164    ("mamba", "/en/mamba/"),
165    ("jsdoc-autoapi", "/en/jsdoc-autoapi/"),
166    ("jsdoc", "/en/jsdoc/"),
167    ("japanese-pdf", "/en/japanese-pdf/"),
168    ("invalid-submodules", "/en/invalid-submodules/"),
169    ("install-setuptools", "/en/install-setuptools/"),
170    ("huge-build-output", "/en/huge-build-output/"),
171    ("htmldir", "/en/htmldir/"),
172    ("git-submodules-invalid", "/en/git-submodules-invalid/"),
173    ("git-submodules", "/en/git-submodules/"),
174    ("git-lfs-build-jobs", "/en/git-lfs-build-jobs/"),
175    ("file-with-apostrophe", "/en/file-with-apostrophe/"),
176    ("expose-env-pip-error", "/en/expose-env-pip-error/"),
177    ("explicit-flyout-placement", "/en/explicit-flyout-placement/"),
178    ("envvar-config-file", "/en/envvar-config-file/"),
179    ("environment-variables", "/en/environment-variables/"),
180    ("docusaurus", "/en/docusaurus/"),
181    ("docsify-ads", "/en/docsify-ads/"),
182    ("docsify", "/en/docsify/"),
183    ("datetime", "/en/datetime/"),
184    ("d2lbook", "/en/d2lbook/"),
185    ("custom-404-page", "/en/custom-404-page/"),
186    ("conda-pin-common-deps", "/en/conda-pin-common-deps/"),
187    ("conda-env-py3.7", "/en/conda-env-py3.7/"),
188    ("conda-env-no-py-pinned", "/en/conda-env-no-py-pinned/"),
189    ("conda-env", "/en/conda-env/"),
190    ("c-dependencies", "/en/c-dependencies/"),
191    ("build-tools-mamba", "/en/build-tools-mamba/"),
192    ("build-tools-conda", "/en/build-tools-conda/"),
193    ("build-tools", "/en/build-tools/"),
194    ("build-os-error-message", "/en/build-os-error-message/"),
195    ("build-jobs-spaces-in-command", "/en/build-jobs-spaces-in-command/"),
196    ("build-jobs-post-build", "/en/build-jobs-post-build/"),
197    ("build-jobs-multiline", "/en/build-jobs-multiline/"),
198    ("build-jobs-diff-exit", "/en/build-jobs-diff-exit/"),
199    ("build-jobs", "/en/build-jobs/"),
200    ("build-internals", "/en/build-internals/"),
201    ("build-commands-env-vars", "/en/build-commands-env-vars/"),
202    ("build-commands", "/en/build-commands/"),
203    ("another-matching-branch", "/en/another-matching-branch/"),
204    ("annotated-tag", "/en/annotated-tag/"),
205    ("all-formats-build-jobs", "/en/all-formats-build-jobs/"),
206    ("all-formats-build-commands", "/en/all-formats-build-commands/"),
207    ("all-formats", "/en/all-formats/"),
208    ("alabaster-theme", "/en/alabaster-theme/"),
209    ],
210    'downloads': [ 
211    ("html", "//test-builds.readthedocs.io/_/downloads/en/sphinx-multipage-html/htmlzip/"),
212    ],
213    'subprojects': [ 
214    ],
215    'slug': 'test-builds',
216    'name': u'test-builds',
217    'rtd_language': u'en',
218    'programming_language': u'words',
219    'canonical_url': 'https://test-builds.readthedocs.io/en/latest/',
220    'analytics_code': 'UA-12341234-1',
221    'single_version': False,
222    'conf_py_path': '/docs/',
223    'api_host': 'https://readthedocs.org',
224    'github_user': 'readthedocs',
225    'proxied_api_host': '/_',
226    'github_repo': 'test-builds',
227    'github_version': 'sphinx-multipage-html',
228    'display_github': True,
229    'bitbucket_user': 'None',
230    'bitbucket_repo': 'None',
231    'bitbucket_version': 'sphinx-multipage-html',
232    'display_bitbucket': False,
233    'gitlab_user': 'None',
234    'gitlab_repo': 'None',
235    'gitlab_version': 'sphinx-multipage-html',
236    'display_gitlab': False,
237    'READTHEDOCS': True,
238    'using_theme': (html_theme == "default"),
239    'new_theme': (html_theme == "sphinx_rtd_theme"),
240    'source_suffix': SUFFIX,
241    'ad_free': False,
242    'docsearch_disabled': False,
243    'user_analytics_code': 'UA-12341234-1',
244    'global_analytics_code': None,
245    'commit': 'f6000f53',
246}
247
248# For sphinx >=1.8 we can use html_baseurl to set the canonical URL.
249# https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_baseurl
250if version_info >= (1, 8):
251    if not globals().get('html_baseurl'):
252        html_baseurl = context['canonical_url']
253    context['canonical_url'] = None
254
255
256
257
258
259if 'html_context' in globals():
260    
261    html_context.update(context)
262    
263else:
264    html_context = context
265
266# Add custom RTD extension
267if 'extensions' in globals():
268    # Insert at the beginning because it can interfere
269    # with other extensions.
270    # See https://github.com/rtfd/readthedocs.org/pull/4054
271    extensions.insert(0, "readthedocs_ext.readthedocs")
272else:
273    extensions = ["readthedocs_ext.readthedocs"]
274
275# Add External version warning banner to the external version documentation
276if 'branch' == 'external':
277    extensions.insert(1, "readthedocs_ext.external_version_warning")
278    readthedocs_vcs_url = 'None'
279    readthedocs_build_url = 'https://readthedocs.org/projects/test-builds/builds/19331041/'
280
281project_language = 'en'
282
283# User's Sphinx configurations
284language_user = globals().get('language', None)
285latex_engine_user = globals().get('latex_engine', None)
286latex_elements_user = globals().get('latex_elements', None)
287
288# Remove this once xindy gets installed in Docker image and XINDYOPS
289# env variable is supported
290# https://github.com/rtfd/readthedocs-docker-images/pull/98
291latex_use_xindy = False
292
293chinese = any([
294    language_user in ('zh_CN', 'zh_TW'),
295    project_language in ('zh_CN', 'zh_TW'),
296])
297
298japanese = any([
299    language_user == 'ja',
300    project_language == 'ja',
301])
302
303if chinese:
304    latex_engine = latex_engine_user or 'xelatex'
305
306    latex_elements_rtd = {
307        'preamble': '\\usepackage[UTF8]{ctex}\n',
308    }
309    latex_elements = latex_elements_user or latex_elements_rtd
310elif japanese:
311    latex_engine = latex_engine_user or 'platex'
312
313# Make sure our build directory is always excluded
314exclude_patterns = globals().get('exclude_patterns', [])
315exclude_patterns.extend(['_build'])