Comparing version 0.0.5 to 0.0.6
14
index.js
@@ -96,3 +96,4 @@ (function(exportTo) { | ||
currentState = NOT_TAG; | ||
if(currentTag.toLowerCase() === "/p"){ | ||
currentTag = currentTag.toLowerCase(); | ||
if(currentTag === "/p"){ | ||
paragraphCounter++; | ||
@@ -104,6 +105,9 @@ if(options.StripHTML){ | ||
if(currentTag.indexOf("/") === -1){ | ||
tagStack.push(currentTag); | ||
}else if(selfClosingTags.indexOf(currentTag) === -1){ | ||
tagStack.pop(); | ||
// Ignore self-closing tags. | ||
if ((selfClosingTags.indexOf(currentTag) === -1) && (selfClosingTags.indexOf(currentTag + '/') === -1)) { | ||
if(currentTag.indexOf("/") >= 0){ | ||
tagStack.pop(); | ||
} else { | ||
tagStack.push(currentTag); | ||
} | ||
} | ||
@@ -110,0 +114,0 @@ } |
{ | ||
"name": "truncatise", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "Truncate HTML based on characters, words or paragraphs. Has the ability to strip tags.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -170,2 +170,7 @@ var truncatise = require("./"), | ||
}); | ||
it("should not append self-closing br tags to the end of the string",function(){ | ||
truncatise("<p>This<br>handles<br></p>",{TruncateLength: 2, TruncateBy : "words", StripHTML : false, Suffix : ''}) | ||
.should.equal("<p>This<br>handles<br></p>"); | ||
}); | ||
}); | ||
@@ -172,0 +177,0 @@ |
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
358
25746
7