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