From 32310a819012589211a68db8d8060fd1e3a499f5 Mon Sep 17 00:00:00 2001 From: Mathieu Leplatre Date: Tue, 24 Oct 2023 04:05:59 +0200 Subject: [PATCH] Fix #1522: fix `'str' object has no attribute 'attributes'` (#1528) * Fix #1522: fix attribute error if css is str * Revert "Fix #1522: fix attribute error if css is str" This reverts commit b22a77f35a4a966dc686e8681753cd54cbb91a16. * Use `css_tag` only for standard CSS files from Sphinx ... and keep using the custom `link` HTML tag for CSS files included via the HTML theme option `extra_css_files`. * Normalize template variables --------- Co-authored-by: Manuel Kaufmann Co-authored-by: Anthony Johnson --- sphinx_rtd_theme/layout.html | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sphinx_rtd_theme/layout.html b/sphinx_rtd_theme/layout.html index f3de11ad0..bf2c52733 100644 --- a/sphinx_rtd_theme/layout.html +++ b/sphinx_rtd_theme/layout.html @@ -28,12 +28,13 @@ {%- endif %} - {%- for css in css_files %} - {{ css_tag(css) }} + {%- for css_file in css_files %} + {{ css_tag(css_file) }} {%- endfor %} - {%- for cssfile in extra_css_files %} - {{ css_tag(cssfile) }} + {# "extra_css_files" is a theme option and it's always a string #} + {%- for css_file in extra_css_files %} + {%- endfor -%} {#- FAVICON