htmldir

Test for htmldir building in YAML file.

YAML file used to build these docs:

 1version: 2
 2
 3build:
 4  image: latest
 5
 6formats: []
 7
 8sphinx:
 9  builder: htmldir
10  configuration: docs/conf.py
11
12python:
13  version: 3.6
14  install:
15    - 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': "htmldir",
 93    'version_slug': "htmldir",
 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    ("sphinx5.x-default-confpy", "/en/sphinx5.x-default-confpy/"),
140    ("sphinx-5.x", "/en/sphinx-5.x/"),
141    ("sphinx-3.x", "/en/sphinx-3.x/"),
142    ("sphinx2", "/en/sphinx2/"),
143    ("sphinx-1.8", "/en/sphinx-1.8/"),
144    ("sphinx-1.7", "/en/sphinx-1.7/"),
145    ("sphinx-1.6", "/en/sphinx-1.6/"),
146    ("skip-build-command", "/en/skip-build-command/"),
147    ("shot-scraper", "/en/shot-scraper/"),
148    ("search-with-old-sphinx-and-theme", "/en/search-with-old-sphinx-and-theme/"),
149    ("rust", "/en/rust/"),
150    ("run-rust", "/en/run-rust/"),
151    ("rtd-sphinx-ext", "/en/rtd-sphinx-ext/"),
152    ("robots-txt", "/en/robots-txt/"),
153    ("requirements-not-found", "/en/requirements-not-found/"),
154    ("regular-404-page", "/en/regular-404-page/"),
155    ("recommonmark", "/en/recommonmark/"),
156    ("pypy3.5", "/en/pypy3.5/"),
157    ("pygments-custom-lexer-apex", "/en/pygments-custom-lexer-apex/"),
158    ("py3.9", "/en/py3.9/"),
159    ("py3.8", "/en/py3.8/"),
160    ("py3.5", "/en/py3.5/"),
161    ("py3.11", "/en/py3.11/"),
162    ("py3.10", "/en/py3.10/"),
163    ("pr-visual-diff", "/en/pr-visual-diff/"),
164    ("poetry-asdf", "/en/poetry-asdf/"),
165    ("poetry", "/en/poetry/"),
166    ("pelican", "/en/pelican/"),
167    ("path-with-plus", "/en/path-with-plus/"),
168    ("no-conf-py", "/en/no-conf-py/"),
169    ("no-config-file", "/en/no-config-file/"),
170    ("nbsphinx-3d-plot", "/en/nbsphinx-3d-plot/"),
171    ("multiple-source-suffix", "/en/multiple-source-suffix/"),
172    ("meta-tags", "/en/meta-tags/"),
173    ("mamba", "/en/mamba/"),
174    ("main", "/en/main/"),
175    ("jsdoc-autoapi", "/en/jsdoc-autoapi/"),
176    ("jsdoc", "/en/jsdoc/"),
177    ("japanese-pdf", "/en/japanese-pdf/"),
178    ("invalid-submodules", "/en/invalid-submodules/"),
179    ("install-setuptools", "/en/install-setuptools/"),
180    ("install-pytorch", "/en/install-pytorch/"),
181    ("install-aiohttp", "/en/install-aiohttp/"),
182    ("image", "/en/image/"),
183    ("huge-build-output", "/en/huge-build-output/"),
184    ("htmldir", "/en/htmldir/"),
185    ("hide-me", "/en/hide-me/"),
186    ("git-submodules-invalid", "/en/git-submodules-invalid/"),
187    ("git-submodules", "/en/git-submodules/"),
188    ("git-lfs-build-jobs", "/en/git-lfs-build-jobs/"),
189    ("git-lfs", "/en/git-lfs/"),
190    ("forced-push-tag", "/en/forced-push-tag/"),
191    ("file-with-apostrophe", "/en/file-with-apostrophe/"),
192    ("expose-env-pip-error", "/en/expose-env-pip-error/"),
193    ("explicit-flyout-placement", "/en/explicit-flyout-placement/"),
194    ("expirement", "/en/expirement/"),
195    ("environment-variables", "/en/environment-variables/"),
196    ("docusaurus", "/en/docusaurus/"),
197    ("docsify-ads", "/en/docsify-ads/"),
198    ("docsify", "/en/docsify/"),
199    ("datetime", "/en/datetime/"),
200    ("d2lbook", "/en/d2lbook/"),
201    ("custom-404-page", "/en/custom-404-page/"),
202    ("conda-satisfied-skip-solve", "/en/conda-satisfied-skip-solve/"),
203    ("conda-pin-common-deps", "/en/conda-pin-common-deps/"),
204    ("conda-env-py3.7", "/en/conda-env-py3.7/"),
205    ("conda-env-no-py-pinned", "/en/conda-env-no-py-pinned/"),
206    ("conda-env", "/en/conda-env/"),
207    ("code-injection-3", "/en/code-injection-3/"),
208    ("c-dependencies", "/en/c-dependencies/"),
209    ("build-tools-update-2", "/en/build-tools-update-2/"),
210    ("build-tools-mamba", "/en/build-tools-mamba/"),
211    ("build-tools-conda", "/en/build-tools-conda/"),
212    ("build-tools", "/en/build-tools/"),
213    ("build-os-error-message", "/en/build-os-error-message/"),
214    ("build-jobs-spaces-in-command", "/en/build-jobs-spaces-in-command/"),
215    ("build-jobs-multiline", "/en/build-jobs-multiline/"),
216    ("build-jobs-diff-exit", "/en/build-jobs-diff-exit/"),
217    ("build-jobs", "/en/build-jobs/"),
218    ("build-internals", "/en/build-internals/"),
219    ("build-commands-env-vars", "/en/build-commands-env-vars/"),
220    ("build-commands", "/en/build-commands/"),
221    ("be-default", "/en/be-default/"),
222    ("another-matching-branch", "/en/another-matching-branch/"),
223    ("annotated-tag", "/en/annotated-tag/"),
224    ("all-formats", "/en/all-formats/"),
225    ("alabaster-theme", "/en/alabaster-theme/"),
226    ("agj-test-pr", "/en/agj-test-pr/"),
227    ("agj-rtd-tf-example", "/en/agj-rtd-tf-example/"),
228    ],
229    'downloads': [ 
230    ],
231    'subprojects': [ 
232    ],
233    'slug': 'test-builds',
234    'name': u'test-builds',
235    'rtd_language': u'en',
236    'programming_language': u'words',
237    'canonical_url': 'https://test-builds.readthedocs.io/en/latest/',
238    'analytics_code': 'UA-12341234-1',
239    'single_version': False,
240    'conf_py_path': '/docs/',
241    'api_host': 'https://readthedocs.org',
242    'github_user': 'readthedocs',
243    'proxied_api_host': '/_',
244    'github_repo': 'test-builds',
245    'github_version': 'htmldir',
246    'display_github': True,
247    'bitbucket_user': 'None',
248    'bitbucket_repo': 'None',
249    'bitbucket_version': 'htmldir',
250    'display_bitbucket': False,
251    'gitlab_user': 'None',
252    'gitlab_repo': 'None',
253    'gitlab_version': 'htmldir',
254    'display_gitlab': False,
255    'READTHEDOCS': True,
256    'using_theme': (html_theme == "default"),
257    'new_theme': (html_theme == "sphinx_rtd_theme"),
258    'source_suffix': SUFFIX,
259    'ad_free': False,
260    'docsearch_disabled': False,
261    'user_analytics_code': 'UA-12341234-1',
262    'global_analytics_code': None,
263    'commit': 'da6bcea7',
264}
265
266# For sphinx >=1.8 we can use html_baseurl to set the canonical URL.
267# https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_baseurl
268if version_info >= (1, 8):
269    if not globals().get('html_baseurl'):
270        html_baseurl = context['canonical_url']
271    context['canonical_url'] = None
272
273
274
275
276
277if 'html_context' in globals():
278    
279    html_context.update(context)
280    
281else:
282    html_context = context
283
284# Add custom RTD extension
285if 'extensions' in globals():
286    # Insert at the beginning because it can interfere
287    # with other extensions.
288    # See https://github.com/rtfd/readthedocs.org/pull/4054
289    extensions.insert(0, "readthedocs_ext.readthedocs")
290else:
291    extensions = ["readthedocs_ext.readthedocs"]
292
293# Add External version warning banner to the external version documentation
294if 'branch' == 'external':
295    extensions.insert(1, "readthedocs_ext.external_version_warning")
296    readthedocs_vcs_url = 'None'
297    readthedocs_build_url = 'https://readthedocs.org/projects/test-builds/builds/18665089/'
298
299project_language = 'en'
300
301# User's Sphinx configurations
302language_user = globals().get('language', None)
303latex_engine_user = globals().get('latex_engine', None)
304latex_elements_user = globals().get('latex_elements', None)
305
306# Remove this once xindy gets installed in Docker image and XINDYOPS
307# env variable is supported
308# https://github.com/rtfd/readthedocs-docker-images/pull/98
309latex_use_xindy = False
310
311chinese = any([
312    language_user in ('zh_CN', 'zh_TW'),
313    project_language in ('zh_CN', 'zh_TW'),
314])
315
316japanese = any([
317    language_user == 'ja',
318    project_language == 'ja',
319])
320
321if chinese:
322    latex_engine = latex_engine_user or 'xelatex'
323
324    latex_elements_rtd = {
325        'preamble': '\\usepackage[UTF8]{ctex}\n',
326    }
327    latex_elements = latex_elements_user or latex_elements_rtd
328elif japanese:
329    latex_engine = latex_engine_user or 'platex'
330
331# Make sure our build directory is always excluded
332exclude_patterns = globals().get('exclude_patterns', [])
333exclude_patterns.extend(['_build'])
>>> # Build at
>>> import datetime
>>> datetime.datetime.utcnow()  # UTC
datetime.datetime(2022, 11, 17, 18, 56, 16, 80456)