diff options
| author | Georg Brandl <georg@python.org> | 2008-11-30 19:58:29 +0100 |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2008-11-30 19:58:29 +0100 |
| commit | 0647cdecb439fa4dfd9bbdf094409e262cf33483 (patch) | |
| tree | 26ed7d538b8b814aeb402bc5cb9767c7b1b6b28c /sphinx | |
| parent | 4b201975a442d45a3ae5118a38c3baa07940f9b3 (diff) | |
| download | sphinx-0647cdecb439fa4dfd9bbdf094409e262cf33483.tar.gz | |
Add Sphinx.add_lexer().
Diffstat (limited to 'sphinx')
| -rw-r--r-- | sphinx/application.py | 6 | ||||
| -rw-r--r-- | sphinx/highlighting.py | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/sphinx/application.py b/sphinx/application.py index 6c644bbe..f7c57592 100644 --- a/sphinx/application.py +++ b/sphinx/application.py @@ -297,6 +297,12 @@ class Sphinx(object): StandaloneHTMLBuilder.script_files.append( posixpath.join('_static', filename)) + def add_lexer(self, alias, lexer): + from sphinx.highlighting import lexers + if lexers is None: + return + lexers[alias] = lexer + class TemplateBridge(object): """ diff --git a/sphinx/highlighting.py b/sphinx/highlighting.py index 3017133a..d85aac23 100644 --- a/sphinx/highlighting.py +++ b/sphinx/highlighting.py @@ -30,6 +30,7 @@ try: from pygments.token import Generic, Comment, Number except ImportError: pygments = None + lexers = None else: class SphinxStyle(Style): """ |
