mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-15 04:00:34 +08:00
Merge pull request #444 from Carreau/strip-ansi
Strip more ANSI escape sequence.
This commit is contained in:
commit
2f0f3987b1
@ -348,7 +348,7 @@ define([
|
||||
|
||||
// Strip all ANSI codes that are not color related. Matches
|
||||
// all ANSI codes that do not end with "m".
|
||||
var ignored_re = /(?=(\033\[[\d;=]*[a-ln-zA-Z]{1}))\1(?!m)/g;
|
||||
var ignored_re = /(?=(\033\[[?\d;=]*[a-ln-zA-Z]{1}))\1(?!m)/g;
|
||||
txt = txt.replace(ignored_re, "");
|
||||
|
||||
// color ansi codes
|
||||
|
@ -1,10 +1,12 @@
|
||||
casper.notebook_test(function () {
|
||||
// Note, \033 is the octal notation of \u001b
|
||||
var input = [
|
||||
"\033[0m[\033[0minfo\033[0m] \033[0mtext\033[0m",
|
||||
"\033[0m[\033[33mwarn\033[0m] \033[0m\tmore text\033[0m",
|
||||
"\033[0m[\033[33mwarn\033[0m] \033[0m https://some/url/to/a/file.ext\033[0m",
|
||||
"\033[0m[\033[31merror\033[0m] \033[0m\033[0m",
|
||||
"\033[0m[\033[31merror\033[0m] \033[0m\teven more text\033[0m",
|
||||
"\u001b[?25hBuilding wheels for collected packages: scipy",
|
||||
"\033[0m[\033[31merror\033[0m] \033[0m\t\tand more more text\033[0m"].join("\n");
|
||||
|
||||
var output = [
|
||||
@ -13,6 +15,7 @@ casper.notebook_test(function () {
|
||||
"[<span class=\"ansiyellow\">warn</span>] https://some/url/to/a/file.ext",
|
||||
"[<span class=\"ansired\">error</span>] ",
|
||||
"[<span class=\"ansired\">error</span>] \teven more text",
|
||||
"Building wheels for collected packages: scipy",
|
||||
"[<span class=\"ansired\">error</span>] \t\tand more more text"].join("\n");
|
||||
|
||||
var result = this.evaluate(function (input) {
|
||||
|
Loading…
Reference in New Issue
Block a user