elf-notes/content/zola/filters.yaml

151 lines
3.7 KiB
YAML

-
dt: "lower"
dd: Converts string to lowercase
-
dt: "upper"
dd: Converts string to uppercase
-
dt: "wordcount"
dd: Counts the words in a string
-
dt: "capitalize"
dd: Capitalizes the first letter, lowercase the rest
-
dt: "replace"
dd: Takes two strings as arguments, replaces the first with the second
-
dt: "addslashes"
dd: Escapes quoted strings
-
dt: "slugify"
dd: Provides a slug for the string
-
dt: "title"
dd: Capitalizes each word in the string
-
dt: "trim"
dd: Removes leading and trailing whitespace
-
dt: "trim_start"
dd: Removes leading whitespace
-
dt: "trim_end"
dd: Removes trailing whitespace
-
dt: "trim_start_matches"
dd: Removes leading characters that match a pattern
-
dt: "trim_end_matches"
dd: Removes trailing characters that match a pattern
-
dt: "truncate"
dd: Truncates the string to the length specified
-
dt: "linebreaksbr"
dd: Replaces line breaks (\n or \r\n) with HTML line breaks (<br>)
-
dt: "spaceless"
dd: Remove space ( ) and line breaks (\n or \r\n) between HTML tags
-
dt: "striptags"
dd: Tries to remove HTML tags from input
-
dt: "first"
dd: Returns the first element of an array
-
dt: "last"
dd: Returns the last element of an array
-
dt: "nth"
dd: Returns the nth element of an array
-
dt: "join"
dd: Joins an array with a delimeter
-
dt: "length"
dd: Returns the length of an array, an object, or a string
-
dt: "reverse"
dd: Returns a reversed string or array
-
dt: "sort"
dd: Sorts an array into ascending order. You can sort objects by providing a fieldname argument
-
dt: "unique"
dd: Removes duplicate items from an array. You can filter objects by providing a fieldname argument
-
dt: "slice"
dd: Slices an array by the given start and end parameter
-
dt: "group_by"
dd: Groups an array using the required attribute argument
-
dt: "filter"
dd: Filters the array values, returning objects whose attribute is equal to the argument
-
dt: "map"
dd: Retrieves an attribute from each object in an array
-
dt: "concat"
dd: Appends values to an array
-
dt: "urlencode"
dd: Performs classic (%-based) URL encoding
-
dt: "urlencode_strict"
dd: Encodes URLs, including any slashes
-
dt: "pluralize"
dd: Can return an alternative text if the argument is greater than one
-
dt: "round"
dd: Returns a number rounded
-
dt: "filesizeformat"
dd: Generates human-readable sizes for integers
-
dt: "date"
dd: Parses a timestamp into a date(time) string
-
dt: "escape"
dd: Escapes a string's HTML
-
dt: "escape_xml"
dd: Escapes XML special characters
-
dt: "safe"
dd: "Marks a variable as safe: HTML will not be escaped"
-
dt: "get"
dd: Accesses a value from an object when the key is not a valid identifier.
-
dt: "split"
dd: Splits a string into an array of strings, separated by a pattern.
-
dt: "int"
dd: Converts a value into an integer.
-
dt: "float"
dd: Converts a value into a float.
-
dt: "json_encode"
dd: Transforms a value into its JSON representation
-
dt: "as_str"
dd: Returns a string representation of the value.
-
dt: "default"
dd: Provides a default value if the name is not present in the context
-
dt: "markdown"
dd: Converts the variable contents from markdown to HTML
-
dt: "base64_encode"
dd: Encode the variable to base64
-
dt: "base64_decode"
dd: Decode the variable from base64
-
dt: "num_format"
dd: Format a number in a variety of ways