-
Notifications
You must be signed in to change notification settings - Fork 0
Liquid Filters
⚠️ ⚠️ THIS WIKI IS BEING USED TO JOT DOWN IDEAS AT PRESENT. DON'T ASSUME ANYTHING IS FIXED.⚠️ ⚠️
⚒️ MORE TO COME: Check back later
The filters listed on this page are based on, and have similar syntax and purpose to, Liquid filters.
Not all liquid filters will necessarily be implemented. Those filters listed here that are not yet implemented are marked with a ⛔ symbol.
The examples included with many of the filters are copied from the Liquid documentation.
A link to the original Liquid documentation is included with each filter.
⛔ Returns the absolute value of a numberish value provided on its input. If the input is not numberish then an error is reported.
Parameters: none
Input type: numberish
Output type: Number (Int if input was, or was converted to, Int or Float if input was, or was converted to, Float)
Example:
{{ -17 | abs }}
{{ -56.42 }}
{{ 4 | abs }}
{{ "42" | abs }}
Outputs
17
56.42
4
42
⛔ Appends the text given as a parameter to the input and returns the result.
Parameter: text to be appended, type textish.
Input type: textish
Output type: text
Example:
{{ "/my/fancy/url" | append: ".html" }}
Outputs
/my/fancy/url.html
⛔ Rounds an input Float up to the nearest whole number.
Parameter: none.
Input type: Floatish
Output type: Int
Example:
{{ 1.2 | ceil }}
{{ 2.0 | ceil }}
{{ 183.357 | ceil }}
Outputs:
2
2
184
⛔ Formats a DateTime as a Text value according to the format string passed as a parameter. The format string has the same syntax as strftime.
Parameter: date formatting string, type Text.
Input type: DateTime
Output type: Text
Example (assuming @now
is returning 2015-07-17
):
{{ @now | date: "%a, %b %d, %y" }}
{{ @now | date: "%Y" }}
Outputs:
Fri, Jul 17, 15
2015
⛔ Converts each character of text from the input into lower case.
Any type other than text is first converted to text and then processed.
Parameters: none
Input type: Textish
Output type: Text
Example:
{{ "Parker Moore" | downcase }}
{{ "apple" | downcase }}
Outputs
parker moore
apple
⛔ Rounds an input Float down to the nearest whole number.
Parameter: none.
Input type: Floatish
Output type: Int
Example:
{{ 1.2 | floor }}
{{ 2.0 | floor }}
{{ 183.357 | floor }}
Outputs:
1
2
183
⛔ Prepends the text given as a parameter to the input and returns the result.
Parameter: text to be prepended, type textish.
Input type: textish
Output type: text
Example:
{{ "apples, oranges, and bananas" | prepend: "Some fruit: " }}
Outputs
Some fruit: apples, oranges, and bananas
⛔ Rounds an input Float off to the nearest whole number or, if an argument is provided, to the specified number of decimal places.
Parameter: number of decimal places to round to (optional: default is 0), Type Int.
Input type: Floatish
Output type: Int
Example:
{{ 1.2 | round }}
{{ 2.7 | round }}
{{ 183.357 | round: 2 }}
Output:
1
3
183.36
⛔ Converts each character of text from the input into upper case.
Any type other than text is first converted to text and then processed.
Parameters: none
Input type: Textish
Output type: Text
Example:
{{ "Parker Moore" | upcase }}
{{ "APPLE" | upcase }}
Outputs
PARKER MOORE
APPLE