Permalink
Browse files

Merge pull request #3 from davglass/fixclosing

Added a regex to close on the reset code
  • Loading branch information...
2 parents 77d8637 + 9f816c6 commit d29f2ccf739b61f387619fc810ec43dc57dfd98d @mmalecki committed Jan 9, 2013
Showing with 5 additions and 0 deletions.
  1. +1 −0 lib/ansispan.js
  2. +4 −0 test/ansispan-test.js
View
@@ -25,6 +25,7 @@ var ansispan = function (str) {
str = str.replace(/\033\[3m/g, '<i>').replace(/\033\[23m/g, '</i>');
str = str.replace(/\033\[m/g, '</span>');
+ str = str.replace(/\033\[0m/g, '</span>');
return str.replace(/\033\[39m/g, '</span>');
};
View
@@ -25,6 +25,10 @@ var dataSets = {
input: '\033\[0;32mhello world\033\[39m',
output: '<span style="color: green">hello world</span>'
},
+ 'colors with reset bit': {
+ input: '\033[35mhello world\033[0m',
+ output: '<span style="color: purple">hello world</span>'
+ },
bold: {
input: 'hello world'.bold,
output: '<b>hello world</b>'

0 comments on commit d29f2cc

Please sign in to comment.