summaryrefslogtreecommitdiff
path: root/pygments/formatters/rtf.py
diff options
context:
space:
mode:
authorblackbird <devnull@localhost>2007-05-28 22:07:43 +0200
committerblackbird <devnull@localhost>2007-05-28 22:07:43 +0200
commited703ab6d90aeabef4723953bd7e0b46e17ae7f0 (patch)
tree94071e03ca3d6a23f937c0ecfa086e58313e52f8 /pygments/formatters/rtf.py
parentbf4f667d0fd4859c5569b53d4f898540f85f7457 (diff)
downloadpygments-ed703ab6d90aeabef4723953bd7e0b46e17ae7f0.tar.gz
[svn] fixed rtf formatter
Diffstat (limited to 'pygments/formatters/rtf.py')
-rw-r--r--pygments/formatters/rtf.py19
1 files changed, 9 insertions, 10 deletions
diff --git a/pygments/formatters/rtf.py b/pygments/formatters/rtf.py
index d0a17ac5..d1c7b994 100644
--- a/pygments/formatters/rtf.py
+++ b/pygments/formatters/rtf.py
@@ -94,20 +94,19 @@ class RtfFormatter(Formatter):
offset = 1
for _, style in self.style:
for color in style['color'], style['bgcolor'], style['border']:
- if not color or color in color_mapping:
- continue
- color_mapping[color] = offset
- outfile.write(r'\red%d\green%d\blue%d;' % (
- int(color[0:2], 16),
- int(color[2:4], 16),
- int(color[4:6], 16)
- ))
- offset += 1
+ if color and color not in color_mapping:
+ color_mapping[color] = offset
+ outfile.write(r'\red%d\green%d\blue%d;' % (
+ int(color[0:2], 16),
+ int(color[2:4], 16),
+ int(color[4:6], 16)
+ ))
+ offset += 1
outfile.write(r'}\f0')
# highlight stream
for ttype, value in tokensource:
- while ttype not in self.style and ttype.parent:
+ while self.style.styles_token(ttype) and ttype.parent:
ttype = ttype.parent
style = self.style.style_for_token(ttype)
buf = []