Comments (7)
Its been a while since I've dug into the meaning of this on both sides but I think we were aiming for strict_variables
and strict_filters
exclusively
From https://github.com/Shopify/liquid
By default, the renderer doesn't raise or in any other way notify you if some variables or filters are missing, i.e. not passed to the render method. You can improve this situation by passing strict_variables: true and/or strict_filters: true options to the render method. When one of these options is set to true, all errors about undefined variables and undefined filters will be stored in errors array of a Liquid::Template instance. Here are some examples:
from liquid-rust.
I think that's a fair goal for values leaving a filter chain, but it seems like the inconsistent behaviour between the two cases above is surprising. I'm trying to figure out if there's even a way to handle this case in the template, because as far as I can tell there's no way to check if some value is set without getting this error
from liquid-rust.
it seems like the inconsistent behaviour between the two cases above is surprisin
Yes, I had missed the inconsistency in my first read through. Thats something that needs looking into.
I'm trying to figure out if there's even a way to handle this case in the template, because as far as I can tell there's no way to check if some value is set without getting this error
You can do {% if value %}
(test) or `{% data contains "value" %} (test).
from liquid-rust.
Thanks, if you have any inclinations on where I can poke at this issue in the codebase I'd be happy to see if I can resolve the inconsistency
from liquid-rust.
Any thoughts or follow-up on this one?
from liquid-rust.
The question for any of this is what does Ruby's implementation do with those strict flags set. Any discussion or PR should be focused on that.
from liquid-rust.
Okay, I've done a repl test against the latest ruby gem and found that filters are not allowed to start with undefined variables when strict_variables
is set - which means the former case is incorrect for this implementation, ie {% assign var = value | default: 42 %}
does not currently error, but should
from liquid-rust.
Related Issues (20)
- Change `master` branch to `main` HOT 3
- could not compile kstring HOT 1
- Render Tag HOT 3
- Make struct InnerError public HOT 1
- Open to the idea of supporting less strict parsing/rendering as an option? HOT 3
- Can't render dates with millisecond precision HOT 1
- No way to return a reference for the values method of trait ObjectView
- Dependency Dashboard
- Question: supporting object literals with unknown keys on custom filters HOT 8
- Thoughts on implementing `From<serde_json::Value> for liquid_core::Value`? HOT 2
- How do you use `{% include x.liquid %}`? HOT 5
- Liquid Tag and Echo Tag
- How would you go about implementing a Drop HOT 3
- Add support for u64 numbers?
- Inline comments are not supported HOT 1
- Index access to globals produces parse error HOT 1
- New release? HOT 3
- parser: byte index 1 is not a char boundary
- [Idea] Liquid Rendering Performance Optimization HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from liquid-rust.