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 = "std")]
21mod std;
22#[cfg(feature = "urlencode")]
23mod urlencode;
24
25#[cfg(feature = "alloc")]
26pub use self::alloc::{
27    AsIndent, capitalize, fmt, format, indent, linebreaks, linebreaksbr, lower, lowercase,
28    paragraphbreaks, title, titlecase, trim, upper, uppercase, wordcount,
29};
30pub use self::builtin::{PluralizeCount, center, join, pluralize, truncate};
31pub use self::escape::{
32    AutoEscape, AutoEscaper, Escaper, Html, HtmlSafe, HtmlSafeOutput, MaybeSafe, Safe, Text,
33    Unsafe, Writable, WriteWritable, e, escape, safe,
34};
35pub use self::humansize::filesizeformat;
36#[cfg(feature = "serde_json")]
37pub use self::json::{json, json_pretty};
38#[cfg(feature = "std")]
39pub use self::std::unique;
40#[cfg(feature = "urlencode")]
41pub use self::urlencode::{urlencode, urlencode_strict};
42
43// MAX_LEN is maximum allowed length for filters.
44const MAX_LEN: usize = 10_000;