clean-html
Advanced tools
Comparing version 1.3.3 to 1.3.4
11
cmd.js
@@ -18,2 +18,3 @@ #!/usr/bin/env node | ||
'replace-nbsp': getOptAsBool(argv['replace-nbsp']), | ||
'wrap': getOptAsInt(argv['wrap']), | ||
'add-break-around-tags': getOptAsArray(argv['add-break-around-tags']), | ||
@@ -48,2 +49,12 @@ 'add-remove-attributes': getOptAsArray(argv['add-remove-attributes']), | ||
function getOptAsInt(opt) { | ||
if (opt === undefined) { | ||
return undefined; | ||
} | ||
var val = parseInt(opt); | ||
return isNaN(val) ? undefined : val; | ||
} | ||
function read(filename, callback) { | ||
@@ -50,0 +61,0 @@ if (filename) { |
12
index.js
@@ -90,3 +90,3 @@ var htmlparser = require('htmlparser2'), | ||
options['replace-nbsp'] = opt['replace-nbsp'] === true ? true : false; | ||
options['wrap'] = opt['wrap'] || options['wrap']; | ||
options['wrap'] = opt['wrap'] >= 0 ? opt['wrap'] : options['wrap']; | ||
@@ -258,2 +258,10 @@ if (opt['add-break-around-tags']) { | ||
if (bound == -1) { | ||
bound = line.indexOf(' ', options['wrap']); | ||
if (bound == -1) { | ||
return line; | ||
} | ||
} | ||
var line1 = line.substr(0, bound), | ||
@@ -300,3 +308,3 @@ line2 = indent + line.substr(bound + 1); | ||
if (line.length > options['wrap']) { | ||
if (options['wrap'] && line.length > options['wrap']) { | ||
line = wrap(line, indent); | ||
@@ -303,0 +311,0 @@ } |
{ | ||
"name": "clean-html", | ||
"version": "1.3.3", | ||
"version": "1.3.4", | ||
"description": "HTML cleaner and beautifier", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -153,3 +153,3 @@ ## HTML cleaner and beautifier | ||
The column number where lines should wrap. | ||
The column number where lines should wrap. Set to 0 to disable line wrapping. | ||
@@ -156,0 +156,0 @@ Type: Integer |
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
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
22154
477