diff options
author | Georg Brandl <georg@python.org> | 2009-11-08 17:00:56 +0100 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2009-11-08 17:00:56 +0100 |
commit | b0ee52829843b50d40cc4c17290f2670fab6bb2b (patch) | |
tree | f6b3634519d69b17b2734cf46a17de5fa9e9d6f8 /sphinx/highlighting.py | |
parent | adad88b42915215bddbbeff720a536ab53f3373d (diff) | |
download | sphinx-git-b0ee52829843b50d40cc4c17290f2670fab6bb2b.tar.gz |
#265: restore Jython compatibility.
Diffstat (limited to 'sphinx/highlighting.py')
-rw-r--r-- | sphinx/highlighting.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/sphinx/highlighting.py b/sphinx/highlighting.py index 5bd0fe00a..7663279c6 100644 --- a/sphinx/highlighting.py +++ b/sphinx/highlighting.py @@ -12,9 +12,14 @@ import sys import cgi import re -import parser import textwrap +try: + import parser +except ImportError: + # parser is not available on Jython + parser = None + from sphinx.util.texescape import tex_hl_escape_map try: @@ -155,6 +160,9 @@ class PygmentsBridge(object): # just replace all non-ASCII characters. src = src.encode('ascii', 'replace') + if parser is None: + return True + try: parser.suite(src) except parsing_exceptions: |