diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | pygments/cmdline.py | 10 | ||||
-rw-r--r-- | pygments/formatters/__init__.py | 2 | ||||
-rw-r--r-- | pygments/formatters/html.py | 8 | ||||
-rw-r--r-- | pygments/formatters/other.py | 2 | ||||
-rw-r--r-- | pygments/lexers/compiled.py | 8 | ||||
-rw-r--r-- | tests/test_basic_api.py | 2 | ||||
-rw-r--r-- | tests/test_cmdline.py | 4 | ||||
-rw-r--r-- | tests/test_html_formatter.py | 5 | ||||
-rw-r--r-- | tests/test_latex_formatter.py | 3 |
10 files changed, 24 insertions, 22 deletions
@@ -21,7 +21,7 @@ apidocs: epydoc check: @$(PYTHON) scripts/check_sources.py -i apidocs -i pygments/lexers/_mapping.py \ - -i docs/build + -i docs/build -i pygments/formatters/_mapping.py clean: clean-pyc rm -f codetags.html diff --git a/pygments/cmdline.py b/pygments/cmdline.py index 3e98af39..84c09b88 100644 --- a/pygments/cmdline.py +++ b/pygments/cmdline.py @@ -144,8 +144,8 @@ def _print_list(what): info = [] for cls in get_all_formatters(): doc = docstring_headline(cls) - tup = (', '.join(cls.aliases) + ':', doc, - cls.filenames and '(filenames ' + ', '.join(cls.filenames) + ')' or '') + tup = (', '.join(cls.aliases) + ':', doc, cls.filenames and + '(filenames ' + ', '.join(cls.filenames) + ')' or '') info.append(tup) info.sort() for i in info: @@ -165,11 +165,11 @@ def _print_list(what): print print "Styles:" print "~~~~~~~" - + for name in get_all_styles(): cls = get_style_by_name(name) print "* " + name + ':' - print " %s" % docstring_headline(cls) + print " %s" % docstring_headline(cls) def main(args): @@ -177,7 +177,7 @@ def main(args): Main command line entry point. """ # pylint: disable-msg=R0911,R0912,R0915 - + usage = USAGE % ((args[0],) * 5) try: diff --git a/pygments/formatters/__init__.py b/pygments/formatters/__init__.py index 8d0feaaa..fb200e10 100644 --- a/pygments/formatters/__init__.py +++ b/pygments/formatters/__init__.py @@ -22,7 +22,7 @@ del fcls __all__ = ['get_formatter_by_name', 'get_formatter_for_filename', 'get_all_formatters'] + [cls.__name__ for cls in FORMATTERS] - + _formatter_alias_cache = {} _formatter_filename_cache = [] diff --git a/pygments/formatters/html.py b/pygments/formatters/html.py index f3257f03..528c981b 100644 --- a/pygments/formatters/html.py +++ b/pygments/formatters/html.py @@ -212,7 +212,7 @@ class HtmlFormatter(Formatter): **Subclassing the HTML formatter** - *New in Pygments 0.7.* + *New in Pygments 0.7.* The HTML formatter is now built in a way that allows easy subclassing, thus customizing the output HTML code. The `format()` method calls @@ -361,7 +361,7 @@ class HtmlFormatter(Formatter): print >>sys.stderr, 'Note: Cannot determine output file name, ' \ 'using current directory as base for the CSS file name' cssfilename = self.cssfile - # write CSS file + # write CSS file try: cf = open(cssfilename, "w") cf.write(CSSFILE_TEMPLATE % @@ -392,7 +392,7 @@ class HtmlFormatter(Formatter): if t: lncount += 1 dummyoutfile.write(line) - + fl = self.linenostart mw = len(str(lncount + fl - 1)) sp = self.linenospecial @@ -480,7 +480,7 @@ class HtmlFormatter(Formatter): line = cspan + parts[-1] lspan = cspan # else we neither have to open a new span nor set lspan - + if line: yield 1, line + (lspan and '</span>') + lsep diff --git a/pygments/formatters/other.py b/pygments/formatters/other.py index d83c77ea..4353c2b2 100644 --- a/pygments/formatters/other.py +++ b/pygments/formatters/other.py @@ -22,7 +22,7 @@ class NullFormatter(Formatter): name = 'Text only' aliases = ['text', 'null'] filenames = ['*.txt'] - + def format(self, tokensource, outfile): enc = self.encoding for ttype, value in tokensource: diff --git a/pygments/lexers/compiled.py b/pygments/lexers/compiled.py index e986fe89..24a3e68b 100644 --- a/pygments/lexers/compiled.py +++ b/pygments/lexers/compiled.py @@ -793,7 +793,7 @@ class OcamlLexer(RegexLexer): *New in Pygments 0.7.* """ - + name = 'OCaml' aliases = ['ocaml'] filenames = ['*.ml', '*.mli'] @@ -836,18 +836,18 @@ class OcamlLexer(RegexLexer): (r'(%s|%s)?%s' % (infix_syms, prefix_syms, operators), Operator), (r"[^\W\d][\w']*", Name), - + (r'\d[\d_]*', Number.Integer), (r'0[xX][\da-fA-F][\da-fA-F_]*', Number.Hex), (r'0[oO][0-7][0-7_]*', Number.Oct), (r'0[bB][01][01_]*', Number), (r'-?\d[\d_]*(.[\d_]*)?([eE][+\-]?\d[\d_]*)', Number.Float), - + (r"'(?:(\\[\\\"'ntbr ])|(\\[0-9]{3})|(\\x[0-9a-fA-F]{2}))'", String.Char), (r"'.'", String.Char), (r"'", Keyword), # a stray quote is another syntax element - + (r'"', String.Double, 'string'), (r'[~?][a-z][\w\']*:', Name.Variable), diff --git a/tests/test_basic_api.py b/tests/test_basic_api.py index f07c00e7..d05a29c5 100644 --- a/tests/test_basic_api.py +++ b/tests/test_basic_api.py @@ -79,7 +79,7 @@ class LexersTest(unittest.TestCase): tokens = list(lx.get_tokens(text)) roundtext = ''.join([t[1] for t in tokens]) self.assertEquals(roundtext, text, - "lexer roundtrip with %s filter failed" % x) + "lexer roundtrip with %s filter failed" % x) class FormattersTest(unittest.TestCase): diff --git a/tests/test_cmdline.py b/tests/test_cmdline.py index e82eb247..89048db9 100644 --- a/tests/test_cmdline.py +++ b/tests/test_cmdline.py @@ -35,10 +35,10 @@ class CmdLineTest(unittest.TestCase): c, o, e = run_cmdline("-L") self.assertEquals(c, 0) self.assert_("Lexers" in o and "Formatters" in o and - "Filters" in o and "Styles" in o) + "Filters" in o and "Styles" in o) c, o, e = run_cmdline("-L", "lexer") self.assertEquals(c, 0) - self.assert_("Lexers" in o and not "Formatters" in o) + self.assert_("Lexers" in o and "Formatters" not in o) c, o, e = run_cmdline("-L", "lexers") self.assertEquals(c, 0) diff --git a/tests/test_html_formatter.py b/tests/test_html_formatter.py index b3b133e9..1206f782 100644 --- a/tests/test_html_formatter.py +++ b/tests/test_html_formatter.py @@ -18,7 +18,8 @@ from pygments.lexers import PythonLexer from pygments.formatters import HtmlFormatter, NullFormatter from pygments.formatters.html import escape_html -tokensource = list(PythonLexer().get_tokens(file(os.path.join(testdir, testfile)).read())) +tokensource = list(PythonLexer().get_tokens(file( + os.path.join(testdir, testfile)).read())) class HtmlFormatterTest(unittest.TestCase): def test_correct_output(self): @@ -62,7 +63,7 @@ class HtmlFormatterTest(unittest.TestCase): dict(linenos=True), dict(linenos=True, full=True), dict(linenos=True, full=True, noclasses=True)]: - + outfile = StringIO.StringIO() fmt = HtmlFormatter(**optdict) fmt.format(tokensource, outfile) diff --git a/tests/test_latex_formatter.py b/tests/test_latex_formatter.py index ae543265..45f48638 100644 --- a/tests/test_latex_formatter.py +++ b/tests/test_latex_formatter.py @@ -18,7 +18,8 @@ from pygments.lexers import PythonLexer class LatexFormatterTest(unittest.TestCase): def test_valid_output(self): - tokensource = list(PythonLexer().get_tokens(file(os.path.join(testdir, testfile)).read())) + tokensource = list(PythonLexer().get_tokens(file( + os.path.join(testdir, testfile)).read())) fmt = LatexFormatter(full=True) handle, pathname = tempfile.mkstemp('.tex') |