Skip to content

Commit 658c345

Browse files
committed
STORY-18531: Update older version to match current theme
1 parent c2ae8d8 commit 658c345

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

.readthedocs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ sphinx:
1919
# https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
2020
python:
2121
install:
22-
- requirements: requirements.txt
22+
- requirements: requirements.txt

requirements.pip renamed to requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ sphinx
22
sphinx-rtd-theme
33
sphinxcontrib-httpdomain
44
-e git+https://github.com/rtfd/recommonmark.git#egg=recommonmark
5+
PyYAML
6+
ipdb

source/conf.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def build_template(match, template_file_name):
100100

101101
# open the template and find/replace the keys with the values
102102
template = open('{}{}'.format(custom_template_path, template_file_name), 'r').read()
103-
for search, replacement in template_vars.iteritems():
103+
for search, replacement in template_vars.items():
104104
if re.search(search, template):
105105
template = template.replace(search, replacement)
106106
else:
@@ -133,7 +133,7 @@ def source_handler(app, docname, source):
133133
source[0] = build_api_endpoint_template(source[0])
134134

135135
# Replace @@API_VERSION in templates with strings from doc_versions.py
136-
for symbol_string, version_string in VERSIONS.iteritems():
136+
for symbol_string, version_string in VERSIONS.items():
137137
source[0] = re.sub(symbol_string, version_string, source[0])
138138

139139
# Replace all occurences of @@ variables in partials (.rst files beginning w/ an underscore)
@@ -143,7 +143,7 @@ def build_partials(app, env, docnames):
143143
if re.search(r"/_[^/]+$", docname) and not re.search('custom_template', docname):
144144
# Replace @@API_VERSION with strings in doc_versions.py
145145
partial = open('{}{}{}'.format(source_path, docname, '.rst'), 'r').read()
146-
for symbol_string, version_string in VERSIONS.iteritems():
146+
for symbol_string, version_string in VERSIONS.items():
147147
partial = re.sub(symbol_string, version_string, partial)
148148
new_docname = docname + '.tmp'
149149
tmp_files.append('{}{}'.format(source_path, new_docname))
@@ -200,13 +200,14 @@ def setup(app):
200200
app.connect('env-before-read-docs', build_partials)
201201
app.connect('source-read', source_handler)
202202
app.connect('html-page-context', update_body)
203-
app.add_javascript('js/custom.js')
204-
app.add_javascript('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js')
203+
app.add_js_file('js/custom.js')
204+
app.add_js_file('https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js')
205+
app.add_js_file('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js')
205206

206207
# This CSS is added BEFORE the RTD CSS, so it doesn't allow us to override their CSS
207208
# We re-add our CSS AFTER the RTD CSS using the update_body method. We have left this
208209
# in place here so the CSS will load when you build and view locally instead of on RTD
209-
app.add_stylesheet('css/custom.css')
210+
app.add_css_file('css/custom.css')
210211

211212
# The language for content autogenerated by Sphinx. Refer to documentation
212213
# for a list of supported languages.
@@ -252,13 +253,10 @@ def setup(app):
252253
# The theme to use for HTML and HTML Help pages. See the documentation for
253254
# a list of builtin themes.
254255

255-
# When building locally, the theme is not automatically imported
256-
# When we're not on read the docs, we have to import it and set the theme manually.
257-
if not on_rtd:
258-
import sphinx_rtd_theme
259-
html_theme = 'sphinx_rtd_theme'
260-
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
261-
256+
# The theme is not automatically imported by RTD, so we have to import manually
257+
import sphinx_rtd_theme
258+
html_theme = 'sphinx_rtd_theme'
259+
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
262260
html_context = {}
263261

264262
# Theme options are theme-specific and customize the look and feel of a theme

0 commit comments

Comments
 (0)