Permalink
Browse files

Rename all the other instances of the old names

  • Loading branch information...
1 parent 4bcede7 commit 9875df480ee305e8be96c665a049d03c1878999e Dru Nelson committed Oct 10, 2012
Showing with 55 additions and 46 deletions.
  1. +10 −1 Readme.md
  2. +17 −17 ansi_up.js
  3. +0 −1 examples/ansi2html.js
  4. +1 −0 examples/ansi_up.js
  5. +2 −2 examples/browser.html
  6. +1 −1 examples/main.js
  7. +5 −5 package.json
  8. +19 −19 test/ansi_up-test.js
View
@@ -28,7 +28,16 @@ Into this:
</script>
-There are examples in the repo that demonstrate this as well as a require.js and jQuery example.
+## Node Example
+
+ var ansi_up = require('ansi_up');
+
+ var txt = "\n\n\033[1;33;40m 33;40 \033[1;33;41m 33;41 \033[1;33;42m 33;42 \033[1;33;43m 33;43 \033[1;33;44m 33;44 \033[1;33;45m 33;45 \033[1;33;46m 33;46 \033[1m\033[0\n\n\033[1;33;42m >> Tests OK\n\n"
+
+ var html = ansi_up.ansi_to_html(txt);
+
+
+There are examples in the repo that demonstrate an AMD/require.js/ jQuery example as well as a simple browser example.
## Installation
View
@@ -1,12 +1,12 @@
-// ansi2html.js
+// ansi_up.js
// version : 1.0.0
// author : Dru Nelson
// license : MIT
-// http://github.com/drudru/ansi2html
+// http://github.com/drudru/ansi_up
(function (Date, undefined) {
- var ansi2html,
+ var ansi_up,
VERSION = "1.0.0",
// check for nodeJS
@@ -18,26 +18,26 @@
["85,85,85", "255, 85, 85", "0, 255, 0", "255, 255, 85", "85, 85, 255", "255, 85, 255", "85, 255, 255", "255,255,255" ]
];
- function Ansi2HTML() {
+ function Ansi_Up() {
this.fg = this.bg = null;
this.bright = 0;
}
- Ansi2HTML.prototype.escape_for_html = function (txt) {
+ Ansi_Up.prototype.escape_for_html = function (txt) {
return txt.replace(/[&<>]/gm, function(str) {
if (str == "&") return "&amp;";
if (str == "<") return "&lt;";
if (str == ">") return "&gt;";
});
};
- Ansi2HTML.prototype.linkify = function (txt) {
+ Ansi_Up.prototype.linkify = function (txt) {
return txt.replace(/(https?:\/\/[^\s]+)/gm, function(str) {
return "<a href=\"" + str + "\">" + str + "</a>";
});
};
- Ansi2HTML.prototype.ansi_to_html = function (txt) {
+ Ansi_Up.prototype.ansi_to_html = function (txt) {
var data4 = txt.split(/\033\[/);
@@ -63,7 +63,7 @@
return escaped_data;
};
- Ansi2HTML.prototype.process_chunk = function (text) {
+ Ansi_Up.prototype.process_chunk = function (text) {
// Do proper handling of sequences (aka - injest vi split(';') into state machine
//match,codes,txt = text.match(/([\d;]+)m(.*)/m);
@@ -104,40 +104,40 @@
};
// Module exports
- ansi2html = {
+ ansi_up = {
escape_for_html: function (txt) {
- var a2h = new Ansi2HTML();
+ var a2h = new Ansi_Up();
return a2h.escape_for_html(txt);
},
linkify: function (txt) {
- var a2h = new Ansi2HTML();
+ var a2h = new Ansi_Up();
return a2h.linkify(txt);
},
ansi_to_html: function (txt) {
- var a2h = new Ansi2HTML();
+ var a2h = new Ansi_Up();
return a2h.ansi_to_html(txt);
},
ansi_to_html_obj: function () {
- return new Ansi2HTML();
+ return new Ansi_Up();
}
};
// CommonJS module is defined
if (hasModule) {
- module.exports = ansi2html;
+ module.exports = ansi_up;
}
/*global ender:false */
if (typeof window !== 'undefined' && typeof ender === 'undefined') {
- window.ansi2html = ansi2html;
+ window.ansi_up = ansi_up;
}
/*global define:false */
if (typeof define === "function" && define.amd) {
- define("ansi2html", [], function () {
- return ansi2html;
+ define("ansi_up", [], function () {
+ return ansi_up;
});
}
})(Date);
View
@@ -12,12 +12,12 @@
<body>
<pre id="console"></pre>
</body>
-<script src="../ansi2html.js" type="text/javascript"></script>
+<script src="../ansi_up.js" type="text/javascript"></script>
<script type="text/javascript">
var txt = "\n\n\033[1;33;40m 33;40 \033[1;33;41m 33;41 \033[1;33;42m 33;42 \033[1;33;43m 33;43 \033[1;33;44m 33;44 \033[1;33;45m 33;45 \033[1;33;46m 33;46 \033[1m\033[0\n\n\033[1;33;42m >> Tests OK\n\n"
- var html = ansi2html.ansi_to_html(txt);
+ var html = ansi_up.ansi_to_html(txt);
var cdiv = document.getElementById("console");
View
@@ -1,4 +1,4 @@
-require(['ansi2html',"/examples/jquery-1.7.2.min.js"], function(a2h) {
+require(['ansi_up',"/examples/jquery-1.7.2.min.js"], function(a2h) {
var txt = "\n\n\033[1;33;40m 33;40 \033[1;33;41m 33;41 \033[1;33;42m 33;42 \033[1;33;43m 33;43 \033[1;33;44m 33;44 \033[1;33;45m 33;45 \033[1;33;46m 33;46 \033[1m\033[0\n\n\033[1;33;42m >> Tests OK\n\n"
View
@@ -1,18 +1,18 @@
{
- "name": "ansi2html",
+ "name": "ansi_up",
"version": "1.0.0",
- "description": "Convert ansi sequences in strings to HTML spans",
+ "description": "Convert ansi sequences in strings to colorful HTML",
"keywords": ["ansi", "html"],
"author": "drudru <drudru@gmail.com>",
- "main": "./ansi2html.js",
+ "main": "./ansi_up.js",
"repository" :
{
"type" : "git",
- "url" : "git://github.com/drudru/ansi2html.git"
+ "url" : "git://github.com/drudru/ansi_up.git"
},
"bugs" :
{
- "url" : "http://github.com/drudru/ansi2html/issues"
+ "url" : "http://github.com/drudru/ansi_up/issues"
},
"engines":
{
View
@@ -1,8 +1,8 @@
-var ansi2html = require('../ansi2html');
+var ansi_up = require('../ansi_up');
var should = require('should');
-describe('ansi2html', function() {
+describe('ansi_up', function() {
describe('escape_for_html', function() {
@@ -13,7 +13,7 @@ describe('ansi2html', function() {
var start = "&";
var expected = "&amp;";
- var l = ansi2html.escape_for_html(start);
+ var l = ansi_up.escape_for_html(start);
l.should.eql(expected);
});
@@ -22,7 +22,7 @@ describe('ansi2html', function() {
var start = "abcd&efgh";
var expected = "abcd&amp;efgh";
- var l = ansi2html.escape_for_html(start);
+ var l = ansi_up.escape_for_html(start);
l.should.eql(expected);
});
@@ -31,7 +31,7 @@ describe('ansi2html', function() {
var start = " & & ";
var expected = " &amp; &amp; ";
- var l = ansi2html.escape_for_html(start);
+ var l = ansi_up.escape_for_html(start);
l.should.eql(expected);
});
@@ -40,7 +40,7 @@ describe('ansi2html', function() {
var start = " &amp; ";
var expected = " &amp;amp; ";
- var l = ansi2html.escape_for_html(start);
+ var l = ansi_up.escape_for_html(start);
l.should.eql(expected);
});
@@ -53,7 +53,7 @@ describe('ansi2html', function() {
var start = "<";
var expected = "&lt;";
- var l = ansi2html.escape_for_html(start);
+ var l = ansi_up.escape_for_html(start);
l.should.eql(expected);
});
@@ -62,7 +62,7 @@ describe('ansi2html', function() {
var start = "abcd<efgh";
var expected = "abcd&lt;efgh";
- var l = ansi2html.escape_for_html(start);
+ var l = ansi_up.escape_for_html(start);
l.should.eql(expected);
});
@@ -71,7 +71,7 @@ describe('ansi2html', function() {
var start = " < < ";
var expected = " &lt; &lt; ";
- var l = ansi2html.escape_for_html(start);
+ var l = ansi_up.escape_for_html(start);
l.should.eql(expected);
});
@@ -84,7 +84,7 @@ describe('ansi2html', function() {
var start = ">";
var expected = "&gt;";
- var l = ansi2html.escape_for_html(start);
+ var l = ansi_up.escape_for_html(start);
l.should.eql(expected);
});
@@ -93,7 +93,7 @@ describe('ansi2html', function() {
var start = "abcd>efgh";
var expected = "abcd&gt;efgh";
- var l = ansi2html.escape_for_html(start);
+ var l = ansi_up.escape_for_html(start);
l.should.eql(expected);
});
@@ -102,7 +102,7 @@ describe('ansi2html', function() {
var start = " > > ";
var expected = " &gt; &gt; ";
- var l = ansi2html.escape_for_html(start);
+ var l = ansi_up.escape_for_html(start);
l.should.eql(expected);
});
@@ -115,7 +115,7 @@ describe('ansi2html', function() {
var start = "<&>/\\'\"";
var expected = "&lt;&amp;&gt;/\\'\"";
- var l = ansi2html.escape_for_html(start);
+ var l = ansi_up.escape_for_html(start);
l.should.eql(expected);
});
@@ -130,7 +130,7 @@ describe('ansi2html', function() {
var start = "http://link.to/me";
var expected = "<a href=\"http://link.to/me\">http://link.to/me</a>";
- var l = ansi2html.linkify(start);
+ var l = ansi_up.linkify(start);
l.should.eql(expected);
});
@@ -146,7 +146,7 @@ describe('ansi2html', function() {
var expected = "<span style=\"color:rgb(0, 187, 0)\"> " + fg + " </span>";
- var l = ansi2html.ansi_to_html(start);
+ var l = ansi_up.ansi_to_html(start);
l.should.eql(expected);
});
@@ -159,7 +159,7 @@ describe('ansi2html', function() {
var expected = "<span style=\"color:rgb(0, 187, 0)\"> " + fg + " </span>";
- var l = ansi2html.ansi_to_html(start);
+ var l = ansi_up.ansi_to_html(start);
l.should.eql(expected);
});
@@ -171,7 +171,7 @@ describe('ansi2html', function() {
var expected = "<span style=\"color:rgb(0, 255, 0)\"> " + attr + ";" + fg + " </span>";
- var l = ansi2html.ansi_to_html(start);
+ var l = ansi_up.ansi_to_html(start);
l.should.eql(expected);
});
@@ -184,7 +184,7 @@ describe('ansi2html', function() {
var expected = "<span style=\"color:rgb(255, 255, 85);background-color:rgb(0, 187, 0)\"> " + attr + ";" + bg + ";" + fg + " </span>";
- var l = ansi2html.ansi_to_html(start);
+ var l = ansi_up.ansi_to_html(start);
l.should.eql(expected);
});
@@ -197,7 +197,7 @@ describe('ansi2html', function() {
var expected = "\n <span style=\"color:rgb(0, 187, 0)\"> " + fg + " </span> \n <span style=\"background-color:rgb(0, 187, 0)\"> " + bg + " </span> \n zimpper ";
- var l = ansi2html.ansi_to_html(start);
+ var l = ansi_up.ansi_to_html(start);
l.should.eql(expected);
});

0 comments on commit 9875df4

Please sign in to comment.