diff options
| author | Georg Brandl <georg@python.org> | 2009-06-16 21:05:20 +0200 |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2009-06-16 21:05:20 +0200 |
| commit | 53cc9c63d442dc56cfe2e22703f2dddae01e0e70 (patch) | |
| tree | fb7cb77908083e4a1a89f6d39aff25055e552a5a /sphinx | |
| parent | 71d862289c1bfc29fa75e18d82cb10ec89fc92bb (diff) | |
| download | sphinx-53cc9c63d442dc56cfe2e22703f2dddae01e0e70.tar.gz | |
#200: Added ``Sphinx.add_stylesheet()``.
Diffstat (limited to 'sphinx')
| -rw-r--r-- | sphinx/application.py | 5 | ||||
| -rw-r--r-- | sphinx/builders/html.py | 3 | ||||
| -rw-r--r-- | sphinx/themes/basic/layout.html | 3 |
3 files changed, 11 insertions, 0 deletions
diff --git a/sphinx/application.py b/sphinx/application.py index 7e926e57..b9c56d9f 100644 --- a/sphinx/application.py +++ b/sphinx/application.py @@ -323,6 +323,11 @@ class Sphinx(object): StandaloneHTMLBuilder.script_files.append( posixpath.join('_static', filename)) + def add_stylesheet(self, filename): + from sphinx.builders.html import StandaloneHTMLBuilder + StandaloneHTMLBuilder.css_files.append( + posixpath.join('_static', filename)) + def add_lexer(self, alias, lexer): from sphinx.highlighting import lexers if lexers is None: diff --git a/sphinx/builders/html.py b/sphinx/builders/html.py index 1edfd723..0fc652a0 100644 --- a/sphinx/builders/html.py +++ b/sphinx/builders/html.py @@ -71,6 +71,8 @@ class StandaloneHTMLBuilder(Builder): # This is a class attribute because it is mutated by Sphinx.add_javascript. script_files = ['_static/jquery.js', '_static/doctools.js'] + # Dito for this one. + css_files = [] # cached publisher object for snippets _publisher = None @@ -264,6 +266,7 @@ class StandaloneHTMLBuilder(Builder): show_source = self.config.html_show_sourcelink, file_suffix = self.out_suffix, script_files = self.script_files, + css_files = self.css_files, sphinx_version = __version__, style = stylename, rellinks = rellinks, diff --git a/sphinx/themes/basic/layout.html b/sphinx/themes/basic/layout.html index 5aaaeff2..dfee95ad 100644 --- a/sphinx/themes/basic/layout.html +++ b/sphinx/themes/basic/layout.html @@ -101,6 +101,9 @@ <title>{{ title|striptags }}{{ titlesuffix }}</title> <link rel="stylesheet" href="{{ pathto('_static/' + style, 1) }}" type="text/css" /> <link rel="stylesheet" href="{{ pathto('_static/pygments.css', 1) }}" type="text/css" /> + {%- for cssfile in css_files %} + <link rel="stylesheet" href="{{ pathto('_static/' + cssfile, 1) }}" type="text/css" /> + {%- endfor %} {%- if not embedded %} <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { |
