Exemple #1
0
def get_default_stylesheet(css=None):
    """
    Returns the style of additional style sheets.

    @param     css  additional css files
    @return         list of files
    """
    # delayed import to speed up time
    from sphinx.builders.html import Stylesheet
    rel = "_static/" + style_figure_notebook[0]
    res = [Stylesheet(rel="stylesheet", filename=rel)]
    if css is not None:
        for cs in css:
            res.append(Stylesheet(rel="stylesheet", filename=cs))
    return res
Exemple #2
0
    def add_stylesheet(self, filename, alternate=False, title=None):
        # type: (unicode, bool, unicode) -> None
        """Register a stylesheet to include in the HTML output.

        Add *filename* to the list of CSS files that the default HTML template
        will include.  Like for :meth:`add_javascript`, the filename must be
        relative to the HTML static path, or a full URI with scheme.

        .. versionadded:: 1.0

        .. versionchanged:: 1.6
           Optional ``alternate`` and/or ``title`` attributes can be supplied
           with the *alternate* (of boolean type) and *title* (a string)
           arguments. The default is no title and *alternate* = ``False``. For
           more information, refer to the `documentation
           <https://mdn.io/Web/CSS/Alternative_style_sheets>`__.
        """
        logger.debug('[app] adding stylesheet: %r', filename)
        from sphinx.builders.html import StandaloneHTMLBuilder, Stylesheet
        if '://' not in filename:
            filename = posixpath.join('_static', filename)
        if alternate:
            rel = u'alternate stylesheet'
        else:
            rel = u'stylesheet'
        css = Stylesheet(filename, title, rel)  # type: ignore
        StandaloneHTMLBuilder.css_files.append(css)
Exemple #3
0
 def add_stylesheet(self, filename, alternate=False, title=None):
     # type: (unicode, bool, unicode) -> None
     logger.debug('[app] adding stylesheet: %r', filename)
     from sphinx.builders.html import StandaloneHTMLBuilder, Stylesheet
     if '://' not in filename:
         filename = posixpath.join('_static', filename)
     if alternate:
         rel = u'alternate stylesheet'
     else:
         rel = u'stylesheet'
     css = Stylesheet(filename, title, rel)  # type: ignore
     StandaloneHTMLBuilder.css_files.append(css)
Exemple #4
0
def get_default_stylesheet():
    """
    Returns the style of additional style sheets

    @return         list of files

    .. versionadded:: 1.5
    """
    rel = "_static/" + style_figure_notebook[0]
    # rel2 = "_static/gallery.css"  # This should not be needed for sphinx-gallery.
    return [
        Stylesheet(rel="stylesheet",
                   title="style_figure_notebook",
                   filename=rel)
    ]
def get_default_stylesheet():
    """
    Returns the style of additional style sheets.

    @return         list of files
    """
    # delayed import to speed up time
    from sphinx.builders.html import Stylesheet
    rel = "_static/" + style_figure_notebook[0]
    # rel2 = "_static/gallery.css"  # This should not be needed for sphinx-gallery.
    return [
        Stylesheet(rel="stylesheet",
                   title="style_figure_notebook",
                   filename=rel)
    ]
 def add_css_file(self, filename: str, **kwargs: str) -> None:
     self.css_files.append(Stylesheet(filename, **kwargs))  # type: ignore
Exemple #7
0
    def add_css_file(self, filename, **kwargs):
        # type: (str, **str) -> None
        if '://' not in filename:
            filename = posixpath.join('_static', filename)

        self.css_files.append(Stylesheet(filename, **kwargs))  # type: ignore