2013-11-03 15:37:56 -06:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2017-03-14 22:52:32 -05:00
|
|
|
import sys
|
|
|
|
import os
|
2018-09-26 15:35:45 -05:00
|
|
|
import re
|
2017-12-20 22:29:52 -06:00
|
|
|
|
2020-05-02 17:47:06 -05:00
|
|
|
# If we are building locally, or the build on Read the Docs looks like a PR
|
|
|
|
# build, prefer to use the version of the theme in this repo, not the installed
|
|
|
|
# version of the theme.
|
|
|
|
def is_development_build():
|
|
|
|
# PR builds have an interger version
|
|
|
|
re_version = re.compile(r'^[\d]+$')
|
|
|
|
if 'READTHEDOCS' in os.environ:
|
|
|
|
version = os.environ.get('READTHEDOCS_VERSION', '')
|
|
|
|
if re_version.match(version):
|
|
|
|
return True
|
|
|
|
return False
|
|
|
|
return True
|
|
|
|
|
|
|
|
if is_development_build():
|
2019-07-19 16:29:24 -05:00
|
|
|
sys.path.insert(0, os.path.abspath('..'))
|
2017-12-20 22:16:03 -06:00
|
|
|
sys.path.append(os.path.abspath('./demo/'))
|
2013-11-03 21:39:37 -06:00
|
|
|
|
2019-11-06 19:58:46 -06:00
|
|
|
import sphinx_rtd_theme
|
2018-09-26 15:35:45 -05:00
|
|
|
from sphinx.locale import _
|
2013-11-03 15:37:56 -06:00
|
|
|
|
2018-09-26 15:35:45 -05:00
|
|
|
project = u'Read the Docs Sphinx Theme'
|
|
|
|
slug = re.sub(r'\W+', '-', project.lower())
|
2021-01-04 16:13:31 -06:00
|
|
|
version = '0.5.1'
|
|
|
|
release = '0.5.1'
|
2018-09-26 15:35:45 -05:00
|
|
|
author = u'Dave Snider, Read the Docs, Inc. & contributors'
|
|
|
|
copyright = author
|
|
|
|
language = 'en'
|
2013-11-03 15:37:56 -06:00
|
|
|
|
2013-11-04 22:02:16 -06:00
|
|
|
extensions = [
|
2018-02-02 17:43:18 -06:00
|
|
|
'sphinx.ext.intersphinx',
|
2013-11-06 07:40:07 -06:00
|
|
|
'sphinx.ext.autodoc',
|
|
|
|
'sphinx.ext.mathjax',
|
|
|
|
'sphinx.ext.viewcode',
|
2016-09-30 09:25:31 -05:00
|
|
|
'sphinxcontrib.httpdomain',
|
2018-05-01 09:01:07 -05:00
|
|
|
'sphinx_rtd_theme',
|
2013-11-04 22:02:16 -06:00
|
|
|
]
|
|
|
|
|
2013-11-03 15:37:56 -06:00
|
|
|
templates_path = ['_templates']
|
|
|
|
source_suffix = '.rst'
|
|
|
|
exclude_patterns = []
|
2019-07-16 21:27:16 -05:00
|
|
|
locale_dirs = ['locale/']
|
|
|
|
gettext_compact = False
|
2013-11-03 15:37:56 -06:00
|
|
|
|
2018-09-26 15:35:45 -05:00
|
|
|
master_doc = 'index'
|
|
|
|
suppress_warnings = ['image.nonlocal_uri']
|
2018-01-14 14:40:41 -06:00
|
|
|
pygments_style = 'default'
|
2013-11-03 15:37:56 -06:00
|
|
|
|
2018-09-26 15:35:45 -05:00
|
|
|
intersphinx_mapping = {
|
|
|
|
'rtd': ('https://docs.readthedocs.io/en/latest/', None),
|
2019-01-22 16:20:23 -06:00
|
|
|
'sphinx': ('http://www.sphinx-doc.org/en/stable/', None),
|
2018-09-26 15:35:45 -05:00
|
|
|
}
|
2013-11-03 15:37:56 -06:00
|
|
|
|
|
|
|
html_theme = 'sphinx_rtd_theme'
|
2014-01-05 16:17:41 -06:00
|
|
|
html_theme_options = {
|
2020-02-24 20:55:07 -06:00
|
|
|
'logo_only': True,
|
|
|
|
'navigation_depth': 5,
|
2014-01-05 16:17:41 -06:00
|
|
|
}
|
2019-11-06 19:58:46 -06:00
|
|
|
html_context = {}
|
|
|
|
|
|
|
|
if not 'READTHEDOCS' in os.environ:
|
|
|
|
html_static_path = ['_static/']
|
|
|
|
html_js_files = ['debug.js']
|
|
|
|
|
|
|
|
# Add fake versions for local QA of the menu
|
|
|
|
html_context['test_versions'] = list(map(
|
|
|
|
lambda x: str(x / 10),
|
|
|
|
range(1, 100)
|
|
|
|
))
|
|
|
|
|
2017-12-20 22:29:52 -06:00
|
|
|
html_logo = "demo/static/logo-wordmark-light.svg"
|
2013-11-06 07:40:07 -06:00
|
|
|
html_show_sourcelink = True
|
2013-11-03 15:37:56 -06:00
|
|
|
|
2018-09-26 15:35:45 -05:00
|
|
|
htmlhelp_basename = slug
|
2013-11-03 15:37:56 -06:00
|
|
|
|
2020-02-24 20:55:07 -06:00
|
|
|
|
2013-11-03 15:37:56 -06:00
|
|
|
latex_documents = [
|
2018-09-26 15:35:45 -05:00
|
|
|
('index', '{0}.tex'.format(slug), project, author, 'manual'),
|
2013-11-03 15:37:56 -06:00
|
|
|
]
|
|
|
|
|
|
|
|
man_pages = [
|
2018-09-26 15:35:45 -05:00
|
|
|
('index', slug, project, [author], 1)
|
2013-11-03 15:37:56 -06:00
|
|
|
]
|
|
|
|
|
|
|
|
texinfo_documents = [
|
2018-09-26 15:35:45 -05:00
|
|
|
('index', slug, project, author, slug, project, 'Miscellaneous'),
|
2013-11-03 15:37:56 -06:00
|
|
|
]
|
|
|
|
|
|
|
|
|
2018-09-26 15:35:45 -05:00
|
|
|
# Extensions to theme docs
|
|
|
|
def setup(app):
|
|
|
|
from sphinx.domains.python import PyField
|
|
|
|
from sphinx.util.docfields import Field
|
|
|
|
|
|
|
|
app.add_object_type(
|
|
|
|
'confval',
|
|
|
|
'confval',
|
|
|
|
objname='configuration value',
|
|
|
|
indextemplate='pair: %s; configuration value',
|
|
|
|
doc_field_types=[
|
|
|
|
PyField(
|
|
|
|
'type',
|
|
|
|
label=_('Type'),
|
|
|
|
has_arg=False,
|
|
|
|
names=('type',),
|
|
|
|
bodyrolename='class'
|
|
|
|
),
|
|
|
|
Field(
|
|
|
|
'default',
|
|
|
|
label=_('Default'),
|
|
|
|
has_arg=False,
|
|
|
|
names=('default',),
|
|
|
|
),
|
|
|
|
]
|
|
|
|
)
|