From 9b79475294fb01da5848e74f29645b8c9398dd8c Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Mon, 23 Jul 2018 13:48:44 +0100 Subject: Document mechanism for user-defined filters (fixes #102) --- askama/src/lib.rs | 9 +++++++-- 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; -- cgit