htmltidy
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -13,8 +13,8 @@ var Stream = require('stream').Stream; | ||
// default tidy opts | ||
var DEFFAUL_OPTS = { | ||
showWarnings: false, | ||
var DEFAULT_OPTS = { | ||
showWarnings: true, | ||
tidyMark: false, | ||
forceOutput: true, | ||
quiet: true | ||
} | ||
quiet: false | ||
}; | ||
@@ -26,5 +26,9 @@ // choose suitable executable | ||
Stream.call(this); | ||
// Store a reference to the merged options for consumption by error reporting logic | ||
var mergedOpts = merge(opts, DEFAULT_OPTS); | ||
this.writable= true; | ||
this.readable= true; | ||
this._worker = spawn(tidyExec, parseOpts(merge(opts, DEFFAUL_OPTS))); | ||
this._worker = spawn(tidyExec, parseOpts(mergedOpts)); | ||
var self = this; | ||
@@ -48,5 +52,20 @@ var errors = ''; | ||
this._worker.on('exit', function (code) { | ||
if (code > TIDY_WARN) | ||
self.emit('error', errors); | ||
switch(code){ | ||
// If there were any warnings or errors from Tiny command | ||
case TIDY_WARN: | ||
// The user asks to see warnings. | ||
if(mergedOpts.showWarnings){ | ||
self.emit('error', errors); | ||
} | ||
break; | ||
case TIDY_ERR: | ||
// The user asks to see errors. | ||
if(mergedOpts.showErrors){ | ||
self.emit('error', errors); | ||
} | ||
break; | ||
} | ||
self.emit('end'); | ||
}); | ||
@@ -83,3 +102,3 @@ } | ||
TidyWorker.prototype.destory = function () { | ||
TidyWorker.prototype.destroy = function () { | ||
if (this._worker) | ||
@@ -86,0 +105,0 @@ return; |
{ | ||
"name": "htmltidy", | ||
"description": "tidy bad html", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"author": "lauris <lauris@ma-1.lv>", | ||
"contributors": [ | ||
{ | ||
"name": "Keith Rosenberg", | ||
"email": "kthrose@netpoetica.com" | ||
} | ||
], | ||
"main": "htmltidy.js", | ||
@@ -7,0 +13,0 @@ "repository": "git://github.com/vavere/htmltidy", |
@@ -63,2 +63,4 @@ HTML Tidy | ||
--------- | ||
0.0.5 - Feb 25, 2013 | ||
- changes contributed by Keith Rosenberg | ||
0.0.4 - Feb 23, 2013 | ||
@@ -65,0 +67,0 @@ - fixed error in package.json |
Sorry, the diff of this file is not supported yet
1364406
175
85