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§
- 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.
- Formats arguments according to the specified format
- Formats arguments according to the specified format
- Indent lines with
width
spaces - 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 - Count the words in that string