diff options
Diffstat (limited to 'askama_shared')
-rw-r--r-- | askama_shared/src/generator.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/askama_shared/src/generator.rs b/askama_shared/src/generator.rs index b5f98ec..f32542a 100644 --- a/askama_shared/src/generator.rs +++ b/askama_shared/src/generator.rs @@ -1184,6 +1184,15 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> { return Ok(DisplayWrap::Unwrapped); } + #[cfg(not(feature = "json"))] + if name == "json" { + return Err("the `json` filter requires the `serde-json` feature to be enabled".into()); + } + #[cfg(not(feature = "yaml"))] + if name == "yaml" { + return Err("the `yaml` filter requires the `serde-yaml` feature to be enabled".into()); + } + if name == "escape" || name == "safe" || name == "e" || name == "json" { buf.write(&format!( "::askama::filters::{}({}, ", |