liquid-rust
liquid-rust copied to clipboard
Liquid templating for Rust
Example test: ```rust assert_eq!(v!(["foo"]), filters!(uniq, v!("foo"))); ``` - [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+266&unscoped_q=liquid+266) - Once this is working, ideally the test will start failing. We would just...
Example test ```rust assert_eq!( v!([{ "a": 1, "b": 2 }]), filters!(reverse, v!({"a": 1, "b": 2})) ); ``` - [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+256&unscoped_q=liquid+256) - Once this is...
Example test ```rust let template = r#"{% assign key = "foo" %}{{ thing | map: key | map: "bar" }}"#; let hash = v!({ "foo": { "bar": 42 } });...
Example test: ``` let assigns = v!({ "words": ["a", nil, "b", nil, "c"], "hashes": [{ "a": "A" }, { "a": nil }, { "a": "C" }], }); // Test hashes...
Currently, increment / decrement have special support in `Context`. We should generalize this to be like the ruby version so any plugin can do this.
Example test ```rust assert_eq!(v!([]), filters!(uniq, v!([]), v!("a"))); ```
The “now” keyword, when passed to the `date` filter in Shopify Liquid calls out to [Ruby's `Time.now`,](https://github.com/Shopify/liquid/blob/8dcc3191281478c4ba544d3c507fdb99aa512f75/lib/liquid/utils.rb#L72-L73) which returns the current time, in the current system time zone: ``` $...
Example test: ```rust let assigns = v!({ "array": { "items": [1, 2, 3, 4, 5, 6, 7, 8, 9, 0] } }); let markup = r#" {%for i in array.items...