mirror of
https://github.com/readthedocs/sphinx_rtd_theme.git
synced 2025-02-25 18:55:21 -06:00
* Show version/language selectors below the title * Use CSS styles from old attempt https://github.com/readthedocs/sphinx_rtd_theme/pull/438 * Update CSS to apply to both selectors * Prepend the current version if it's hidden * Split it into two different configs * Use correct value for language * Make the selectors more prominent * Typo fix on comment * Update CSS * Update JavaScript * Always include the version javascript * Only include the languages if there is one * Change `display_version` default * HTML layout rework * Update docs * HTML layout fix * Docs typo * Update CSS * Updates from review * re-compile CSS * Update CSS * Apply suggestions from code review Co-authored-by: Eric Holscher <25510+ericholscher@users.noreply.github.com> * Use the prettier to lint the file * Whitespaces * Update event listener * Update CSS * Update CSS * Remove language switch if there are not translations * Tune version and language selector styles (#1603) * Tuning on select width and icon placement * Use better cursor * Add a max width to selects so that they can't overflow * Only add after pseudo element if select exists * Lint * Debug: trigger Read the Docs Addons event to test/debug locally (#1606) * Debug: trigger Read the Docs Addons event to test/debug locally Closes #1605 * Push missing file --------- Co-authored-by: Eric Holscher <25510+ericholscher@users.noreply.github.com> Co-authored-by: Anthony <aj@ohess.org>
112 lines
2.6 KiB
Python
112 lines
2.6 KiB
Python
# -*- coding: utf-8 -*-
|
|
|
|
import sys
|
|
import os
|
|
import re
|
|
|
|
# Prefer to use the version of the theme in this repo
|
|
# and not the installed version of the theme.
|
|
sys.path.insert(0, os.path.abspath('..'))
|
|
sys.path.append(os.path.abspath('./demo/'))
|
|
|
|
from sphinx_rtd_theme import __version__ as theme_version
|
|
from sphinx_rtd_theme import __version_full__ as theme_version_full
|
|
from sphinx.locale import _
|
|
|
|
project = u'Read the Docs Sphinx Theme'
|
|
slug = re.sub(r'\W+', '-', project.lower())
|
|
version = theme_version
|
|
release = theme_version_full
|
|
author = u'Dave Snider, Read the Docs, Inc. & contributors'
|
|
copyright = author
|
|
language = 'en'
|
|
|
|
extensions = [
|
|
'sphinx.ext.intersphinx',
|
|
'sphinx.ext.autodoc',
|
|
'sphinx.ext.autosummary',
|
|
'sphinx.ext.mathjax',
|
|
'sphinx.ext.viewcode',
|
|
'sphinx_rtd_theme',
|
|
]
|
|
|
|
templates_path = ['_templates']
|
|
source_suffix = '.rst'
|
|
exclude_patterns = []
|
|
locale_dirs = ['locale/']
|
|
gettext_compact = False
|
|
|
|
master_doc = 'index'
|
|
suppress_warnings = ['image.nonlocal_uri']
|
|
pygments_style = 'default'
|
|
|
|
if sys.version_info < (3, 0):
|
|
tags.add("python2")
|
|
else:
|
|
tags.add("python3")
|
|
|
|
intersphinx_mapping = {
|
|
'rtd': ('https://docs.readthedocs.io/en/stable/', None),
|
|
'rtd-dev': ('https://dev.readthedocs.io/en/stable/', None),
|
|
'sphinx': ('https://www.sphinx-doc.org/en/master/', None),
|
|
}
|
|
|
|
html_theme = 'sphinx_rtd_theme'
|
|
html_theme_options = {
|
|
'logo_only': True,
|
|
'navigation_depth': 5,
|
|
}
|
|
html_context = {}
|
|
|
|
if not 'READTHEDOCS' in os.environ:
|
|
html_static_path = ['_static/']
|
|
html_js_files = ['debug.js']
|
|
html_context["DEBUG"] = True
|
|
|
|
html_logo = "demo/static/logo-wordmark-light.svg"
|
|
html_show_sourcelink = True
|
|
html_favicon = "demo/static/favicon.ico"
|
|
|
|
htmlhelp_basename = slug
|
|
|
|
|
|
latex_documents = [
|
|
('index', '{0}.tex'.format(slug), project, author, 'manual'),
|
|
]
|
|
|
|
man_pages = [
|
|
('index', slug, project, [author], 1)
|
|
]
|
|
|
|
texinfo_documents = [
|
|
('index', slug, project, author, slug, project, 'Miscellaneous'),
|
|
]
|
|
|
|
|
|
# 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',),
|
|
),
|
|
]
|
|
)
|