Skip to content
This repository has been archived by the owner on Jul 15, 2019. It is now read-only.

Commit

Permalink
updated usage message and disabled line by line processing
Browse files Browse the repository at this point in the history
  • Loading branch information
adon committed Oct 5, 2015
1 parent 9b169d1 commit 39e1b5b
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions bin/html-purifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,26 @@ var Purifier = require('../src/html-purify'),
(function() {
var fs = require('fs'),
file,
lineByLine = false,
// lineByLine = false,
benchmark = false,
noofargs = process.argv.length;

process.argv.forEach(function(val, index) {
if (index === 2) {
file = val;
} else if (index === 3) {
if (val === "-l") {
lineByLine = true;
} else if (val === "--benchmark") {
if (val === "--benchmark") {
benchmark = true;
}
// else if (val === "-l") {
// lineByLine = true;
// }
}
});


if (noofargs < 3) {
console.log("Usage: html-purifier <any html file>");
console.log("Usage: html-purifier <html_filepath> [--benchmark]");
process.exit(1);
}

Expand All @@ -43,7 +44,8 @@ var Purifier = require('../src/html-purify'),

var data = fs.readFileSync(file, 'utf-8'), i, output = '';

// The following is disabled as it might generate insecure html, since linebreak can exists within attr value state, while purify() assumes data state for each call
// The following is disabled as it might generate insecure html,
// as it could violate the assumption that purify() must start with the data state
// if (lineByLine) {
// // reading and processing line by line
// var data2 = data.split(/\n/);
Expand Down

0 comments on commit 39e1b5b

Please sign in to comment.