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