-
-
Notifications
You must be signed in to change notification settings - Fork 78
/
filters.txt
61 lines (61 loc) · 1.84 KB
/
filters.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
word: "Bird"
word_with_spaces: " Spacebird\n"
list: [1, 2, 3]
map:
a: b
c: d
scary_html: "<>&'"
---
lower: {{ word|lower }}
upper: {{ word|upper }}
title: {{ word|title }}
title-sentence: {{ "the bIrd, is The:word"|title }}
replace: {{ word|replace("B", "th") }}
escape: {{ "<"|escape }}
e: {{ "<"|e }}
double-escape: {{ "<"|escape|escape }}
safe: {{ "<"|safe|escape }}
list-length: {{ list|length }}
list-from-list: {{ list|list }}
list-from-map: {{ map|list }}
list-from-word: {{ word|list }}
list-from-undefined: {{ undefined|list }}
bool-empty-string: {{ ""|bool }}
bool-non-empty-string: {{ "hello"|bool }}
bool-empty-list: {{ []|bool }}
bool-non-empty-list: {{ [42]|bool }}
bool-undefined: {{ undefined|bool }}
map-length: {{ map|length }}
string-length: {{ word|length }}
string-count: {{ word|count }}
reverse-list: {{ list|reverse }}
reverse-string: {{ word|reverse }}
trim: |{{ word_with_spaces|trim }}|
trim-bird: {{ word|trim("Bd") }}
join-default: {{ list|join }}
join-pipe: {{ list|join("|") }}
join_string: {{ word|join('-') }}
default: {{ undefined|default == "" }}
default-value: {{ undefined|default(42) }}
first-list: {{ list|first }}
first-word: {{ word|first }}
first-undefined: {{ []|first is undefined }}
last-list: {{ list|last }}
last-word: {{ word|last }}
last-undefined: {{ []|first is undefined }}
d: {{ undefined|d == "" }}
json: {{ map|tojson }}
json-pretty: {{ map|tojson(true) }}
json-scary-html: {{ scary_html|tojson }}
urlencode: {{ "hello world/baz.txt"|urlencode }}
urlencode-kv: {{ dict(a="x y", b=2, c=3)|urlencode }}
batch: {{ range(10)|batch(3) }}
batch-fill: {{ range(10)|batch(3, '-') }}
slice: {{ range(10)|slice(3) }}
slice-fill: {{ range(10)|slice(3, '-') }}
items: {{ dict(a=1)|items }}
int-abs: {{ -42|abs }}
float-abs: {{ -42.5|abs }}
int-round: {{ 42|round }}
float-round: {{ 42.5|round }}
float-round-prec2: {{ 42.512345|round(2) }}