0
@@ -14,8 +14,6 @@ from const import *
0
from cStringIO import StringIO
0
from optparse import OptionParser
0
from pygments import highlight
0
-from pygments.lexers import JavascriptLexer
0
-from pygments.lexers import PhpLexer
0
from pygments.formatters import HtmlFormatter
0
@@ -43,8 +41,19 @@ class DocHighlighter(object):
0
def highlightString(src):
0
if self.currentExt == 'php':
0
+ from pygments.lexers import PhpLexer
0
return highlight(src, PhpLexer(), HtmlFormatter())
0
+ elif self.currentExt == 'py':
0
+ from pygments.lexers import PythonLexer
0
+ return highlight(src, PythonLexer(), HtmlFormatter())
0
+ elif self.currentExt == 'rb':
0
+ from pygments.lexers import RubyLexer
0
+ return highlight(src, RubyLexer(), HtmlFormatter())
0
+ elif self.currentExt == 'pl':
0
+ from pygments.lexers import PerlLexer
0
+ return highlight(src, PerlLexer(), HtmlFormatter())
0
+ from pygments.lexers import JavascriptLexer
0
return highlight(src, JavascriptLexer(), HtmlFormatter())
0
return "File could not be highlighted"