conf.py

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