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': "recommonmark",
 94    'version_slug': "recommonmark",
 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", "/es/latest/"),
101    ("stable", "/es/stable/"),
102    ("5.0", "/es/5.0/"),
103    ("4.0", "/es/4.0/"),
104    ("ubuntu-22.04", "/es/ubuntu-22.04/"),
105    ("theme-1.0rc1", "/es/theme-1.0rc1/"),
106    ("sudo-commands", "/es/sudo-commands/"),
107    ("submodule-not-found", "/es/submodule-not-found/"),
108    ("sphinx-fork", "/es/sphinx-fork/"),
109    ("sphinx-5.x", "/es/sphinx-5.x/"),
110    ("sphinx-1.8", "/es/sphinx-1.8/"),
111    ("sphinx-1.7", "/es/sphinx-1.7/"),
112    ("sphinx-1.6", "/es/sphinx-1.6/"),
113    ("rust", "/es/rust/"),
114    ("rtd-sphinx-ext", "/es/rtd-sphinx-ext/"),
115    ("robots-txt", "/es/robots-txt/"),
116    ("regular-404-page", "/es/regular-404-page/"),
117    ("recommonmark", "/es/recommonmark/"),
118    ("py3.11a", "/es/py3.11a/"),
119    ("py3.11", "/es/py3.11/"),
120    ("py3.10", "/es/py3.10/"),
121    ("pr-visual-diff", "/es/pr-visual-diff/"),
122    ("poetry-asdf", "/es/poetry-asdf/"),
123    ("poetry", "/es/poetry/"),
124    ("pelican", "/es/pelican/"),
125    ("ooops-all-json", "/es/ooops-all-json/"),
126    ("no-config-file", "/es/no-config-file/"),
127    ("mamba", "/es/mamba/"),
128    ("main", "/es/main/"),
129    ("jsdoc-autoapi", "/es/jsdoc-autoapi/"),
130    ("jsdoc", "/es/jsdoc/"),
131    ("image", "/es/image/"),
132    ("humitos-poetry", "/es/humitos-poetry/"),
133    ("git-submodules-invalid", "/es/git-submodules-invalid/"),
134    ("git-submodules", "/es/git-submodules/"),
135    ("git-lfs-build-jobs", "/es/git-lfs-build-jobs/"),
136    ("expose-env-pip-error", "/es/expose-env-pip-error/"),
137    ("explicit-flyout-placement", "/es/explicit-flyout-placement/"),
138    ("docsify-ads", "/es/docsify-ads/"),
139    ("docsify", "/es/docsify/"),
140    ("delete-sources", "/es/delete-sources/"),
141    ("d2lbook", "/es/d2lbook/"),
142    ("csrf", "/es/csrf/"),
143    ("build-tools-update-2", "/es/build-tools-update-2/"),
144    ("build-tools-mamba", "/es/build-tools-mamba/"),
145    ("build-tools-conda", "/es/build-tools-conda/"),
146    ("build-tools", "/es/build-tools/"),
147    ("build-os-error-message", "/es/build-os-error-message/"),
148    ("build-jobs-spaces-in-command", "/es/build-jobs-spaces-in-command/"),
149    ("build-jobs-multiline", "/es/build-jobs-multiline/"),
150    ("build-jobs", "/es/build-jobs/"),
151    ("build-commands-env-vars", "/es/build-commands-env-vars/"),
152    ("build-commands", "/es/build-commands/"),
153    ("agj-test-pr", "/es/agj-test-pr/"),
154    ("agj-rtd-tf-example", "/es/agj-rtd-tf-example/"),
155    ],
156    'downloads': [ 
157    ],
158    'subprojects': [ 
159        ("stsewd-demo", "https://another-test-stsewd.readthedocs.io/projects/stsewd-demo/en/stable/"),
160    ],
161    'slug': 'another-test-stsewd',
162    'name': u'another-test-stsewd',
163    'rtd_language': u'es',
164    'programming_language': u'words',
165    'canonical_url': 'https://another-test-stsewd.readthedocs.io/es/latest/',
166    'analytics_code': 'None',
167    'single_version': False,
168    'conf_py_path': '/docs/',
169    'api_host': 'https://readthedocs.org',
170    'github_user': 'rtfd',
171    'proxied_api_host': '/_',
172    'github_repo': 'test-builds',
173    'github_version': 'recommonmark',
174    'display_github': True,
175    'bitbucket_user': 'None',
176    'bitbucket_repo': 'None',
177    'bitbucket_version': 'recommonmark',
178    'display_bitbucket': False,
179    'gitlab_user': 'None',
180    'gitlab_repo': 'None',
181    'gitlab_version': 'recommonmark',
182    'display_gitlab': False,
183    'READTHEDOCS': True,
184    'using_theme': (html_theme == "default"),
185    'new_theme': (html_theme == "sphinx_rtd_theme"),
186    'source_suffix': SUFFIX,
187    'ad_free': False,
188    'docsearch_disabled': False,
189    'user_analytics_code': '',
190    'global_analytics_code': 'UA-17997319-1',
191    'commit': 'f7e6bb03',
192}
193
194# For sphinx >=1.8 we can use html_baseurl to set the canonical URL.
195# https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_baseurl
196if version_info >= (1, 8):
197    if not globals().get('html_baseurl'):
198        html_baseurl = context['canonical_url']
199    context['canonical_url'] = None
200
201
202
203
204
205if 'html_context' in globals():
206    
207    html_context.update(context)
208    
209else:
210    html_context = context
211
212# Add custom RTD extension
213if 'extensions' in globals():
214    # Insert at the beginning because it can interfere
215    # with other extensions.
216    # See https://github.com/rtfd/readthedocs.org/pull/4054
217    extensions.insert(0, "readthedocs_ext.readthedocs")
218else:
219    extensions = ["readthedocs_ext.readthedocs"]
220
221# Add External version warning banner to the external version documentation
222if 'branch' == 'external':
223    extensions.insert(1, "readthedocs_ext.external_version_warning")
224    readthedocs_vcs_url = 'None'
225    readthedocs_build_url = 'https://readthedocs.org/projects/another-test-stsewd/builds/17932212/'
226
227project_language = 'es'
228
229# User's Sphinx configurations
230language_user = globals().get('language', None)
231latex_engine_user = globals().get('latex_engine', None)
232latex_elements_user = globals().get('latex_elements', None)
233
234# Remove this once xindy gets installed in Docker image and XINDYOPS
235# env variable is supported
236# https://github.com/rtfd/readthedocs-docker-images/pull/98
237latex_use_xindy = False
238
239chinese = any([
240    language_user in ('zh_CN', 'zh_TW'),
241    project_language in ('zh_CN', 'zh_TW'),
242])
243
244japanese = any([
245    language_user == 'ja',
246    project_language == 'ja',
247])
248
249if chinese:
250    latex_engine = latex_engine_user or 'xelatex'
251
252    latex_elements_rtd = {
253        'preamble': '\\usepackage[UTF8]{ctex}\n',
254    }
255    latex_elements = latex_elements_user or latex_elements_rtd
256elif japanese:
257    latex_engine = latex_engine_user or 'platex'
258
259# Make sure our build directory is always excluded
260exclude_patterns = globals().get('exclude_patterns', [])
261exclude_patterns.extend(['_build'])