on master help sign in
Can build docs locally using ReadTheDocs Theme.

Updated the configuration for the sphinx documentation, such that if the readthedocs theme is locally installed then said theme will be used otherwise the 'default' theme will be used. This hack is required due to an issue with readthedocs setup in use of its theme remotly and locally. Sources: + http://docs.readthedocs.org/en/latest/theme.html#how-do-i-use-this-locally-and-on-read-the-docs

commita687f5d5bd1946e471e135df7ad22878d24f9fd2 authorJan de Muijnck-Hughes <jfdm@st-andrews.ac.uk> dateTue 31 Mar 2015, 10:22 (12 years ago) parent5c8c1d3
2 files changed+16
docs/README.md+6 docs/conf.py+10
docs/README.md+6
@@ -18,6 +18,12 @@ Sphinx can be installed either through your hosts package manager or using pip/e
1818 of readthedocs and be ignored. In the past we had several code-blocks
1919 disappear because of that.
2020
21+The ReadTheDocs theme can be installed using pip as follows:
22+
23+```sh
24+pip install sphinx_rtd_theme
25+```
26+
2127### LaTeX
2228
2329LaTeX can be install either using your systems package manager or direct from TeXLive.
docs/conf.py+10
@@ -15,6 +15,9 @@
1515import sys
1616import os
1717
18+# True if the readthedocs theme is locally installed
19+on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
20+
1821# If extensions (or modules to document with autodoc) are in another directory,
1922# add these directories to sys.path here. If the directory is relative to the
2023# documentation root, use os.path.abspath to make it absolute, like shown here.
@@ -111,6 +114,13 @@ todo_include_todos = True
111114# a list of builtin themes.
112115html_theme = "default"
113116
117+if not on_rtd: # only import and set the theme if we're building docs locally
118+ import sphinx_rtd_theme
119+ html_theme = 'sphinx_rtd_theme'
120+ html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
121+
122+
123+
114124# Theme options are theme-specific and customize the look and feel of a theme
115125# further. For a list of options available for each theme, see the
116126# documentation.