shortcode-tree
Advanced tools
Comparing version 1.4.6 to 1.4.7
@@ -229,4 +229,13 @@ "use strict"; | ||
readingPropName = false; | ||
readingPropVal = true; | ||
if (nextToken === ShortcodeParser.T_TAG_PROPERTY_SEPARATOR) { | ||
// Value-less property | ||
readingPropName = true; | ||
readingPropVal = false; | ||
currentPropKey = null; | ||
} else { | ||
readingPropName = false; | ||
readingPropVal = true; | ||
} | ||
readingPropValLiteral = false; | ||
@@ -233,0 +242,0 @@ } |
{ | ||
"name": "shortcode-tree", | ||
"version": "1.4.6", | ||
"version": "1.4.7", | ||
"description": "Parser library for reading short codes (BB codes) into a tree structure", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -81,2 +81,18 @@ let ShortcodeParser = require('../src').ShortcodeParser; | ||
it('parses a self-closing shortcode with ending integer property', function () { | ||
let testInput = `[image id=123/]`; | ||
let expectedOutput = new Shortcode("image", null, {"id": "123"}, true, testInput); | ||
let actualOutput = ShortcodeParser.parseShortcode(testInput, options) || null; | ||
expect(actualOutput).to.deep.equal(expectedOutput); | ||
}); | ||
it('parses a self-closing shortcode with value-less property', function () { | ||
let testInput = `[image zz id=123/]`; | ||
let expectedOutput = new Shortcode("image", null, {"zz": null, "id": "123"}, true, testInput); | ||
let actualOutput = ShortcodeParser.parseShortcode(testInput, options) || null; | ||
expect(actualOutput).to.deep.equal(expectedOutput); | ||
}); | ||
it('parses only the first shortcode from a set of sticky shortcodes', function () { | ||
@@ -131,2 +147,10 @@ let testInput = `[b]test[/b] not [i]italics[/i]`; | ||
it('parses a broken self-closing shortcode with ending integer property', function () { | ||
let testInput = `[image id=123]`; | ||
let expectedOutput = new Shortcode("image", null, {"id": "123"}, true, testInput); | ||
let actualOutput = ShortcodeParser.parseShortcode(testInput, options) || null; | ||
expect(actualOutput).to.deep.equal(expectedOutput); | ||
}); | ||
it('throws an error for malformatted input: invalid opening tag', function () { | ||
@@ -133,0 +157,0 @@ let testInput = `we [ ] weirdly`; |
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
71352
1244