Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for strict variables #74

Merged
merged 1 commit into from
Aug 23, 2023
Merged

Conversation

jamesog
Copy link
Contributor

@jamesog jamesog commented Oct 29, 2022

The Ruby implementation has support for erroring when a template has an undefined variable. This is implemented by passing an option to the render() method.

As this version doesn't expose render.Config in the engine, a StrictVariables() method is provided on the engine to enable it. This differs from the Ruby version in that it's on for the entire engine, rather than enabled for each call to Render(). This is more similar to the Ruby version's render!() method as it immediately errors, rather than storing a stack of errors which can be accessed later.

Refs. #8

Checklist

  • I have read the contribution guidelines.
  • make test passes.
  • make lint passes.
  • New and changed code is covered by tests.
  • Changes match the documented (not just the implemented) behavior of Shopify.

The Ruby implementation has support for erroring when a template has an
undefined variable. This is implemented by passing an option to the
render() method.

As this version doesn't expose render.Config in the engine, a
StrictVariables() method is provided on the engine to enable it. This
differs from the Ruby version in that it's on for the entire engine,
rather than enabled for each call to Render(). This is more similar to
the Ruby version's render!() method as it immediately errors, rather
than storing a stack of errors which can be accessed later.

Refs. osteele#8
@danog danog merged commit 0bded6a into osteele:main Aug 23, 2023
@jamesog jamesog deleted the strict-variables branch August 23, 2023 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants