Skip to content

Commit af2d7f1

Browse files
committed
refactor 'if on_rtd'
1 parent cef8ade commit af2d7f1

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

doc/conf.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,13 @@
5757
# on_rtd is whether we are on readthedocs.org, this line of code grabbed from docs.readthedocs.org
5858
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
5959

60-
if not on_rtd: # only import and set the theme if we're building docs locally
60+
html_theme = 'sphinx_rtd_theme'
61+
# only import the theme if we're building docs locally
62+
if on_rtd:
63+
html_style = None
64+
using_rtd_theme = True
65+
else:
6166
import sphinx_rtd_theme
62-
html_theme = 'sphinx_rtd_theme'
6367
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
6468

6569
# The name for this set of Sphinx documents. If None, it defaults to
@@ -84,10 +88,6 @@
8488
html_theme_options = {
8589
'collapse_navigation': False,
8690
}
87-
if on_rtd: # only import and set the theme if we're building docs locally
88-
html_theme = 'sphinx_rtd_theme'
89-
html_style = None
90-
using_rtd_theme = True
9191

9292

9393
# If true, an OpenSearch description file will be output, and all pages will

0 commit comments

Comments
 (0)