Skip to content

Commit

Permalink
docs: conf.py: fix support for Readthedocs v 1.0.0
Browse files Browse the repository at this point in the history
As described at:
	https://stackoverflow.com/questions/23211695/modifying-content-width-of-the-sphinx-theme-read-the-docs

since Sphinx 1.8, the standard way to setup a custom theme is
to use html_css_files. While using html_context is OK with RTD
0.5.2, it doesn't work with 1.0.0, causing the theme to not load,
producing a very weird html.

Tested with:
	- Sphinx 1.7.9 + sphinx-rtd-theme 0.5.2
	- Sphinx 2.4.4 + sphinx-rtd-theme 0.5.2
	- Sphinx 2.4.4 + sphinx-rtd-theme 1.0.0
	- Sphinx 4.3.0 + sphinx-rtd-theme 1.0.0

Reported-by: Hans Verkuil <[email protected]>
Tested-by: Hans Verkuil <[email protected]>
Reviewed-by: Laurent Pinchart <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
Tested-by: Akira Yokosawa <[email protected]>
Link: https://lore.kernel.org/r/80009f0d17ea0840d81e7e16fff6e7677919fdfc.1638004294.git.mchehab+huawei@kernel.org
Signed-off-by: Jonathan Corbet <[email protected]>
  • Loading branch information
mchehab authored and Jonathan Corbet committed Nov 29, 2021
1 parent b96ff02 commit d69dab7
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions Documentation/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,16 @@

html_static_path = ['sphinx-static']

html_context = {
'css_files': [
'_static/theme_overrides.css',
],
}
html_css_files = [
'theme_overrides.css',
]

if major <= 1 and minor < 8:
html_context = {
'css_files': [
'_static/theme_overrides.css',
],
}

# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
Expand Down

0 comments on commit d69dab7

Please sign in to comment.