[libcamera-devel] Documentation: theme: Fix compilation with Sphinx >= 7.0.0
diff mbox series

Message ID 20230728193957.19723-1-laurent.pinchart@ideasonboard.com
State Accepted
Commit 6cb92b523bd60bd7718df134cc5b1eff51cf42e5
Headers show
Series
  • [libcamera-devel] Documentation: theme: Fix compilation with Sphinx >= 7.0.0
Related show

Commit Message

Laurent Pinchart July 28, 2023, 7:39 p.m. UTC
Sphinx 7.0.0 has dropped support for the deprecated 'style' variable
(https://github.com/sphinx-doc/sphinx/pull/11381). This breaks
compilation of the documentation:

  /usr/bin/sphinx-build -D release=v0.1.0+16-eed6a079 -q -W -b html Documentation Documentation/html

  Theme error:
  An error happened in rendering the page api-html/index.
  Reason: UndefinedError("'style' is undefined")

The recommended replacement is 'styles[-1]'. However, this resolves to
'_static/css/theme.css', which is part of the 'css_styles' variable, and
results in the stylesheet being included twice. To avoid that and fix
the compilation error, simply drop the first reference.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
I've tested this change with Sphinx 7.0.1. If anyone can test with
earlier versions of Sphinx, that would be appreciated. Please verify in
the index.html that _static/css/theme.css is correctly referenced.
---
 Documentation/theme/layout.html | 5 -----
 1 file changed, 5 deletions(-)

Comments

Kieran Bingham July 28, 2023, 9:19 p.m. UTC | #1
Quoting Laurent Pinchart via libcamera-devel (2023-07-28 20:39:57)
> Sphinx 7.0.0 has dropped support for the deprecated 'style' variable
> (https://github.com/sphinx-doc/sphinx/pull/11381). This breaks
> compilation of the documentation:
> 
>   /usr/bin/sphinx-build -D release=v0.1.0+16-eed6a079 -q -W -b html Documentation Documentation/html
> 
>   Theme error:
>   An error happened in rendering the page api-html/index.
>   Reason: UndefinedError("'style' is undefined")
> 
> The recommended replacement is 'styles[-1]'. However, this resolves to
> '_static/css/theme.css', which is part of the 'css_styles' variable, and
> results in the stylesheet being included twice. To avoid that and fix
> the compilation error, simply drop the first reference.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
> I've tested this change with Sphinx 7.0.1. If anyone can test with
> earlier versions of Sphinx, that would be appreciated. Please verify in
> the index.html that _static/css/theme.css is correctly referenced.

Output looks sane to me.


Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> ---
>  Documentation/theme/layout.html | 5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/Documentation/theme/layout.html b/Documentation/theme/layout.html
> index fcc6d221870c..4fffefab62eb 100644
> --- a/Documentation/theme/layout.html
> +++ b/Documentation/theme/layout.html
> @@ -33,11 +33,6 @@ SPDX-License-Identifier: CC-BY-SA-4.0
>  
>    {% endif %}
>  
> -  {# RTD hosts this file, so just load on non RTD builds #}
> -  {% if not READTHEDOCS %}
> -    <link rel="stylesheet" href="{{ pathto('_static/' + style, 1) }}" type="text/css" />
> -  {% endif %}
> -
>    {% for cssfile in css_files %}
>      <link rel="stylesheet" href="{{ pathto(cssfile, 1) }}" type="text/css" />
>    {% endfor %}
> -- 
> Regards,
> 
> Laurent Pinchart
>

Patch
diff mbox series

diff --git a/Documentation/theme/layout.html b/Documentation/theme/layout.html
index fcc6d221870c..4fffefab62eb 100644
--- a/Documentation/theme/layout.html
+++ b/Documentation/theme/layout.html
@@ -33,11 +33,6 @@  SPDX-License-Identifier: CC-BY-SA-4.0
 
   {% endif %}
 
-  {# RTD hosts this file, so just load on non RTD builds #}
-  {% if not READTHEDOCS %}
-    <link rel="stylesheet" href="{{ pathto('_static/' + style, 1) }}" type="text/css" />
-  {% endif %}
-
   {% for cssfile in css_files %}
     <link rel="stylesheet" href="{{ pathto(cssfile, 1) }}" type="text/css" />
   {% endfor %}