diff options
| author | Jules Laplace <jules@okfoc.us> | 2016-11-21 19:56:44 -0500 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2016-11-21 19:56:44 -0500 |
| commit | da41cc8faa8e38fedf26e1c4c711bd00cef92482 (patch) | |
| tree | 30f8779177532acb96f2d5d7a82def1e0e5d8d1a /js/matrix.js | |
| parent | 9043d36f00094c94f45fb24057886d943463bef9 (diff) | |
exporting escape codes
Diffstat (limited to 'js/matrix.js')
| -rw-r--r-- | js/matrix.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/js/matrix.js b/js/matrix.js index 1aeb929..dbc76c7 100644 --- a/js/matrix.js +++ b/js/matrix.js @@ -250,6 +250,23 @@ Matrix.prototype.ascii = function () { var txt = lines.join("\n") return txt } +Matrix.prototype.ansi = function (opts) { + var lines = this.aa.map(function(row, y){ + var last, line = "" + row.forEach(function(lex, x) { + if (lex.eqColor(last)) { + line += lex.sanitize() + } + else { + line += lex.ansi() + last = lex + } + }) + return line + }) + var txt = lines.filter(function(line){ return line.length > 0 }).join('\\e[0m\\n') + "\\e[0m" + return 'echo -e "' + txt + '"' +} Matrix.prototype.mirc = function (opts) { var cutoff = false var lines = this.aa.map(function(row, y){ |
