sphinx_rtd_theme
sphinx_rtd_theme copied to clipboard
Update layout.html to support a sphinx version that is not three-integers
Update layout.html to support a sphinx version that is not three-integers.
Useful for sphinx==5.2.0.post0, which would cause the theme to fail otherwise. Closes #1343.
Note that packaging is already a dependency transitively - but it is now an explicit dependency.
I added readthedocs-sphinx-ext as a test dependency, as I believe it is (and I couldn't get the tests passing locally without it).
By the way: I tested this with a theme that extends sphinx_rtd_theme, and it all checks out nicely - I am able to access sphinx_version_info from a custom layout, such as:
{% extends "sphinx_rtd_theme/layout.html" %}
{%- block htmltitle %}
{{ super() }}
Hello world
{{ sphinx_version_info }}
{% endblock %}
Where the theme I created had a config like:
[theme]
inherit = sphinx_rtd_theme
And registering the theme with:
def config_inited_handler(app: Sphinx, config: Config) -> None:
"""
Handler to register the theme's extra templates directory once the config
has been read.
"""
_ = app # Unused.
config.templates_path.append(str(HERE/'templates'))
def setup(app: Sphinx):
"""
Configure the given Sphinx app to know about the acc_py theme.
"""
app.add_html_theme('my-theme', str(HERE))
# Register the theme's extra templates directory once the config has been
# read.
app.connect('config-inited', config_inited_handler)
Posting here to validate that adding the new use of app.connect("html-page-context", extend_html_context) shouldn't result in any unexpected surprises...
Posting here to validate that adding the new use of
app.connect("html-page-context", extend_html_context)shouldn't result in any unexpected surprises...
This was also the one that caught my interest. But I think that it's safe. As this event is only relevant for the HTML builder, I believe that we can trust the output from the PR build.
Thanks so much @pelson for the solid work and addressing all the feedback :100: