Comparing version 2.0.1 to 2.0.2
@@ -0,1 +1,6 @@ | ||
2.0.2 / 2016-06-02 | ||
================== | ||
* Fix incorrect location of some invalid expressions in an attribute. | ||
2.0.1 / 2016-05-31 | ||
@@ -2,0 +7,0 @@ ================== |
20
index.js
@@ -1007,3 +1007,4 @@ 'use strict'; | ||
var lineno = startingLine; | ||
var colno = this.colno; | ||
var colnoBeginAttr = this.colno; | ||
var colnoBeginVal; | ||
var loc = 'key'; | ||
@@ -1013,3 +1014,3 @@ var isEndOfAttribute = function (i) { | ||
if (key.trim() === '') { | ||
colno = this.colno; | ||
colnoBeginAttr = this.colno; | ||
return false; | ||
@@ -1061,9 +1062,11 @@ } | ||
if (isEndOfAttribute.call(this, i)) { | ||
val = val.trim(); | ||
if (val) { | ||
this.incrementColumn(-val.length); | ||
this.assertExpression(val) | ||
this.incrementColumn(val.length); | ||
if (val.trim()) { | ||
var saved = this.colno; | ||
this.colno = colnoBeginVal; | ||
this.assertExpression(val); | ||
this.colno = saved; | ||
} | ||
val = val.trim(); | ||
if (key[0] === ':') this.incrementColumn(-key.length); | ||
@@ -1080,3 +1083,3 @@ else if (key[key.length - 1] === ':') this.incrementColumn(-1); | ||
tok.val = '' == val ? true : val; | ||
tok.col = colno; | ||
tok.col = colnoBeginAttr; | ||
tok.mustEscape = escapedAttr; | ||
@@ -1112,2 +1115,3 @@ this.tokens.push(tok); | ||
loc = 'value'; | ||
colnoBeginVal = this.colno + 1; | ||
state = characterParser.defaultState(); | ||
@@ -1114,0 +1118,0 @@ } else { |
{ | ||
"name": "pug-lexer", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "The pug lexer (takes a string and converts it to an array of tokens)", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -23,5 +23,4 @@ # pug-lexer | ||
`options` can contain the following properties: | ||
`options` can contain the following property: | ||
- `filename` (string): The name of the Pug file; it is used in error handling if provided. | ||
@@ -28,0 +27,0 @@ - `plugins` (array): An array of plugins, in the order they should be applied. |
@@ -18,3 +18,3 @@ 'use strict'; | ||
} | ||
var result = lex(fs.readFileSync(dir + testCase, 'utf8'), __dirname + '/cases/' + testCase); | ||
var result = lex(fs.readFileSync(dir + testCase, 'utf8'), {filename: __dirname + '/cases/' + testCase}); | ||
try { | ||
@@ -42,3 +42,3 @@ assert.deepEqual(expected, result); | ||
try { | ||
lex(fs.readFileSync(edir + testCase, 'utf8'), edir + testCase); | ||
lex(fs.readFileSync(edir + testCase, 'utf8'), {filename: edir + testCase}); | ||
throw new Error('Expected ' + testCase + ' to throw an exception.'); | ||
@@ -45,0 +45,0 @@ } catch (ex) { |
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
219854
298
4434
72