Skip to content

Invalid template seems to parse fine #519

@amit777

Description

@amit777

Hi, I'm wondering if the the following code would be expected to throw an error while parsing a liquid template. I would have expected parse to fail, however, I only get an error when trying to call render.:

Note, the template is invalid because the URL is not enclosed in quotes.

import { Liquid } from 'liquidjs'
const engine = new Liquid()

// I would expect error to get thrown on this parse line
const tpl = engine.parse('{% assign headshot = https://testurl.com/not_enclosed_in_quotes.jpg %}')

// Error gets thrown by following line
engine.render(tpl, {}).then(console.log)

I only get a RenderError

unexpected token at "://testurl.co...", line:1, col:1
>> 1| {% assign headshot = https://testurl.com/not_enclosed_in_quotes.jpg %}
RenderError: unexpected token at "://testurl.co...", line:1, col:1

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions