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
 15import os
 16os.system('ln -s ../.readthedocs.yaml .')
 17
 18
 19
 20
 21###########################################################################
 22#          auto-created readthedocs.org specific configuration            #
 23###########################################################################
 24
 25
 26#
 27# The following code was added during an automated build on readthedocs.org
 28# It is auto created and injected for every build. The result is based on the
 29# conf.py.tmpl file found in the readthedocs.org codebase:
 30# https://github.com/rtfd/readthedocs.org/blob/master/readthedocs/doc_builder/templates/doc_builder/conf.py.tmpl
 31#
 32# Note: this file shouldn't rely on extra dependencies.
 33
 34import importlib
 35import sys
 36import os.path
 37
 38# Borrowed from six.
 39PY3 = sys.version_info[0] == 3
 40string_types = str if PY3 else basestring
 41
 42from sphinx import version_info
 43
 44# Get suffix for proper linking to GitHub
 45# This is deprecated in Sphinx 1.3+,
 46# as each page can have its own suffix
 47if globals().get('source_suffix', False):
 48    if isinstance(source_suffix, string_types):
 49        SUFFIX = source_suffix
 50    elif isinstance(source_suffix, (list, tuple)):
 51        # Sphinx >= 1.3 supports list/tuple to define multiple suffixes
 52        SUFFIX = source_suffix[0]
 53    elif isinstance(source_suffix, dict):
 54        # Sphinx >= 1.8 supports a mapping dictionary for multiple suffixes
 55        SUFFIX = list(source_suffix.keys())[0]  # make a ``list()`` for py2/py3 compatibility
 56    else:
 57        # default to .rst
 58        SUFFIX = '.rst'
 59else:
 60    SUFFIX = '.rst'
 61
 62# Add RTD Static Path. Add to the end because it overwrites previous files.
 63if not 'html_static_path' in globals():
 64    html_static_path = []
 65if os.path.exists('_static'):
 66    html_static_path.append('_static')
 67
 68# Add RTD Theme only if they aren't overriding it already
 69using_rtd_theme = (
 70    (
 71        'html_theme' in globals() and
 72        html_theme in ['default'] and
 73        # Allow people to bail with a hack of having an html_style
 74        'html_style' not in globals()
 75    ) or 'html_theme' not in globals()
 76)
 77if using_rtd_theme:
 78    theme = importlib.import_module('sphinx_rtd_theme')
 79    html_theme = 'sphinx_rtd_theme'
 80    html_style = None
 81    html_theme_options = {}
 82    if 'html_theme_path' in globals():
 83        html_theme_path.append(theme.get_html_theme_path())
 84    else:
 85        html_theme_path = [theme.get_html_theme_path()]
 86
 87if globals().get('websupport2_base_url', False):
 88    websupport2_base_url = 'https://readthedocs.org/websupport'
 89    websupport2_static_url = 'https://assets.readthedocs.org/static/'
 90
 91
 92#Add project information to the template context.
 93context = {
 94    'using_theme': using_rtd_theme,
 95    'html_theme': html_theme,
 96    'current_version': "mamba",
 97    'version_slug': "mamba",
 98    'MEDIA_URL': "https://media.readthedocs.org/",
 99    'STATIC_URL': "https://assets.readthedocs.org/static/",
100    'PRODUCTION_DOMAIN': "readthedocs.org",
101    'versions': [
102    ("latest", "/es/latest/"),
103    ("stable", "/es/stable/"),
104    ("4.0", "/es/4.0/"),
105    ("theme-1.0rc1", "/es/theme-1.0rc1/"),
106    ("robots-txt", "/es/robots-txt/"),
107    ("py3.10", "/es/py3.10/"),
108    ("poetry", "/es/poetry/"),
109    ("ooops-all-json", "/es/ooops-all-json/"),
110    ("mamba", "/es/mamba/"),
111    ("expose-env-pip-error", "/es/expose-env-pip-error/"),
112    ("csrf", "/es/csrf/"),
113    ("build-tools", "/es/build-tools/"),
114    ],
115    'downloads': [ 
116    ],
117    'subprojects': [ 
118        ("stsewd-demo", "https://another-test-stsewd.readthedocs.io/projects/stsewd-demo/en/stable/"),
119    ],
120    'slug': 'another-test-stsewd',
121    'name': u'another-test-stsewd',
122    'rtd_language': u'es',
123    'programming_language': u'words',
124    'canonical_url': 'https://another-test-stsewd.readthedocs.io/es/latest/',
125    'analytics_code': 'None',
126    'single_version': False,
127    'conf_py_path': '/docs/',
128    'api_host': 'https://readthedocs.org',
129    'github_user': 'rtfd',
130    'proxied_api_host': '/_',
131    'github_repo': 'test-builds',
132    'github_version': 'mamba',
133    'display_github': True,
134    'bitbucket_user': 'None',
135    'bitbucket_repo': 'None',
136    'bitbucket_version': 'mamba',
137    'display_bitbucket': False,
138    'gitlab_user': 'None',
139    'gitlab_repo': 'None',
140    'gitlab_version': 'mamba',
141    'display_gitlab': False,
142    'READTHEDOCS': True,
143    'using_theme': (html_theme == "default"),
144    'new_theme': (html_theme == "sphinx_rtd_theme"),
145    'source_suffix': SUFFIX,
146    'ad_free': False,
147    'docsearch_disabled': False,
148    'user_analytics_code': '',
149    'global_analytics_code': 'UA-17997319-1',
150    'commit': '1051c22f',
151}
152
153# For sphinx >=1.8 we can use html_baseurl to set the canonical URL.
154# https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_baseurl
155if version_info >= (1, 8):
156    if not globals().get('html_baseurl'):
157        html_baseurl = context['canonical_url']
158    context['canonical_url'] = None
159
160
161
162
163
164if 'html_context' in globals():
165    
166    html_context.update(context)
167    
168else:
169    html_context = context
170
171# Add custom RTD extension
172if 'extensions' in globals():
173    # Insert at the beginning because it can interfere
174    # with other extensions.
175    # See https://github.com/rtfd/readthedocs.org/pull/4054
176    extensions.insert(0, "readthedocs_ext.readthedocs")
177else:
178    extensions = ["readthedocs_ext.readthedocs"]
179
180# Add External version warning banner to the external version documentation
181if 'branch' == 'external':
182    extensions.insert(1, "readthedocs_ext.external_version_warning")
183    readthedocs_vcs_url = 'None'
184    readthedocs_build_url = 'https://readthedocs.org/projects/another-test-stsewd/builds/15535092/'
185
186project_language = 'es'
187
188# User's Sphinx configurations
189language_user = globals().get('language', None)
190latex_engine_user = globals().get('latex_engine', None)
191latex_elements_user = globals().get('latex_elements', None)
192
193# Remove this once xindy gets installed in Docker image and XINDYOPS
194# env variable is supported
195# https://github.com/rtfd/readthedocs-docker-images/pull/98
196latex_use_xindy = False
197
198chinese = any([
199    language_user in ('zh_CN', 'zh_TW'),
200    project_language in ('zh_CN', 'zh_TW'),
201])
202
203japanese = any([
204    language_user == 'ja',
205    project_language == 'ja',
206])
207
208if chinese:
209    latex_engine = latex_engine_user or 'xelatex'
210
211    latex_elements_rtd = {
212        'preamble': '\\usepackage[UTF8]{ctex}\n',
213    }
214    latex_elements = latex_elements_user or latex_elements_rtd
215elif japanese:
216    latex_engine = latex_engine_user or 'platex'
217
218# Make sure our build directory is always excluded
219exclude_patterns = globals().get('exclude_patterns', [])
220exclude_patterns.extend(['_build'])