htmljs-parser
Advanced tools
Comparing version 2.4.0 to 2.5.0
@@ -285,2 +285,25 @@ exports.createNotifiers = function(parser, listeners) { | ||
notifyString(string) { | ||
if (hasError) { | ||
return; | ||
} | ||
var eventFunc = listeners.onString; | ||
if (eventFunc) { | ||
var stringEvent = { | ||
type: 'string', | ||
value: string.value, | ||
pos: string.pos, | ||
endPos: string.endPos, | ||
stringParts: string.stringParts, | ||
isStringLiteral: string.isStringLiteral | ||
}; | ||
eventFunc.call(parser, stringEvent, parser); | ||
return stringEvent.value; | ||
} | ||
return string.value; | ||
}, | ||
notifyFinish() { | ||
@@ -287,0 +310,0 @@ if (listeners.onfinish) { |
@@ -41,3 +41,3 @@ { | ||
}, | ||
"version": "2.4.0" | ||
"version": "2.5.0" | ||
} |
@@ -78,2 +78,10 @@ htmljs-parser | ||
onString: function(event) { | ||
// Text within "" | ||
var value = event.value; // String | ||
var stringParts = event.stringParts; // Array | ||
var isStringLiteral = event.isStringLiteral // Boolean | ||
var pos = event.pos; // Integer | ||
}, | ||
onCDATA: function(event) { | ||
@@ -80,0 +88,0 @@ // <![CDATA[<value>]]> |
@@ -89,12 +89,3 @@ var path = require('path'); | ||
var expectedObject = JSON.parse(expected); | ||
try { | ||
assert.deepEqual( | ||
actual, | ||
expectedObject); | ||
} catch(e) { | ||
// console.error('Unexpected output for "' + name + '":\nEXPECTED (' + expectedPath + '):\n---------\n' + expectedJSON + | ||
// '\n---------\nACTUAL (' + actualPath + '):\n---------\n' + actualJSON + '\n---------'); | ||
throw new Error('Unexpected output for "' + name + '"'); | ||
} | ||
assert.deepEqual(actual, expectedObject); | ||
} else { | ||
@@ -105,3 +96,3 @@ if (actual !== expected) { | ||
} else { | ||
throw new Error('Unexpected output for "' + name + '"'); | ||
assert.deepEqual(actual, expected); | ||
} | ||
@@ -108,0 +99,0 @@ } |
@@ -188,2 +188,8 @@ 'use strict'; | ||
onString: (event) => { | ||
if (!event.isStringLiteral) { | ||
event.value = '$placeholderString(' + event.value + ')'; | ||
} | ||
}, | ||
onPlaceholder: (event) => { | ||
@@ -190,0 +196,0 @@ var escape = event.escape; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
249872
3782
595