aboutsummaryrefslogtreecommitdiffstats
path: root/askama_shared/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--askama_shared/src/generator.rs6
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());