downcase
Description
convert an input string to DOWNCASE
Usage
{{ "Testing" | downcase }}
testing
upcase
Description
convert an input string to UPCASE
Usage
{{ "Testing" | upcase }}
TESTING
capitalize
Description
capitalize words in the input centence
Usage
{{ "testing" | upcase }}
Testing
escape
Description
escape special characters in HTML, namely &"<>
Usage
{{ 'Usage: foo "bar" <baz>' | upcase }}
Usage: foo "bar" <baz>
truncate
Description
truncate a string down to x characters
Usage
{{ '1234567890' | truncate: 7 }}
1234...
truncatewords
Description
truncate a sentence down to x words
Usage
{{ 'one two three' | truncatewords: 2 }}
one two...
split
Description
split input string into an array of substrings separated by given pattern.
Usage
{{ '12~34' | split: '~' }}
['12','34']
strip_html
Description
strip HTML tags
Usage
{{ '<div>test</div>' | strip_html }}
test
strip_newlines
Description
remove all newlines from the string
Usage
{{ "a\nb\nc" | strip_newlines }}
abc
join
Description
join elements of the array with certain character between them
Usage
{{ [1,2,3,4] | join }}
1 2 3 4
{{ [1,2,3,4] | join: ' - ' }}
1 - 2 - 3 - 4
sort
Description
sort elements of the array. Provide optional property with which to sort an array of hashes or drops
Usage
{{ [4,3,2,1] | sort }}
[1,2,3,4]
{{ products | sort: price }}
reverse
Description
Reverse the elements of an array
Usage
{{ [1,2,3,4] | reverse }}
[4,3,2,1]
map
Description
map/collect on a given property
Usage
{{ products | map: name }}
['Product 1', 'Product 2']
replace
Description
replace occurrences of a string with another
Usage
{{ '1 1 1 1' | replace: '2' }}
2 2 2 2
replace_first
Description
replace the first occurrences of a string with another
Usage
{{ '1 1 1 1' | replace_first: '2' }}
2 1 1 1
remove
Description
remove a substring
Usage
{{ "a a a a" | remove: 'a' }}
remove_first
Description
remove the first occurrences of a substring
Usage
{{ 'a a a a' | remove_first: 'a ' }}
a a a
append
Description
add one string to another
Usage
{{ "bc" | append: 'd' }}
bcd
prepend
Description
prepend a string to another
Usage
{{ "bc" | prepend: 'a' }}
abc
newlinetobr
Description
add
tags in front of all newlines in input string
Usage
{{ "a\nb\nc" | newline_to_br }}
a<br />\nb<br />\nc
date
Description
Reformat a date
%a - The abbreviated weekday name (``Sun'')
%A - The full weekday name (``Sunday'')
%b - The abbreviated month name (``Jan'')
%B - The full month name (``January'')
%c - The preferred local date and time representation
%d - Day of the month (01..31)
%H - Hour of the day, 24-hour clock (00..23)
%I - Hour of the day, 12-hour clock (01..12)
%j - Day of the year (001..366)
%m - Month of the year (01..12)
%M - Minute of the hour (00..59)
%p - Meridian indicator (``AM'' or ``PM'')
%S - Second of the minute (00..60)
%U - Week number of the current year,
starting with the first Sunday as the first
day of the first week (00..53)
%W - Week number of the current year,
starting with the first Monday as the first
day of the first week (00..53)
%w - Day of the week (Sunday is 0, 0..6)
%x - Preferred representation for the date alone, no time
%X - Preferred representation for the time alone, no date
%y - Year without a century (00..99)
%Y - Year with century
%Z - Time zone name
%% - Literal ``%'' character
Usage
{{ now | date: '%m/%d/%Y' }}
11/23/2014
plus
Description
addition
Usage
{{ 1 | plus: 1 }}
2
minus
Description
subtraction
Usage
{{ '4.3' | minus: '2' }}
2.3
times
Description
multiplication
Usage
{{ 0.0725 | times:100 }}
7.25
divided_by
Description
division
Usage
{{ 14 | divided_by:3 }}
4
modulo
Description
modulo
Usage
{{ 3 | modulo: 2 }}
1