Skip to content

Commit cc53ced

Browse files
author
Jonathan Visser
committed
Patch layout.html to support Sphinx 8
1 parent bdeb606 commit cc53ced

File tree

1 file changed

+13
-17
lines changed

1 file changed

+13
-17
lines changed

docs/_templates/layout.html

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,22 @@
2828
{%- endblock -%}
2929

3030
{#- CSS #}
31-
{%- if sphinx_version_info < (4, 0) -%}
32-
<link rel="stylesheet" href="{{ pathto('_static/' + style, 1) }}" type="text/css" />
33-
<link rel="stylesheet" href="{{ pathto('_static/pygments.css', 1) }}" type="text/css" />
34-
{%- endif %}
35-
{%- if theme_analytics_id %}
36-
<link rel="stylesheet" href="{{ pathto('_static/cookieconsent.css', 1) }}" type="text/css" />
37-
{%- endif %}
38-
{%- for css in css_files %}
39-
{%- if css|attr("rel") %}
40-
<link rel="{{ css.rel }}" href="{{ pathto(css.filename, 1) }}" type="text/css"{% if css.title is not none %} title="{{ css.title }}"{% endif %} />
31+
{%- for css_file in css_files %}
32+
{%- if css_file|attr("filename") %}
33+
{{ css_tag(css_file) }}
4134
{%- else %}
42-
{%- if css.filename.startswith('https://') %}
43-
<link rel="stylesheet" href="{{ css.filename }}" type="text/css" />
44-
{%- else %}
45-
<link rel="stylesheet" href="{{ pathto(css.filename, 1) }}" type="text/css" />
46-
{%- endif %}
35+
<link rel="stylesheet" href="{{ pathto(css_file, 1)|escape }}" type="text/css" />
4736
{%- endif %}
4837
{%- endfor %}
49-
{%- for cssfile in extra_css_files %}
50-
<link rel="stylesheet" href="{{ pathto(cssfile, 1) }}" type="text/css" />
38+
39+
{#
40+
"extra_css_files" is an undocumented Read the Docs theme specific option.
41+
There is no need to check for ``|attr("filename")`` here because it's always a string.
42+
Note that this option should be removed in favor of regular ``html_css_files``:
43+
https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_css_files
44+
#}
45+
{%- for css_file in extra_css_files %}
46+
<link rel="stylesheet" href="{{ pathto(css_file, 1)|escape }}" type="text/css" />
5147
{%- endfor -%}
5248

5349
{#- FAVICON #}

0 commit comments

Comments
 (0)