mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-16 12:50:38 -07:00
fix: allow quotes in inline comment tag, fixes #628
This commit is contained in:
@@ -199,15 +199,6 @@ describe('Tokenizer', function () {
|
||||
})
|
||||
})
|
||||
describe('#readTagToken()', () => {
|
||||
it('should skip quoted delimiters', function () {
|
||||
const html = '{% assign a = "%} {% }} {{" %}'
|
||||
const tokenizer = new Tokenizer(html)
|
||||
const token = tokenizer.readTagToken()
|
||||
|
||||
expect(token).toBeInstanceOf(TagToken)
|
||||
expect(token.name).toBe('assign')
|
||||
expect(token.args).toBe('a = "%} {% }} {{"')
|
||||
})
|
||||
})
|
||||
describe('#readOutputToken()', () => {
|
||||
it('should skip quoted delimiters', function () {
|
||||
|
||||
@@ -140,9 +140,10 @@ export class Tokenizer {
|
||||
return token
|
||||
}
|
||||
|
||||
readToDelimiter (delimiter: string) {
|
||||
readToDelimiter (delimiter: string, respectQuoted = false) {
|
||||
this.skipBlank()
|
||||
while (this.p < this.N) {
|
||||
if ((this.peekType() & QUOTE)) {
|
||||
if (respectQuoted && (this.peekType() & QUOTE)) {
|
||||
this.readQuoted()
|
||||
continue
|
||||
}
|
||||
@@ -156,7 +157,7 @@ export class Tokenizer {
|
||||
const { file, input } = this
|
||||
const { outputDelimiterRight } = options
|
||||
const begin = this.p
|
||||
if (this.readToDelimiter(outputDelimiterRight) === -1) {
|
||||
if (this.readToDelimiter(outputDelimiterRight, true) === -1) {
|
||||
throw this.error(`output ${this.snapshot(begin)} not closed`, begin)
|
||||
}
|
||||
return new OutputToken(input, begin, this.p, options, file)
|
||||
|
||||
Reference in New Issue
Block a user