doc_builder: remove duplication around html_theme
@@ -39,11 +39,15 @@ if os.path.exists('_static'):
html_static_path.append('{{ static_path }}')
# Add RTD Theme only if they aren't overriding it already
-using_rtd_theme = False
-if 'html_theme' in globals():
- if html_theme in ['default']:
+using_rtd_theme = (
+ (
+ 'html_theme' in globals() and
+ html_theme in ['default'] and
# Allow people to bail with a hack of having an html_style
- if not 'html_style' in globals():
+ 'html_style' not in globals()
+ ) or 'html_theme' not in globals()
+)
+if using_rtd_theme:
import sphinx_rtd_theme
html_theme = 'sphinx_rtd_theme'
html_style = None
@@ -53,18 +57,6 @@ if 'html_theme' in globals():
else:
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
- using_rtd_theme = True
-else:
- import sphinx_rtd_theme
- html_theme = 'sphinx_rtd_theme'
- html_style = None
- html_theme_options = {}
- if 'html_theme_path' in globals():
- html_theme_path.append(sphinx_rtd_theme.get_html_theme_path())
- else:
- html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
- using_rtd_theme = True
-
if globals().get('websupport2_base_url', False):
websupport2_base_url = '{{ api_host }}/websupport'
if 'http' not in settings.MEDIA_URL:
