14
14
#
15
15
16
16
17
+ import importlib
17
18
import sys
18
19
import os.path
19
20
from six import string_types
@@ -39,31 +40,23 @@ if os.path.exists('_static'):
39
40
html_static_path.append('{{ static_path }}')
40
41
41
42
# Add RTD Theme only if they aren't overriding it already
42
- using_rtd_theme = False
43
- if 'html_theme' in globals():
44
- if html_theme in ['default']:
43
+ using_rtd_theme = (
44
+ (
45
+ 'html_theme' in globals() and
46
+ html_theme in ['default'] and
45
47
# Allow people to bail with a hack of having an html_style
46
- if not 'html_style' in globals():
47
- import sphinx_rtd_theme
48
- html_theme = 'sphinx_rtd_theme'
49
- html_style = None
50
- html_theme_options = {}
51
- if 'html_theme_path' in globals():
52
- html_theme_path.append(sphinx_rtd_theme.get_html_theme_path())
53
- else:
54
- html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
55
-
56
- using_rtd_theme = True
57
- else:
58
- import sphinx_rtd_theme
59
- html_theme = 'sphinx_rtd_theme'
48
+ 'html_style' not in globals()
49
+ ) or 'html_theme' not in globals()
50
+ )
51
+ if using_rtd_theme:
52
+ theme = importlib.import_module('{{ html_theme_import }}')
53
+ html_theme = '{{ html_theme }}'
60
54
html_style = None
61
55
html_theme_options = {}
62
56
if 'html_theme_path' in globals():
63
- html_theme_path.append(sphinx_rtd_theme .get_html_theme_path())
57
+ html_theme_path.append(theme .get_html_theme_path())
64
58
else:
65
- html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
66
- using_rtd_theme = True
59
+ html_theme_path = [theme.get_html_theme_path()]
67
60
68
61
if globals().get('websupport2_base_url', False):
69
62
websupport2_base_url = '{{ api_host }}/websupport'
0 commit comments