diff options
author | gbrandl <devnull@localhost> | 2007-08-15 09:23:51 +0200 |
---|---|---|
committer | gbrandl <devnull@localhost> | 2007-08-15 09:23:51 +0200 |
commit | 39524fd1a9125958e072590acdc7b955bf2e174a (patch) | |
tree | 938b2772408b2cb109c085080c77e45f81053e45 /pygments/formatters/terminal256.py | |
parent | 77b8d3b7233ffb937451a19ca2ef78f0072426d0 (diff) | |
download | pygments-39524fd1a9125958e072590acdc7b955bf2e174a.tar.gz |
[svn] Apply a bunch of Tim Hatch's changes.
Diffstat (limited to 'pygments/formatters/terminal256.py')
-rw-r--r-- | pygments/formatters/terminal256.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/pygments/formatters/terminal256.py b/pygments/formatters/terminal256.py index 0d4a6f65..0516aa4e 100644 --- a/pygments/formatters/terminal256.py +++ b/pygments/formatters/terminal256.py @@ -16,8 +16,6 @@ """ # TODO: -# - 'nobold', 'nounderline' options to suppress bold and underline -# attributes respectively. # - Options to map style's bold/underline/italic/border attributes # to some ANSI attrbutes (something like 'italic=underline') # - An option to output "style RGB to xterm RGB/index" conversion table @@ -95,6 +93,9 @@ class Terminal256Formatter(Formatter): self.best_match = {} self.style_string = {} + self.usebold = 'nobold' not in options + self.useunderline = 'nounderline' not in options + self._build_color_table() # build an RGB-to-256 color conversion table self._setup_styles() # convert selected style's colors to term. colors @@ -173,9 +174,9 @@ class Terminal256Formatter(Formatter): escape.fg = self._color_index(ndef['color']) if ndef['bgcolor']: escape.bg = self._color_index(ndef['bgcolor']) - if ndef['bold']: + if self.usebold and ndef['bold']: escape.bold = True - if ndef['underline']: + if self.useunderline and ndef['underline']: escape.underline = True self.style_string[str(ttype)] = (escape.color_string(), escape.reset_string()) |