Expand description
Module for built-in filter functions
Contains all the built-in filter functions for use in templates. You can define your own filters, as well. For more information, read the book.
Functions
- Absolute value
- Capitalize a value. The first character will be uppercase, all others lowercase.
- Centers the value in a field of a given width
- Escapes strings according to the escape mode.
- Returns adequate string representation (in KB, ..) of number of bytes
- Formats arguments according to the specified format
- Formats arguments according to the specified format
- Indent lines with
width
spaces - Casts number to f64
- Casts number to isize
- Joins iterable into a string separated by provided argument
- Serialize to JSON (requires
json
feature) - Replaces line breaks in plain text with appropriate HTML
- Converts all newlines in a piece of plain text to HTML line breaks
- Converts to lowercase
- Alias for the
lower()
filter - Replaces only paragraph breaks in plain text with appropriate HTML
- Marks a string (or other
Display
type) as safe - Strip leading and trailing whitespace
- Limit string length, appends ‘…’ if truncated
- Converts to uppercase
- Alias for the
upper()
filter - Percent-encodes the argument for safe use in URI; does not encode
/
. - Percent-encodes the argument for safe use in URI; encodes
/
. - Count the words in that string
- Serialize to YAML (requires
serde_yaml
feature)