summaryrefslogtreecommitdiff
path: root/pygments/formatters/other.py
diff options
context:
space:
mode:
authorTim Hatch <tim@timhatch.com>2014-04-14 15:24:11 -0400
committerTim Hatch <tim@timhatch.com>2014-04-14 15:24:11 -0400
commit775708f0cd0fc79c120efff55becfc9c0d52aab3 (patch)
treea3b2610df30e95695abfb4ef8d5728861dbe90c3 /pygments/formatters/other.py
parent4ea98ad140a53922d83be5c1ab298e4ca2e980cc (diff)
parentdd4dc914d46c58843c5144aaad6f85bc78ed1973 (diff)
downloadpygments-775708f0cd0fc79c120efff55becfc9c0d52aab3.tar.gz
Merged in alexsdutton/pygments-main (pull request #78)
Conflicts: AUTHORS pygments/lexers/_mapping.py
Diffstat (limited to 'pygments/formatters/other.py')
-rw-r--r--pygments/formatters/other.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/pygments/formatters/other.py b/pygments/formatters/other.py
index a19e4ce0..7368a642 100644
--- a/pygments/formatters/other.py
+++ b/pygments/formatters/other.py
@@ -5,12 +5,12 @@
Other formatters: NullFormatter, RawTokenFormatter.
- :copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
+ :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.formatter import Formatter
-from pygments.util import OptionError, get_choice_opt, b
+from pygments.util import OptionError, get_choice_opt
from pygments.token import Token
from pygments.console import colorize
@@ -40,7 +40,7 @@ class RawTokenFormatter(Formatter):
The format is ``tokentype<TAB>repr(tokenstring)\n``. The output can later
be converted to a token stream with the `RawTokenLexer`, described in the
- `lexer list <lexers.txt>`_.
+ :doc:`lexer list <lexers>`.
Only two options are accepted:
@@ -50,7 +50,8 @@ class RawTokenFormatter(Formatter):
`error_color`
If set to a color name, highlight error tokens using that color. If
set but with no value, defaults to ``'red'``.
- *New in Pygments 0.11.*
+
+ .. versionadded:: 0.11
"""
name = 'Raw tokens'
@@ -79,7 +80,7 @@ class RawTokenFormatter(Formatter):
def format(self, tokensource, outfile):
try:
- outfile.write(b(''))
+ outfile.write(b'')
except TypeError:
raise TypeError('The raw tokens formatter needs a binary '
'output file')
@@ -102,8 +103,6 @@ class RawTokenFormatter(Formatter):
outfile.write(text.encode())
flush = outfile.flush
- lasttype = None
- lastval = u''
if self.error_color:
for ttype, value in tokensource:
line = "%s\t%r\n" % (ttype, value)