liquid-rust
liquid-rust copied to clipboard
Liquid templating for Rust
Compare ``` Error: liquid: --> 1:17 | 1 | {% assign foo = 5 | ten%} | ^-----^ | = unexpected FilterChain; expected FilterChain ``` with ``` Error: liquid: Unknown...
Looks like a `Value` can also be a range? https://github.com/Shopify/liquid/blob/master/lib/liquid/expression.rb#L28 https://github.com/Shopify/liquid-c/blob/master/ext/liquid_c/parser.c#L131 A simple implementation would be to add support for this to the grammar and then have the parsing of...
- [for-loop code](https://github.com/cobalt-org/liquid-rust/blob/master/src/tags/for_block.rs) - [Ruby implementation](https://github.com/Shopify/liquid/blob/master/lib/liquid/tags/tablerow.rb) - [Relevant tests](https://github.com/cobalt-org/liquid-rust/search?q=liquid+282&unscoped_q=liquid+282) - Once this is working, ideally the test will start failing. We would just need to remove the `#[should_panic]` on it...
Example test: ```rust assert_eq!(Nil, filters!(first, v!([]))); ``` - [Rust implementation](https://github.com/cobalt-org/liquid-rust/blob/master/src/filters/mod.rs) - [Ruby implementation](https://github.com/Shopify/liquid/blob/master/lib/liquid/standardfilters.rb) - [Relevant tests](https://github.com/cobalt-org/liquid-rust/search?q=liquid+254&unscoped_q=liquid+254) - Once this is working, ideally the test will start failing. We would just...
Options - BTreeMap - HashMap with FNV - Hashbrowns See - https://www.reddit.com/r/rust/comments/7rgowj/hashmap_vs_btreemap/?st=jpbauj1i&sh=53b29903 - https://www.reddit.com/r/rust/comments/a42gzd/the_swiss_army_knife_of_hashmaps_a_deep_dive_into/?st=jpeldp4k&sh=31d9b004
Example test ```rust assert_render_error!("{x | somefilter1 | upcase | somefilter2}", v!({"x": "foo"})); ```
Example test ```rust assert_template_result!( "else", "{% case a.empty? %}{% when true %}true{% when false %}false{% else %}else{% endcase %}" ); ``` Related #225 Note: we'll already need to deal with...
Example test: ```rust assert_template_result!( " 0 1 2 3 ", "{% for item in (a..3) %} {{item}} {% endfor %}", v!({"a": "invalid integer"}), ); ```
Example test ```rust assert_template_result!( "", "{% for char in characters %}I WILL NOT BE OUTPUT{% endfor %}", v!({"characters": ""}), ); ```