Re: [PATCH] Fix how CSS files are added to the Sphinx HTML.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Eric, 

I'am happy to see you here ;-)

Am 02.09.2016 um 02:09 schrieb Eric Holscher <eric@xxxxxxxxxxxxxxxx>:

> This uses the proper Sphinx add_stylesheet API for adding style overrides:
> 
> http://www.sphinx-doc.org/en/stable/extdev/appapi.html#sphinx.application.Sphinx.add_stylesheet
> 
> Previously,
> if a user had any other `css_files` defined by extensions,
> they would be overwritten by the `html_context` redefinition here.

I tested your patch only without a builder adding 'css_files', but taking
a look at sphinx sources shows me, that you are right: 'css_files' will
be overwritten, which is not good.

> 
> Signed-off-by: Eric Holscher <eric@xxxxxxxxxxxxxxxx>
> ---
> Documentation/conf.py | 14 ++++++++------
> 1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/Documentation/conf.py b/Documentation/conf.py
> index 96b7aa6..1707193 100644
> --- a/Documentation/conf.py
> +++ b/Documentation/conf.py
> @@ -179,12 +179,6 @@ except ImportError:
> 
> html_static_path = ['sphinx-static']
> 
> -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
> # directly to the root of the documentation.
> @@ -419,3 +413,11 @@ pdf_documents = [
> # line arguments.
> kerneldoc_bin = '../scripts/kernel-doc'
> kerneldoc_srctree = '..'
> +
> +
> +def setup(app):
> +    """
> +    This is a basic Sphinx extension that adds our CSS overrides.
> +    """
> +    app.add_stylesheet('_static/theme_overrides.css')

Hmm, this will not work, Since the '_static' folder is not needed
to name here. As far as I know, with

   html_static_path = ['sphinx-static']

everything from the 'sphinx-static' is copied to HTML builder's
'_static' folder. And a (corrected)

  app.add_stylesheet('theme_overrides.css')

will insert a:

<link rel="stylesheet" href="_static/theme_overrides.css" type="text/css" />

in the HTML header of the builder (the '_static' folder is added by the HTML
builder).

Anyway, let me say thanks ... and it would be great if you add 
more of your value to the ML ;-)

-- Markus --

> +    
> -- 
> 2.6.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-doc" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux