fix: allow string literals contain delimiters, fixes #288

This commit is contained in:
harttle
2021-01-24 12:49:19 +08:00
parent 5e7598ce45
commit 9c40da7369
3 changed files with 157 additions and 117 deletions
+6 -1
View File
@@ -56,7 +56,7 @@ describe('Issues', function () {
})
it('#277 Passing liquid in FilterImpl', () => {
const engine = new Liquid()
engine.registerFilter('render', function (template: string, name: string) {
engine.registerFilter('render', function (this: any, template: string, name: string) {
return this.liquid.parseAndRenderSync(decodeURIComponent(template), { name })
})
const html = engine.parseAndRenderSync(
@@ -65,4 +65,9 @@ describe('Issues', function () {
)
expect(html).to.equal('hello foo')
})
it('#288 Unexpected behavior when string literals contain }}', async () => {
const engine = new Liquid()
const html = await engine.parseAndRender(`{{ '{{' }}{{ '}}' }}`)
expect(html).to.equal('{{}}')
})
})