askama/filters/
mod.rs

1//! Module for built-in filter functions
2//!
3//! Contains all the built-in filter functions for use in templates.
4//! You can define your own filters, as well.
5//!
6//! ## Note
7//!
8//! All **result types of any filter function** in this module is **subject to change** at any
9//! point, and is **not indicated by as semver breaking** version bump.
10//! The traits [`AutoEscape`] and [`WriteWritable`] are used by [`askama_derive`]'s generated code
11//! to work with all compatible types.
12
13#[cfg(feature = "alloc")]
14mod alloc;
15mod builtin;
16mod escape;
17mod humansize;
18#[cfg(feature = "serde_json")]
19mod json;
20#[cfg(feature = "urlencode")]
21mod urlencode;
22
23#[cfg(feature = "alloc")]
24pub use self::alloc::{
25    capitalize, fmt, format, indent, linebreaks, linebreaksbr, lower, lowercase, paragraphbreaks,
26    title, trim, upper, uppercase, wordcount,
27};
28pub use self::builtin::{PluralizeCount, center, join, pluralize, truncate};
29pub use self::escape::{
30    AutoEscape, AutoEscaper, Escaper, FastWritable, Html, HtmlSafe, HtmlSafeOutput, MaybeSafe,
31    Safe, Text, Unsafe, Writable, WriteWritable, e, escape, safe,
32};
33pub use self::humansize::filesizeformat;
34#[cfg(feature = "serde_json")]
35pub use self::json::{AsIndent, json, json_pretty};
36#[cfg(feature = "urlencode")]
37pub use self::urlencode::{urlencode, urlencode_strict};
38
39// MAX_LEN is maximum allowed length for filters.
40const MAX_LEN: usize = 10_000;