aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2018-07-23 13:48:44 +0100
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2018-07-23 13:48:44 +0100
commit9b79475294fb01da5848e74f29645b8c9398dd8c (patch)
tree184217029ae32ff24a6cf76e74b29732821b03da
parentaab286e0c52d8aed3560566d1434ab6ec68a7013 (diff)
downloadaskama-9b79475294fb01da5848e74f29645b8c9398dd8c.tar.gz
askama-9b79475294fb01da5848e74f29645b8c9398dd8c.tar.bz2
askama-9b79475294fb01da5848e74f29645b8c9398dd8c.zip
Document mechanism for user-defined filters (fixes #102)
-rw-r--r--askama/src/lib.rs9
-rw-r--r--askama_shared/src/filters/mod.rs3
2 files changed, 9 insertions, 3 deletions
diff --git a/askama/src/lib.rs b/askama/src/lib.rs
index 7f14b3d..613c8d9 100644
--- a/askama/src/lib.rs
+++ b/askama/src/lib.rs
@@ -79,8 +79,13 @@
//! characters from the value obtained by accessing the `name` field,
//! and print the resulting string as a Rust literal.
//!
-//! Consult the [filters module documentation](filters/index.html) for a list
-//! of available filters.
+//! The built-in filters are documented as part of the
+//! [filters module documentation](filters/index.html).
+//!
+//! To define your own filters, simply have a module named `filters` in
+//! scope of the context deriving a `Template` `impl`. Any filter names
+//! that are not part of the built-in filters will be referenced through
+//! the `filters::` prefix.
//!
//! ## Whitespace control
//!
diff --git a/askama_shared/src/filters/mod.rs b/askama_shared/src/filters/mod.rs
index e4caccd..181e27b 100644
--- a/askama_shared/src/filters/mod.rs
+++ b/askama_shared/src/filters/mod.rs
@@ -1,7 +1,8 @@
//! Module for built-in filter functions
//!
//! Contains all the built-in filter functions for use in templates.
-//! Currently, there is no way to define filters outside this module.
+//! You can define your own filters; for more information,
+//! see the top-level crate documentation.
#[cfg(feature = "serde-json")]
mod json;