ansi-to-html
Advanced tools
Comparing version 0.6.12 to 0.6.13
@@ -464,2 +464,5 @@ "use strict"; | ||
}, { | ||
pattern: /^\r\n/, | ||
sub: newline | ||
}, { | ||
pattern: /^\x1b\[((?:\d{1,3};?)+|)m/, | ||
@@ -487,3 +490,10 @@ sub: ansiMess | ||
}, { | ||
pattern: /^([^\x1b\x08\n]+)/, | ||
/** | ||
* extracts real text - not containing: | ||
* - `\x1b' - ESC - escape (Ascii 27) | ||
* - '\x08' - BS - backspace (Ascii 8) | ||
* - `\n` - Newline - linefeed (LF) (ascii 10) | ||
* - `\r` - Windows Carriage Return (CR) | ||
*/ | ||
pattern: /^(([^\x1b\x08\r\n])+)/, | ||
sub: realText | ||
@@ -561,3 +571,3 @@ }]; | ||
* @param {boolean=} options.stream Save style state across invocations of `toHtml()`. | ||
* @param {(string[] | {[code: number]: string})=} options.colors Can override specific colors or the entire ANSI palette. | ||
* @param {(string[] | {[code: number]: string})=} options.colors Can override specific colors or the entire ANSI palette. | ||
*/ | ||
@@ -564,0 +574,0 @@ function Filter(options) { |
{ | ||
"name": "ansi-to-html", | ||
"version": "0.6.12", | ||
"version": "0.6.13", | ||
"description": "Convert ansi escaped text streams to html.", | ||
@@ -11,4 +11,6 @@ "main": "lib/ansi_to_html.js", | ||
"build": "babel src --out-dir lib", | ||
"build:watch": "babel src --out-dir lib --watch", | ||
"lint": "eslint src test", | ||
"test": "mocha --reporter tap" | ||
"test": "mocha --reporter tap", | ||
"test:watch": "mocha --reporter tap --watch ./test ./" | ||
}, | ||
@@ -68,2 +70,6 @@ "repository": { | ||
"url": "https://github.com/hasparus" | ||
}, | ||
{ | ||
"name": "Lior Chervinsky", | ||
"url": "https://github.com/lior-chervinsky" | ||
} | ||
@@ -70,0 +76,0 @@ ], |
@@ -72,3 +72,3 @@ ## Ansi to Html | ||
```javascript | ||
```json5 | ||
{ | ||
@@ -92,3 +92,3 @@ fg: '#FFF', | ||
Lint | ||
#### Lint | ||
@@ -99,3 +99,3 @@ ```bash | ||
Build | ||
#### Build | ||
@@ -106,6 +106,21 @@ ```bash | ||
Test | ||
- Builds the `/src` files by running `babel`. | ||
- Saves the built files in `/lib` output directory. | ||
- Recommended to run `babel` in Watch mode - will re-build the project each time the files are changed. | ||
```bash | ||
npm run build:watch | ||
``` | ||
#### Test | ||
```bash | ||
npm test | ||
``` | ||
- Note: Runs the tests against the built files (in the `/lib` directory). | ||
- You also run the tests in watch mode (will rerun tests when files are changed). | ||
- Recommended to run the build in watch mode as well to re-build the project before the tests are run. | ||
```bash | ||
npm run test:watch | ||
``` | ||
@@ -30,3 +30,3 @@ const {expect} = require('chai'); | ||
it('returns plain text when given plain text', function (done) { | ||
it('returns plain text when given plain text with linefeed', function (done) { | ||
const text = 'test\ntest\n'; | ||
@@ -38,2 +38,9 @@ const result = 'test\ntest\n'; | ||
it('returns plain text when given plain text with CR & LF', function (done) { | ||
const text = 'testCRLF\r\ntest'; | ||
const result = 'testCRLF\r\ntest'; | ||
return test(text, result, done); | ||
}); | ||
it('renders foreground colors', function (done) { | ||
@@ -323,2 +330,9 @@ const text = 'colors: \x1b[30mblack\x1b[37mwhite'; | ||
it('renders windows styled line breaks (CR+LF)', function (done) { | ||
const text = 'testCRLF\r\ntestLF'; | ||
const result = 'testCRLF<br/>testLF'; | ||
return test(text, result, done, {newline: true}); | ||
}); | ||
it('renders multiple line breaks', function (done) { | ||
@@ -325,0 +339,0 @@ const text = 'test\n\ntest\n'; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
39637
944
123