diff options
author | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2018-07-23 13:48:44 +0100 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2018-07-23 13:48:44 +0100 |
commit | 9b79475294fb01da5848e74f29645b8c9398dd8c (patch) | |
tree | 184217029ae32ff24a6cf76e74b29732821b03da | |
parent | aab286e0c52d8aed3560566d1434ab6ec68a7013 (diff) | |
download | askama-9b79475294fb01da5848e74f29645b8c9398dd8c.tar.gz askama-9b79475294fb01da5848e74f29645b8c9398dd8c.tar.bz2 askama-9b79475294fb01da5848e74f29645b8c9398dd8c.zip |
Document mechanism for user-defined filters (fixes #102)
-rw-r--r-- | askama/src/lib.rs | 9 | ||||
-rw-r--r-- | askama_shared/src/filters/mod.rs | 3 |
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; |