elf-notes/content/zola/filters.json

205 lines
6.1 KiB
JSON

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