diff options
author | vallentin <mail@vallentin.dev> | 2020-12-29 23:53:59 +0100 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2020-12-30 07:29:40 +0100 |
commit | cc2b8561826b34786cc33994c6725b35660cd6de (patch) | |
tree | d2f44ceef70d9ed6a9c07789f0868bba086b1e03 /askama_shared | |
parent | 929e9c2bcedb81388ae783a1cb829fbfbaab50dd (diff) | |
download | askama-cc2b8561826b34786cc33994c6725b35660cd6de.tar.gz askama-cc2b8561826b34786cc33994c6725b35660cd6de.tar.bz2 askama-cc2b8561826b34786cc33994c6725b35660cd6de.zip |
Added tojson alias
Diffstat (limited to 'askama_shared')
-rw-r--r-- | askama_shared/src/generator.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/askama_shared/src/generator.rs b/askama_shared/src/generator.rs index ce1ac08..cde0ead 100644 --- a/askama_shared/src/generator.rs +++ b/askama_shared/src/generator.rs @@ -1170,7 +1170,7 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> { fn visit_filter( &mut self, buf: &mut Buffer, - name: &str, + mut name: &str, args: &[Expr], ) -> Result<DisplayWrap, CompileError> { if name == "format" { @@ -1184,6 +1184,10 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> { return Ok(DisplayWrap::Unwrapped); } + if name == "tojson" { + name = "json"; + } + #[cfg(not(feature = "json"))] if name == "json" { return Err("the `json` filter requires the `serde-json` feature to be enabled".into()); |