| 1 |
# -*- coding: utf-8 -*- |
| 2 |
|
| 3 |
import sys |
| 4 |
import os |
| 5 |
import re |
| 6 |
|
| 7 |
# Prefer to use the version of the theme in this repo |
| 8 |
# and not the installed version of the theme. |
| 9 |
sys.path.insert(0, os.path.abspath('..')) |
| 10 |
sys.path.append(os.path.abspath('./demo/')) |
| 11 |
|
| 12 |
from sphinx_rtd_theme import __version__ as theme_version |
| 13 |
from sphinx_rtd_theme import __version_full__ as theme_version_full |
| 14 |
from sphinx.locale import _ |
| 15 |
|
| 16 |
project = u'Read the Docs Sphinx Theme' |
| 17 |
slug = re.sub(r'\W+', '-', project.lower()) |
| 18 |
version = theme_version |
| 19 |
release = theme_version_full |
| 20 |
author = u'Dave Snider, Read the Docs, Inc. & contributors' |
| 21 |
copyright = author |
| 22 |
language = 'en' |
| 23 |
|
| 24 |
extensions = [ |
| 25 |
'sphinx.ext.intersphinx', |
| 26 |
'sphinx.ext.autodoc', |
| 27 |
'sphinx.ext.autosummary', |
| 28 |
'sphinx.ext.mathjax', |
| 29 |
'sphinx.ext.viewcode', |
| 30 |
'sphinx_rtd_theme', |
| 31 |
] |
| 32 |
|
| 33 |
templates_path = ['_templates'] |
| 34 |
source_suffix = '.rst' |
| 35 |
exclude_patterns = [] |
| 36 |
locale_dirs = ['locale/'] |
| 37 |
gettext_compact = False |
| 38 |
|
| 39 |
master_doc = 'index' |
| 40 |
suppress_warnings = ['image.nonlocal_uri'] |
| 41 |
pygments_style = 'default' |
| 42 |
|
| 43 |
if sys.version_info < (3, 0): |
| 44 |
tags.add("python2") |
| 45 |
else: |
| 46 |
tags.add("python3") |
| 47 |
|
| 48 |
intersphinx_mapping = { |
| 49 |
'rtd': ('https://docs.readthedocs.io/en/stable/', None), |
| 50 |
'rtd-dev': ('https://dev.readthedocs.io/en/stable/', None), |
| 51 |
'sphinx': ('https://www.sphinx-doc.org/en/master/', None), |
| 52 |
} |
| 53 |
|
| 54 |
html_theme = 'sphinx_rtd_theme' |
| 55 |
html_theme_options = { |
| 56 |
'logo_only': True, |
| 57 |
'navigation_depth': 5, |
| 58 |
} |
| 59 |
html_context = {} |
| 60 |
|
| 61 |
if not 'READTHEDOCS' in os.environ: |
| 62 |
html_static_path = ['_static/'] |
| 63 |
html_js_files = ['debug.js'] |
| 64 |
html_context["DEBUG"] = True |
| 65 |
|
| 66 |
html_logo = "demo/static/logo-wordmark-light.svg" |
| 67 |
html_show_sourcelink = True |
| 68 |
html_favicon = "demo/static/favicon.ico" |
| 69 |
|
| 70 |
htmlhelp_basename = slug |
| 71 |
|
| 72 |
|
| 73 |
latex_documents = [ |
| 74 |
('index', '{0}.tex'.format(slug), project, author, 'manual'), |
| 75 |
] |
| 76 |
|
| 77 |
man_pages = [ |
| 78 |
('index', slug, project, [author], 1) |
| 79 |
] |
| 80 |
|
| 81 |
texinfo_documents = [ |
| 82 |
('index', slug, project, author, slug, project, 'Miscellaneous'), |
| 83 |
] |
| 84 |
|
| 85 |
|
| 86 |
# Extensions to theme docs |
| 87 |
def setup(app): |
| 88 |
from sphinx.domains.python import PyField |
| 89 |
from sphinx.util.docfields import Field |
| 90 |
|
| 91 |
app.add_object_type( |
| 92 |
'confval', |
| 93 |
'confval', |
| 94 |
objname='configuration value', |
| 95 |
indextemplate='pair: %s; configuration value', |
| 96 |
doc_field_types=[ |
| 97 |
PyField( |
| 98 |
'type', |
| 99 |
label=_('Type'), |
| 100 |
has_arg=False, |
| 101 |
names=('type',), |
| 102 |
bodyrolename='class' |
| 103 |
), |
| 104 |
Field( |
| 105 |
'default', |
| 106 |
label=_('Default'), |
| 107 |
has_arg=False, |
| 108 |
names=('default',), |
| 109 |
), |
| 110 |
] |
| 111 |
) |