ansi-to-html
Advanced tools
Comparing version 0.3.0 to 0.4.0
@@ -19,2 +19,6 @@ /*global module:false*/ | ||
}, | ||
cli: { | ||
src: 'src/cli.coffee', | ||
dest: 'lib/cli.js' | ||
}, | ||
test: { | ||
@@ -21,0 +25,0 @@ src: 'test/ansi_to_html.coffee', |
(function() { | ||
var Filter, STYLES, defaults, entities, extend, toHexString, _i, _results, | ||
__slice = [].slice; | ||
var Filter, STYLES, defaults, entities, extend, j, results, toHexString, | ||
slice = [].slice; | ||
@@ -59,10 +59,10 @@ entities = require("entities"); | ||
rgb = ((function() { | ||
var _i, _len, _ref, _results; | ||
_ref = [r, g, b]; | ||
_results = []; | ||
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | ||
n = _ref[_i]; | ||
_results.push(toHexString(n)); | ||
var j, len, ref, results; | ||
ref = [r, g, b]; | ||
results = []; | ||
for (j = 0, len = ref.length; j < len; j++) { | ||
n = ref[j]; | ||
results.push(toHexString(n)); | ||
} | ||
return _results; | ||
return results; | ||
})()).join(''); | ||
@@ -76,5 +76,5 @@ STYLES["ef" + c] = "color:#" + rgb; | ||
(function() { | ||
_results = []; | ||
for (_i = 0; _i <= 23; _i++){ _results.push(_i); } | ||
return _results; | ||
results = []; | ||
for (j = 0; j <= 23; j++){ results.push(j); } | ||
return results; | ||
}).apply(this).forEach(function(gray) { | ||
@@ -89,6 +89,6 @@ var c, l; | ||
extend = function() { | ||
var dest, k, obj, objs, v, _j, _len; | ||
dest = arguments[0], objs = 2 <= arguments.length ? __slice.call(arguments, 1) : []; | ||
for (_j = 0, _len = objs.length; _j < _len; _j++) { | ||
obj = objs[_j]; | ||
var dest, k, len, o, obj, objs, v; | ||
dest = arguments[0], objs = 2 <= arguments.length ? slice.call(arguments, 1) : []; | ||
for (o = 0, len = objs.length; o < len; o++) { | ||
obj = objs[o]; | ||
for (k in obj) { | ||
@@ -105,2 +105,3 @@ v = obj[k]; | ||
bg: '#000', | ||
newline: false, | ||
escapeXML: false, | ||
@@ -297,4 +298,4 @@ stream: false | ||
Filter.prototype.resetStyles = function() { | ||
var stack, _ref; | ||
_ref = [this.stack, []], stack = _ref[0], this.stack = _ref[1]; | ||
var ref, stack; | ||
ref = [this.stack, []], stack = ref[0], this.stack = ref[1]; | ||
return stack.reverse().map(function(tag) { | ||
@@ -306,3 +307,3 @@ return "</" + tag + ">"; | ||
Filter.prototype.tokenize = function(text, callback) { | ||
var ansiHandler, ansiMatch, ansiMess, handler, i, length, newline, process, realText, remove, removeXterm256, tokens, _j, _len, _results1; | ||
var ansiHandler, ansiMatch, ansiMess, handler, i, len, length, newline, o, process, realText, remove, removeXterm256, results1, tokens; | ||
ansiMatch = false; | ||
@@ -328,3 +329,3 @@ ansiHandler = 3; | ||
ansiMess = function(m, g1) { | ||
var code, _j, _len; | ||
var code, len, o; | ||
ansiMatch = true; | ||
@@ -335,4 +336,4 @@ if (g1.trim().length === 0) { | ||
g1 = g1.trimRight(';').split(';'); | ||
for (_j = 0, _len = g1.length; _j < _len; _j++) { | ||
code = g1[_j]; | ||
for (o = 0, len = g1.length; o < len; o++) { | ||
code = g1[o]; | ||
callback('display', code); | ||
@@ -383,5 +384,5 @@ } | ||
}; | ||
_results1 = []; | ||
results1 = []; | ||
while ((length = text.length) > 0) { | ||
for (i = _j = 0, _len = tokens.length; _j < _len; i = ++_j) { | ||
for (i = o = 0, len = tokens.length; o < len; i = ++o) { | ||
handler = tokens[i]; | ||
@@ -393,6 +394,6 @@ process(handler, i); | ||
} else { | ||
_results1.push(void 0); | ||
results1.push(void 0); | ||
} | ||
} | ||
return _results1; | ||
return results1; | ||
}; | ||
@@ -399,0 +400,0 @@ |
{ | ||
"name": "ansi-to-html", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "Convert ansi escaped text streams to html.", | ||
@@ -29,19 +29,23 @@ "main": "lib/ansi_to_html.js", | ||
}, { | ||
"name": "Yoram Grahame", | ||
"email": "yoz@yoz.com" | ||
"name": "Thorsten Kohnhorst", | ||
"email": "monsterkodi@gmx.net" | ||
}, { | ||
"name": "Yoram Grahame", | ||
"email": "yoz@yoz.com" | ||
}], | ||
"license": { | ||
"type": "MIT", | ||
"url": "http://github.com/rburns/ansi-to-html/blob/master/LICENSE" | ||
}, | ||
"license": "MIT", | ||
"devDependencies": { | ||
"chai": "~1.2.0", | ||
"grunt": "~0.4.1", | ||
"grunt-contrib-coffee": "^0.10.1", | ||
"grunt-contrib-watch": "~0.3.1", | ||
"grunt-simple-mocha": "~0.4.0" | ||
"chai": "~3.5.0", | ||
"grunt": "~0.4.5", | ||
"grunt-contrib-coffee": "^0.13.0", | ||
"grunt-contrib-watch": "~0.6.1", | ||
"grunt-simple-mocha": "~0.4.1" | ||
}, | ||
"dependencies": { | ||
"entities": "^1.1.1" | ||
"entities": "^1.1.1", | ||
"karg": "^0.2.1" | ||
}, | ||
"bin": { | ||
"ansi-to-html": "./bin/ansi-to-html" | ||
} | ||
} |
## Ansi to Html | ||
![](https://img.shields.io/npm/v/ansi-to-html.svg) ![](https://img.shields.io/npm/dm/ansi-to-html.svg) ![](https://img.shields.io/travis/rburns/ansi-to-html.svg) | ||
This is a port of the ansi to html converter from [bcat](https://github.com/rtomayko/bcat/blob/master/lib/bcat/ansi.rb) to Javascript. | ||
@@ -27,2 +29,19 @@ | ||
## Command line usage | ||
Process a file: | ||
```bash | ||
ansi-to-html the_filename | ||
``` | ||
From STDIN: | ||
```bash | ||
git log | ansi-to-html | ||
``` | ||
When using ansi-to-html from the command line the stream option is set to `true`. Other options can | ||
be provided. See `ansi-to-html -h` for more detail. | ||
## Options | ||
@@ -36,3 +55,3 @@ | ||
**newLine** <code>true or false</code> Convert newline characters to <code><br/></code>. | ||
**newline** <code>true or false</code> Convert newline characters to <code><br/></code>. | ||
@@ -43,4 +62,17 @@ **escapeXML** <code>true or false</code> Generate HTML/XML entities. | ||
### Default options | ||
```coffee | ||
fg: '#FFF' | ||
bg: '#000' | ||
newline: false | ||
escapeXML: false | ||
stream: false | ||
``` | ||
## Development | ||
[![](http://issuestats.com/github/rburns/ansi-to-html/badge/issue?style=flat)](http://issuestats.com/github/rburns/ansi-to-html) | ||
[![](http://issuestats.com/github/rburns/ansi-to-html/badge/pr?style=flat)](http://issuestats.com/github/rburns/ansi-to-html) | ||
Once you have the git repository cloned, install the dependencies: | ||
@@ -47,0 +79,0 @@ |
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
26605
10
651
96
2
2
+ Addedkarg@^0.2.1
+ Addedcolors@1.4.0(transitive)
+ Addedkarg@0.2.11.26.0(transitive)
+ Addedklor@2.17.0(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addednoon@3.5.0(transitive)