diff options
-rw-r--r-- | TODO | 1 | ||||
-rw-r--r-- | pygments/__init__.py | 6 | ||||
-rw-r--r-- | pygments/cmdline.py | 10 | ||||
-rw-r--r-- | pygments/formatters/html.py | 5 | ||||
-rw-r--r-- | pygments/lexers/agile.py | 2 | ||||
-rw-r--r-- | tests/test_cmdline.py | 1 |
6 files changed, 15 insertions, 10 deletions
@@ -21,6 +21,7 @@ for 0.6 * (Q)BASIC * lisp * python TBs + * IPython sessions * ls -alG * HTML with special formatting? * latex special formatting? diff --git a/pygments/__init__.py b/pygments/__init__.py index ed4b3f55..6b55ce85 100644 --- a/pygments/__init__.py +++ b/pygments/__init__.py @@ -35,12 +35,6 @@ __all__ = ['lex', 'format', 'highlight'] import sys, os from cStringIO import StringIO -from pygments.util import OptionError -from pygments.lexers import LEXERS, get_lexer_by_name, get_lexer_for_filename - -from pygments.formatters import FORMATTERS, get_formatter_by_name, \ - get_formatter_for_filename, TerminalFormatter - def lex(code, lexer): """ diff --git a/pygments/cmdline.py b/pygments/cmdline.py index 57acb8be..844f84d3 100644 --- a/pygments/cmdline.py +++ b/pygments/cmdline.py @@ -8,8 +8,16 @@ :copyright: 2006 by Georg Brandl. :license: BSD, see LICENSE for more details. """ +import sys import getopt +from pygments import __version__, __author__, highlight +from pygments.lexers import LEXERS, get_lexer_by_name, get_lexer_for_filename +from pygments.util import OptionError +from pygments.formatters import FORMATTERS, get_formatter_by_name, \ + get_formatter_for_filename, TerminalFormatter + + def main(args): """ Main command line entry point. @@ -70,7 +78,7 @@ The -V option prints the package version. return 2 # print version - cmdline_main(['', '-V']) + main(['', '-V']) print print "Lexers:" print "~~~~~~~" diff --git a/pygments/formatters/html.py b/pygments/formatters/html.py index 77ee36f1..c9118f7f 100644 --- a/pygments/formatters/html.py +++ b/pygments/formatters/html.py @@ -269,7 +269,7 @@ class HtmlFormatter(Formatter): if self.nowrap: self._format_nowrap(tokensource, outfile) return - + realoutfile = outfile lnos = self.linenos full = self.full @@ -325,7 +325,8 @@ class HtmlFormatter(Formatter): code = ret)) try: cf = open(cssfilename, "w") - cf.write(CSSFILE_TEMPLATE % dict(styledefs=self.get_style_defs('body'))) + cf.write(CSSFILE_TEMPLATE % {'styledefs': + self.get_style_defs('body')}) cf.close() except IOError, err: err.strerror = 'Error writing CSS file: ' + err.strerror diff --git a/pygments/lexers/agile.py b/pygments/lexers/agile.py index 31ad73ef..03e81624 100644 --- a/pygments/lexers/agile.py +++ b/pygments/lexers/agile.py @@ -599,7 +599,7 @@ class PerlLexer(RegexLexer): r'sysseek|system|syswrite|tell|telldir|tie|tied|time|times|tr|' r'truncate|uc|ucfirst|umask|undef|unlink|unpack|unshift|untie|' r'utime|values|vec|wait|waitpid|wantarray|warn|write' - r'|y)\b', Name.Builtin), + r')\b', Name.Builtin), (r'((__(DATA|DIE|WARN)__)|(STD(IN|OUT|ERR)))\b', Name.Builtin.Pseudo), (r'<<([a-zA-Z_][a-zA-Z0-9_]*)\n.*?\n\1\n', String), (r'__END__', Comment.Preproc, 'end-part'), diff --git a/tests/test_cmdline.py b/tests/test_cmdline.py index 3f359cf1..0f8d4b46 100644 --- a/tests/test_cmdline.py +++ b/tests/test_cmdline.py @@ -12,6 +12,7 @@ import sys, os import unittest import StringIO + from pygments import cmdline_main, highlight |