docs/source/conf.py: Use the read the docs theme if available

It is useful to build avocado docs locally and have them
look mostly identical to the reference documentation,
hosted in read the docs. The theme can be installed using
pip with:

pip install sphinx_rtd_theme

And if not present, the build should gracefully
degrade to the sphinx default.
Signed-off-by: NLucas Meneghel Rodrigues <lmr@redhat.com>
上级 40199ab0
......@@ -106,9 +106,16 @@ pygments_style = 'sphinx'
# -- Options for HTML output ---------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'default'
# on_rtd is whether we are on readthedocs.org, this line of code grabbed from docs.readthedocs.org
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
if not on_rtd: # only import and set the theme if we're building docs locally
try:
import sphinx_rtd_theme
html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
except ImportError:
html_theme = 'default'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册