##// END OF EJS Templates
Move strip_ansi function to utils
Thomas Kluyver -
Show More
@@ -14,6 +14,7 b''
14 14
15 15 import re
16 16 from IPython.utils import coloransi
17 from IPython.utils.text import strip_ansi
17 18
18 19 #-----------------------------------------------------------------------------
19 20 # Classes and functions
@@ -26,19 +27,6 b' __all__ = ['
26 27 'ansi2latex'
27 28 ]
28 29
29 def strip_ansi(source):
30 """
31 Remove ansi from text
32
33 Parameters
34 ----------
35 source : str
36 Source to remove the ansi from
37 """
38
39 return re.sub(r'\033\[(\d|;)+?m', '', source)
40
41
42 30 ansi_colormap = {
43 31 '30': 'ansiblack',
44 32 '31': 'ansired',
@@ -27,7 +27,7 b' from IPython.utils.path import compress_user'
27 27 from IPython.utils.py3compat import bytes_to_str
28 28 from IPython.utils.sysinfo import get_sys_info
29 29 from IPython.utils.tempdir import TemporaryDirectory
30 from IPython.nbconvert.filters.ansi import strip_ansi
30 from IPython.utils.text import strip_ansi
31 31
32 32 try:
33 33 # Python >= 3.3
@@ -491,6 +491,17 b' def strip_email_quotes(text):'
491 491 text = '\n'.join([ ln[strip:] for ln in lines])
492 492 return text
493 493
494 def strip_ansi(source):
495 """
496 Remove ansi escape codes from text.
497
498 Parameters
499 ----------
500 source : str
501 Source to remove the ansi from
502 """
503 return re.sub(r'\033\[(\d|;)+?m', '', source)
504
494 505
495 506 class EvalFormatter(Formatter):
496 507 """A String Formatter that allows evaluation of simple expressions.
General Comments 0
You need to be logged in to leave comments. Login now