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", "/en/latest/"),
82 ("stable", "/en/stable/"),
83 ("sphinx-3.x", "/en/sphinx-3.x/"),
84 ("new-branch", "/en/new-branch/"),
85 ("custom-404-page", "/en/custom-404-page/"),
86 ],
87 'downloads': [
88 ],
89 'subprojects': [
90 ],
91 'slug': 'stsewd-demo',
92 'name': u'subproject',
93 'rtd_language': u'en',
94 'programming_language': u'py',
95 'canonical_url': '',
96 'analytics_code': 'None',
97 'single_version': False,
98 'conf_py_path': '/docs/',
99 'api_host': 'https://readthedocs.org',
100 'github_user': 'readthedocs',
101 'proxied_api_host': '/_',
102 'github_repo': 'test-builds',
103 'github_version': 'custom-404-page',
104 'display_github': True,
105 'bitbucket_user': 'None',
106 'bitbucket_repo': 'None',
107 'bitbucket_version': 'custom-404-page',
108 'display_bitbucket': False,
109 'gitlab_user': 'None',
110 'gitlab_repo': 'None',
111 'gitlab_version': 'custom-404-page',
112 'display_gitlab': False,
113 'READTHEDOCS': True,
114 'using_theme': (html_theme == "default"),
115 'new_theme': (html_theme == "sphinx_rtd_theme"),
116 'source_suffix': SUFFIX,
117 'ad_free': False,
118 'docsearch_disabled': False,
119 'user_analytics_code': '',
120 'global_analytics_code': 'UA-17997319-1',
121 'commit': '866fe945',
122}
123
124# For sphinx >=1.8 we can use html_baseurl to set the canonical URL.
125# https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_baseurl
126if version_info >= (1, 8):
127 if not globals().get('html_baseurl'):
128 html_baseurl = context['canonical_url']
129 context['canonical_url'] = None
130
131
132
133
134
135if 'html_context' in globals():
136 for key in context:
137 if key not in html_context:
138 html_context[key] = context[key]
139else:
140 html_context = context
141
142# Add custom RTD extension
143if 'extensions' in globals():
144 # Insert at the beginning because it can interfere
145 # with other extensions.
146 # See https://github.com/rtfd/readthedocs.org/pull/4054
147 extensions.insert(0, "readthedocs_ext.readthedocs")
148else:
149 extensions = ["readthedocs_ext.readthedocs"]
150
151# Add External version warning banner to the external version documentation
152if 'branch' == 'external':
153 extensions.insert(1, "readthedocs_ext.external_version_warning")
154 readthedocs_vcs_url = 'None'
155 readthedocs_build_url = 'https://readthedocs.org/projects/stsewd-demo/builds/21970890/'
156
157project_language = 'en'
158
159# User's Sphinx configurations
160language_user = globals().get('language', None)
161latex_engine_user = globals().get('latex_engine', None)
162latex_elements_user = globals().get('latex_elements', None)
163
164# Remove this once xindy gets installed in Docker image and XINDYOPS
165# env variable is supported
166# https://github.com/rtfd/readthedocs-docker-images/pull/98
167latex_use_xindy = False
168
169chinese = any([
170 language_user in ('zh_CN', 'zh_TW'),
171 project_language in ('zh_CN', 'zh_TW'),
172])
173
174japanese = any([
175 language_user == 'ja',
176 project_language == 'ja',
177])
178
179if chinese:
180 latex_engine = latex_engine_user or 'xelatex'
181
182 latex_elements_rtd = {
183 'preamble': '\\usepackage[UTF8]{ctex}\n',
184 }
185 latex_elements = latex_elements_user or latex_elements_rtd
186elif japanese:
187 latex_engine = latex_engine_user or 'platex'
188
189# Make sure our build directory is always excluded
190exclude_patterns = globals().get('exclude_patterns', [])
191exclude_patterns.extend(['_build'])