diff options
author | Matthias Bussonnier <bussonniermatthias@gmail.com> | 2016-02-14 15:17:47 -0800 |
---|---|---|
committer | Matthias Bussonnier <bussonniermatthias@gmail.com> | 2016-02-14 15:17:47 -0800 |
commit | a34c939edf7b8b3f008daa3c1b7e2c94d34db550 (patch) | |
tree | 877beecd4b9ef9f634fd443a654e29471cf90d75 | |
parent | 5cc92cf8771627278cdb7b374ba0a101fad72bd2 (diff) | |
download | pygments-a34c939edf7b8b3f008daa3c1b7e2c94d34db550.tar.gz |
Rename ansilist that now is a set, slipped though PR 531 review
-rw-r--r-- | doc/docs/styles.rst | 2 | ||||
-rw-r--r-- | pygments/formatters/terminal256.py | 8 | ||||
-rw-r--r-- | pygments/style.py | 4 | ||||
-rw-r--r-- | pygments/styles/arduino.py | 2 |
4 files changed, 8 insertions, 8 deletions
diff --git a/doc/docs/styles.rst b/doc/docs/styles.rst index 394c8ed2..1094a270 100644 --- a/doc/docs/styles.rst +++ b/doc/docs/styles.rst @@ -154,7 +154,7 @@ Terminal Styles Custom styles used with the 256-color terminal formatter can also map colors to use the 8 default ANSI colors. To do so, use ``#ansigreen``, ``#ansired`` or -any other colors defined in :attr:`pygments.style.ansilist`. Foreground ANSI +any other colors defined in :attr:`pygments.style.ansicolors`. Foreground ANSI colors will be mapped to the corresponding `escape codes 30 to 37 <https://en.wikipedia.org/wiki/ANSI_escape_code#Colors>`_ thus respecting any custom color mapping and themes provided by many terminal emulators. Light diff --git a/pygments/formatters/terminal256.py b/pygments/formatters/terminal256.py index 03c3a42a..5110bc9e 100644 --- a/pygments/formatters/terminal256.py +++ b/pygments/formatters/terminal256.py @@ -28,7 +28,7 @@ import sys from pygments.formatter import Formatter from pygments.console import codes -from pygments.style import ansilist +from pygments.style import ansicolors __all__ = ['Terminal256Formatter', 'TerminalTrueColorFormatter'] @@ -49,7 +49,7 @@ class EscapeSequence: def color_string(self): attrs = [] if self.fg is not None: - if self.fg in ansilist: + if self.fg in ansicolors: esc = codes[self.fg[5:]] if ';01m' in esc: self.bold = True @@ -58,7 +58,7 @@ class EscapeSequence: else: attrs.extend(("38", "5", "%i" % self.fg)) if self.bg is not None: - if self.bg in ansilist: + if self.bg in ansicolors: esc = codes[self.bg[5:]] # extract fg color code, add 10 for bg. attrs.append(str(int(esc[2:4])+10)) @@ -188,7 +188,7 @@ class Terminal256Formatter(Formatter): def _color_index(self, color): index = self.best_match.get(color, None) - if color in ansilist: + if color in ansicolors: # strip the `#ansi` part and look up code index = color self.best_match[color] = index diff --git a/pygments/style.py b/pygments/style.py index 797a1d34..68ee3a19 100644 --- a/pygments/style.py +++ b/pygments/style.py @@ -33,7 +33,7 @@ _ansimap = { '#ansiturquoise': '00ffff', '#ansiwhite': 'ffffff', } -ansilist = set(_ansimap) +ansicolors = set(_ansimap) class StyleMeta(type): @@ -45,7 +45,7 @@ class StyleMeta(type): obj.styles[token] = '' def colorformat(text): - if text in ansilist: + if text in ansicolors: return text if text[0:1] == '#': col = text[1:] diff --git a/pygments/styles/arduino.py b/pygments/styles/arduino.py index 5b31bb84..1bf2103c 100644 --- a/pygments/styles/arduino.py +++ b/pygments/styles/arduino.py @@ -95,4 +95,4 @@ class ArduinoStyle(Style): Generic.Strong: "", # class: 'gs' Generic.Subheading: "", # class: 'gu' Generic.Traceback: "", # class: 'gt' - }
\ No newline at end of file + } |