Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The abbreviate filter will abbreviate a string using an ellipsis. It takes one argument which is the max width of the desired output including the length of the ellipsis.

Example

{{{ "This is a sentence"

 | abbreviate(7) }}

Output

This...

Anchor
_abs
_abs
abs

The abs filter is used to obtain the absolute value.

Example

{{ -5

 | abs }}

Output

5

Anchor
_capitalize
_capitalize
capitalize

The capitalize filter will capitalize the first letter of the string.

Example

{{ "this is a sentence"

 | capitalize }}

Output

This is a sentence

Anchor
_date
_date
date

The date filter is used to format an existing java.util.Date object. The filter will construct a java.text.SimpleDateFormat using the provided pattern and then use this newly created SimpleDateFormat to format the provided Date object.
The alternative way to use this filter is to use it on a string but then provide two arguments. The first is the desired pattern for the output and the second is the existing format used to parse the input string into a java.util.Date object.

Example : If todayDate is a java.util.Date object

{{ todayDate

 | date("yyyy-MM-dd") }}

Output

2017-12-25


Example 2

{{ "December 25, 2017"

 | date("yyyy-MM-dd", existingFormat="MMMM dd, yyyy") }}

Output

2017-12-25

Anchor
_default
_default
default

The default filter will render a default value if and only if the object being filtered is empty. A variable is empty if it is null, an empty string, an empty collection, or an empty map.

Example

{%- set str = "" -%}
{{ str

 | default("NonEmpty") }}

Output

NonEmpty

Anchor
_escape
_escape
escape

The escape filter will turn special characters into safe character references in order to avoid XSS vulnerabilities.

Example

{{ "<content>"

 | escape }}

Output

<content>

Anchor
_first
_first
first

The first filter will return the first item of a collection, or the first letter of a string.

Example

{{ "Some letters"

 | first }}

Output

S


{{ [

Example 2

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="8b46565d-7f5c-4bb1-a820-d51f975b3355"><ac:plain-text-body><![CDATA[

{{ [ "b", "a", "c" ]

 | first }}

]]></ac:plain-text-body></ac:structured-macro>

Output

b

Anchor
_join
_join
join

The join filter will concatenate all items of a collection into a string. An optional argument can be given to be used as the separator between items.

Example

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="3bc80f0d-5b94-455c-9a21-d7511e48fae1"><ac:plain-text-body><![CDATA[

{{ [ "This", "is", "a", "sentence" ]

 | join }}

]]></ac:plain-text-body></ac:structured-macro>

Output

This is a sentence


{{ [

Example 2

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="104ad409-d2a7-4a69-9ced-95c343cdeaa0"><ac:plain-text-body><![CDATA[

{{ [ "This", "is", "a", "sentence" ]

 | join(" ") }}

]]></ac:plain-text-body></ac:structured-macro>

Output

This is a sentence

Anchor
_last
_last
last

The last filter will return the last item of a collection, or the last letter of a string.

Example

{{ "Some letters"

 | last }}

Output

s


{{ [

Example 2

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="09397f1b-8f07-47e4-8e24-33042612a6f3"><ac:plain-text-body><![CDATA[

{{ [ "b", "a", "c" ]

 | last }}

]]></ac:plain-text-body></ac:structured-macro>

Output

c

Anchor
_length
_length
length

The length filter returns the number of items of collection, map or the length of a string.

Example

{{ "Some letters"

 | length }}

Output

12


Example 2

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="1ce506bf-7a0b-498d-bec9-b5bcac9b0b93"><ac:plain-text-body><![CDATA[

{{ [ "b", "a", "c" ]

 | length }}

]]></ac:plain-text-body></ac:structured-macro>

Output

3

Anchor
_lower
_lower
lower

The lower filter makes an entire string lower case.

Example

{{ "THIS IS A SENTENCE"

 | lower }}

Output

this is a sentence

Anchor
_merge
_merge
merge

The merge filter returns a new map, list or array that is the result of merging two maps, lists or arrays together.

Note
titleNote

Keys in the second map will overwrite the first map keys.


Example

{%- set mapa = { "a": "aa", "b": "bb", "c": "cc" } -%}
{%- set mapb = { "c": "ccc", "d": "ddd", "e": "eee" } -%}
{{ mapa

 | merge(mapb) }}

Output

{a=aa, b=bb, c=ccc, d=ddd, e=eee}

Anchor
_numberformat
_numberformat
numberformat

The numberformat filter is used to format a decimal number. Behind the scenes it uses java.text.DecimalFormat.

Example

{{ 3.14678

 | numberformat("#.##") }}

Output

3.15

Anchor
_raw
_raw
raw

The raw filter prevents the output of an expression from being escaped by the autoescaper. The raw filter must be the very last operation performed within the expression otherwise the autoescaper will deem the expression as potentially unsafe and escape it regardless.

Note
titleNote

If the raw filter is not the last operation performed then the expression will be escaped.


Example

{{ "<content>"

 | raw }}

Output

<content>

Anchor
_replace
_replace
replace

The replace filter returns a string that is the result of replacing any substrings matching keys in a map with the respective values.

Example

{{ "This is a sentence"

 | replace({ "i": "eye" }) }}

Output

Theyes eyes a sentence

Anchor
_rsort
_rsort
rsort

The rsort filter will sort a list in reversed order. The items of the list must implement Comparable.

Example

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="a294fdad-f9ca-4fca-bcdf-f34d7071423d"><ac:plain-text-body><![CDATA[

{{ [ "b", "a", "c" ]

 | rsort }}

]]></ac:plain-text-body></ac:structured-macro>

Output

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="8002be28-0565-41df-a5ea-718c34323110"><ac:plain-text-body><![CDATA

[

[

c, b, a]

]]></ac:plain-text-body></ac:structured-macro>

Anchor
_slice
_slice
slice

The slice filter returns a portion of a list, array, or string. The indexing starts at 0.

Example

{{ "This is a sentence"

 | slice(5, 9) }}

Output

is a


Example 2

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="a936bb9d-09e2-47eb-ac1e-3202d48927d2"><ac:plain-text-body><![CDATA[

{{ [ "b", "a", "c" ]

 | slice(1, 2) }}

]]></ac:plain-text-body></ac:structured-macro>

Output

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="b020d844-887e-4e51-9034-3c5e0deb5c3b"><ac:plain-text-body><!

[

CDATA[[

a[

]]></ac:plain-text-body></ac:structured-macro>

Anchor
_sort
_sort
sort

The sort filter will sort a list. The items of the list must implement Comparable.

Example

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="8e6f2e5b-5a3b-43a5-999c-96f01dcfae50"><ac:plain-text-body><![CDATA[

{{ [ "b", "a", "c" ]

 | sort }}

]]></ac:plain-text-body></ac:structured-macro>

Output

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="3078942e-332b-4440-b473-2731db9ea634"><ac:plain-text-body><!

[

CDATA[[

a, b, c[

]]></ac:plain-text-body></ac:structured-macro>

Anchor
_title
_title
title

The title filter will capitalize the first letter of each word.

Example

{{ "This is a sentence"

 | title }}

Output

This Is A Sentence

Anchor
_trim
_trim
trim

The trim filter is used to trim whitespace off the beginning and end of a string.

Example

{{ " Some letters "

 | trim }}

Output

Some letters

Anchor
_upper
_upper
upper

The upper filter makes an entire string upper case.

Example

{{ "this is a sentence"

 | upper }}

Output

THIS IS A SENTENCE

Anchor
_urlencode
_urlencode
urlencode

The urlencode filter translates a string into application/x-www-form-urlencoded format using the UTF-8 encoding scheme.

Example

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="73638139-281a-4806-a249-9e6b819fde13"><ac:plain-text-body><![CDATA[

{{ "list=[a,b,c]"

 | urlencode }}

]]></ac:plain-text-body></ac:structured-macro>

Output

list%3D%5Ba%2Cb%2Cc%5D

Anchor
_lines
_lines
lines

The lines filter will split a string by its line breaks with each line becoming an element in a list.

Example

{%- set aStr = "Something
Is
On
Lots
Of
Lines" -%}
{{ aStr

 | lines }}

Output

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="c292b5b4-af16-4b7a-b414-bf3d26b6b716"><ac:plain-text-body><![CDATA[

[Something, Is, On, Lots, Of, Lines]

]]></ac:plain-text-body></ac:structured-macro>