asciisourcerer 0.3.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/BILL_OF_MATERIALS.adoc +17 -0
- data/README.adoc +107 -26
- data/lib/sourcerer/_docs/partials/liquid-filters-by-kind.adoc +3227 -0
- data/lib/sourcerer/_docs/partials/liquid-filters-by-source.adoc +3155 -0
- data/lib/sourcerer/asciidoc.rb +52 -10
- data/lib/sourcerer/builder.rb +1 -1
- data/lib/sourcerer/jekyll/bootstrapper.rb +1 -1
- data/lib/sourcerer/jekyll/liquid/filters.rb +295 -0
- data/lib/sourcerer/jekyll.rb +7 -2
- data/lib/sourcerer/mark_down_grade.rb +321 -33
- data/lib/sourcerer/rendering.rb +10 -4
- data/lib/sourcerer/source_skim/config.rb +8 -2
- data/lib/sourcerer/source_skim/ruby_skimmer.rb +83 -0
- data/lib/sourcerer/source_skim/skimmer.rb +94 -1
- data/lib/sourcerer/source_skim.rb +11 -2
- data/lib/sourcerer/util/gem_uri.rb +34 -0
- data/lib/sourcerer/version.rb +1 -1
- data/lib/sourcerer.rb +0 -1
- data/specs/data/liquid-filters.yml +1314 -0
- metadata +22 -3
- data/specs/docs/frontmatter-reader_prd.adoc +0 -47
|
@@ -0,0 +1,3155 @@
|
|
|
1
|
+
|
|
2
|
+
:example-capition!:
|
|
3
|
+
|
|
4
|
+
[[jekyll]]
|
|
5
|
+
== Filters from Jekyll
|
|
6
|
+
|
|
7
|
+
// tag::jekyll[]
|
|
8
|
+
[[filter__date_to_xml_schema,Date to XML Schema]]
|
|
9
|
+
Date to XML Schema (`date_to_xml_schema`)::
|
|
10
|
+
+
|
|
11
|
+
--
|
|
12
|
+
Convert a Date into XML Schema (ISO 8601) format.
|
|
13
|
+
|
|
14
|
+
[horizontal]
|
|
15
|
+
Category::: Date Formatting
|
|
16
|
+
|
|
17
|
+
[vertical]
|
|
18
|
+
Examples:::
|
|
19
|
+
+
|
|
20
|
+
====
|
|
21
|
+
.Input
|
|
22
|
+
[source,liquid]
|
|
23
|
+
----
|
|
24
|
+
{{ "2008-11-07 1:07:54pm" | date_to_xmlschema }}
|
|
25
|
+
----
|
|
26
|
+
|
|
27
|
+
.Output
|
|
28
|
+
[source,liquid]
|
|
29
|
+
----
|
|
30
|
+
2008-11-07T13:07:54-08:00
|
|
31
|
+
----
|
|
32
|
+
====
|
|
33
|
+
--
|
|
34
|
+
[[filter__date_to_rfc822,Date to RFC-822 Format]]
|
|
35
|
+
Date to RFC-822 Format (`date_to_rfc822`)::
|
|
36
|
+
+
|
|
37
|
+
--
|
|
38
|
+
Convert a Date into the RFC-822 format used for RSS feeds.
|
|
39
|
+
|
|
40
|
+
[horizontal]
|
|
41
|
+
Category::: Date Formatting
|
|
42
|
+
|
|
43
|
+
[vertical]
|
|
44
|
+
Examples:::
|
|
45
|
+
+
|
|
46
|
+
====
|
|
47
|
+
.Input
|
|
48
|
+
[source,liquid]
|
|
49
|
+
----
|
|
50
|
+
{{ data.time | date_to_rfc822 }}
|
|
51
|
+
----
|
|
52
|
+
|
|
53
|
+
.Output
|
|
54
|
+
[source,liquid]
|
|
55
|
+
----
|
|
56
|
+
Fri, 07 Nov 2008 13:07:54 -0800
|
|
57
|
+
----
|
|
58
|
+
====
|
|
59
|
+
--
|
|
60
|
+
[[filter__date_to_string,Date to String]]
|
|
61
|
+
Date to String (`date_to_string`)::
|
|
62
|
+
+
|
|
63
|
+
--
|
|
64
|
+
Convert a date to short format.
|
|
65
|
+
|
|
66
|
+
[horizontal]
|
|
67
|
+
Category::: Date Formatting
|
|
68
|
+
|
|
69
|
+
[vertical]
|
|
70
|
+
Examples:::
|
|
71
|
+
+
|
|
72
|
+
====
|
|
73
|
+
.Input
|
|
74
|
+
[source,liquid]
|
|
75
|
+
----
|
|
76
|
+
{{ data.time | date_to_string }}
|
|
77
|
+
----
|
|
78
|
+
|
|
79
|
+
.Output
|
|
80
|
+
[source,liquid]
|
|
81
|
+
----
|
|
82
|
+
07 Nov 2008
|
|
83
|
+
----
|
|
84
|
+
====
|
|
85
|
+
+
|
|
86
|
+
====
|
|
87
|
+
.Input
|
|
88
|
+
[source,liquid]
|
|
89
|
+
----
|
|
90
|
+
{{ data.time | date_to_string: "ordinal", "US" }}
|
|
91
|
+
----
|
|
92
|
+
|
|
93
|
+
.Output
|
|
94
|
+
[source,liquid]
|
|
95
|
+
----
|
|
96
|
+
Nov 7th, 2008
|
|
97
|
+
----
|
|
98
|
+
====
|
|
99
|
+
--
|
|
100
|
+
[[filter__date_to_long_string,Date to Long String]]
|
|
101
|
+
Date to Long String (`date_to_long_string`)::
|
|
102
|
+
+
|
|
103
|
+
--
|
|
104
|
+
Format a date to long format.
|
|
105
|
+
|
|
106
|
+
[horizontal]
|
|
107
|
+
Category::: Date Formatting
|
|
108
|
+
|
|
109
|
+
[vertical]
|
|
110
|
+
Examples:::
|
|
111
|
+
+
|
|
112
|
+
====
|
|
113
|
+
.Input
|
|
114
|
+
[source,liquid]
|
|
115
|
+
----
|
|
116
|
+
{{ data.time | date_to_long_string }}
|
|
117
|
+
----
|
|
118
|
+
|
|
119
|
+
.Output
|
|
120
|
+
[source,liquid]
|
|
121
|
+
----
|
|
122
|
+
07 November 2008
|
|
123
|
+
----
|
|
124
|
+
====
|
|
125
|
+
+
|
|
126
|
+
====
|
|
127
|
+
.Input
|
|
128
|
+
[source,liquid]
|
|
129
|
+
----
|
|
130
|
+
{{ data.time | date_to_long_string: "ordinal" }}
|
|
131
|
+
----
|
|
132
|
+
|
|
133
|
+
.Output
|
|
134
|
+
[source,liquid]
|
|
135
|
+
----
|
|
136
|
+
7th November 2008
|
|
137
|
+
----
|
|
138
|
+
====
|
|
139
|
+
--
|
|
140
|
+
[[filter__where,Where]]
|
|
141
|
+
Where (`where`)::
|
|
142
|
+
+
|
|
143
|
+
--
|
|
144
|
+
Select all the objects in an array where the key has the given value.
|
|
145
|
+
|
|
146
|
+
[horizontal]
|
|
147
|
+
Category::: Array Selection
|
|
148
|
+
|
|
149
|
+
[vertical]
|
|
150
|
+
Examples:::
|
|
151
|
+
+
|
|
152
|
+
====
|
|
153
|
+
.Input
|
|
154
|
+
[source,liquid]
|
|
155
|
+
----
|
|
156
|
+
{% assign filtered = data.users | where:"level", 2 %}
|
|
157
|
+
{{ filtered | size }}
|
|
158
|
+
|
|
159
|
+
----
|
|
160
|
+
|
|
161
|
+
.Output
|
|
162
|
+
[source,liquid]
|
|
163
|
+
----
|
|
164
|
+
1
|
|
165
|
+
----
|
|
166
|
+
====
|
|
167
|
+
+
|
|
168
|
+
====
|
|
169
|
+
.Input
|
|
170
|
+
[source,liquid]
|
|
171
|
+
----
|
|
172
|
+
{% assign member = data.users | where:"user","alice" %}
|
|
173
|
+
{{ member[0] | jsonify }}
|
|
174
|
+
|
|
175
|
+
----
|
|
176
|
+
|
|
177
|
+
.Output
|
|
178
|
+
[source,liquid]
|
|
179
|
+
----
|
|
180
|
+
{"user":"alice","level":1}
|
|
181
|
+
----
|
|
182
|
+
====
|
|
183
|
+
--
|
|
184
|
+
[[filter__where_exp,Where Expression]]
|
|
185
|
+
Where Expression (`where_exp`)::
|
|
186
|
+
+
|
|
187
|
+
--
|
|
188
|
+
Select all the objects in an array where the expression is true.
|
|
189
|
+
|
|
190
|
+
[horizontal]
|
|
191
|
+
Category::: Array Selection
|
|
192
|
+
|
|
193
|
+
[vertical]
|
|
194
|
+
Examples:::
|
|
195
|
+
+
|
|
196
|
+
====
|
|
197
|
+
.Input
|
|
198
|
+
[source,liquid]
|
|
199
|
+
----
|
|
200
|
+
{{ data.members | where_exp:"item",
|
|
201
|
+
"item.grad_year == 2014" | jsonify }}
|
|
202
|
+
|
|
203
|
+
----
|
|
204
|
+
|
|
205
|
+
.Output
|
|
206
|
+
[source,liquid]
|
|
207
|
+
----
|
|
208
|
+
[{"user":"andie","grad_year":2014,"projects":["fooman","barbaz"]},{"user":"lonnie","grad_year":2014,"projects":["fooman"]}]
|
|
209
|
+
----
|
|
210
|
+
====
|
|
211
|
+
+
|
|
212
|
+
====
|
|
213
|
+
.Input
|
|
214
|
+
[source,liquid]
|
|
215
|
+
----
|
|
216
|
+
{{ data.members | where_exp:"item",
|
|
217
|
+
"item.grad_year < 2014" | jsonify }}
|
|
218
|
+
|
|
219
|
+
----
|
|
220
|
+
|
|
221
|
+
.Output
|
|
222
|
+
[source,liquid]
|
|
223
|
+
----
|
|
224
|
+
[{"user":"cindy","grad_year":2012,"projects":["fooman","foobar"]}]
|
|
225
|
+
----
|
|
226
|
+
====
|
|
227
|
+
+
|
|
228
|
+
====
|
|
229
|
+
.Input
|
|
230
|
+
[source,liquid]
|
|
231
|
+
----
|
|
232
|
+
{{ data.members | where_exp:"item",
|
|
233
|
+
"item.projects contains 'barbaz'" | jsonify }}
|
|
234
|
+
|
|
235
|
+
----
|
|
236
|
+
|
|
237
|
+
.Output
|
|
238
|
+
[source,liquid]
|
|
239
|
+
----
|
|
240
|
+
[{"user":"andie","grad_year":2014,"projects":["fooman","barbaz"]}]
|
|
241
|
+
----
|
|
242
|
+
====
|
|
243
|
+
--
|
|
244
|
+
[[filter__group_by,Group By]]
|
|
245
|
+
Group By (`group_by`)::
|
|
246
|
+
+
|
|
247
|
+
--
|
|
248
|
+
Group an array's items by a given property.
|
|
249
|
+
|
|
250
|
+
[horizontal]
|
|
251
|
+
Category::: Array Organizing
|
|
252
|
+
|
|
253
|
+
[vertical]
|
|
254
|
+
Examples:::
|
|
255
|
+
+
|
|
256
|
+
====
|
|
257
|
+
.Input
|
|
258
|
+
[source,liquid]
|
|
259
|
+
----
|
|
260
|
+
{% assign grouped = data.members | group_by:"grad_year" | first %}
|
|
261
|
+
{{ grouped.name }}
|
|
262
|
+
|
|
263
|
+
----
|
|
264
|
+
|
|
265
|
+
.Output
|
|
266
|
+
[source,liquid]
|
|
267
|
+
----
|
|
268
|
+
2014
|
|
269
|
+
----
|
|
270
|
+
====
|
|
271
|
+
--
|
|
272
|
+
[[filter__group_by_exp,Group By Expression]]
|
|
273
|
+
Group By Expression (`group_by_exp`)::
|
|
274
|
+
+
|
|
275
|
+
--
|
|
276
|
+
Group an array's items using a Liquid expression.
|
|
277
|
+
|
|
278
|
+
[horizontal]
|
|
279
|
+
Category::: Array Organizing
|
|
280
|
+
|
|
281
|
+
[vertical]
|
|
282
|
+
Examples:::
|
|
283
|
+
+
|
|
284
|
+
====
|
|
285
|
+
.Input
|
|
286
|
+
[source,liquid]
|
|
287
|
+
----
|
|
288
|
+
{{ data.members | group_by_exp: "item", "item.grad_year" | map: "name" | join: "," }}
|
|
289
|
+
----
|
|
290
|
+
|
|
291
|
+
.Output
|
|
292
|
+
[source,liquid]
|
|
293
|
+
----
|
|
294
|
+
2014,2012
|
|
295
|
+
----
|
|
296
|
+
====
|
|
297
|
+
--
|
|
298
|
+
[[filter__xml_escape,XML Escape]]
|
|
299
|
+
XML Escape (`xml_escape`)::
|
|
300
|
+
+
|
|
301
|
+
--
|
|
302
|
+
Escape some text for use in XML.
|
|
303
|
+
|
|
304
|
+
[horizontal]
|
|
305
|
+
Category::: String Escaping
|
|
306
|
+
|
|
307
|
+
[vertical]
|
|
308
|
+
Examples:::
|
|
309
|
+
+
|
|
310
|
+
====
|
|
311
|
+
.Input
|
|
312
|
+
[source,liquid]
|
|
313
|
+
----
|
|
314
|
+
{{ "<strong>some text</strong>" | xml_escape }}
|
|
315
|
+
----
|
|
316
|
+
|
|
317
|
+
.Output
|
|
318
|
+
[source,liquid]
|
|
319
|
+
----
|
|
320
|
+
<strong>some text</strong>
|
|
321
|
+
----
|
|
322
|
+
====
|
|
323
|
+
--
|
|
324
|
+
[[filter__cgi_escape,CGI Escape]]
|
|
325
|
+
CGI Escape (`cgi_escape`)::
|
|
326
|
+
+
|
|
327
|
+
--
|
|
328
|
+
CGI escape a string for use in a URL.
|
|
329
|
+
Replaces any special characters with appropriate `%XX` replacements.
|
|
330
|
+
CGI escape normally replaces a space with a plus `+` sign.
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
[horizontal]
|
|
334
|
+
Category::: String Escaping
|
|
335
|
+
|
|
336
|
+
[vertical]
|
|
337
|
+
Examples:::
|
|
338
|
+
+
|
|
339
|
+
====
|
|
340
|
+
.Input
|
|
341
|
+
[source,liquid]
|
|
342
|
+
----
|
|
343
|
+
{{ "foo, bar; baz?" | cgi_escape }}
|
|
344
|
+
----
|
|
345
|
+
|
|
346
|
+
.Output
|
|
347
|
+
[source,liquid]
|
|
348
|
+
----
|
|
349
|
+
foo%2C+bar%3B+baz%3F
|
|
350
|
+
----
|
|
351
|
+
====
|
|
352
|
+
--
|
|
353
|
+
[[filter__uri_escape,URI Escape]]
|
|
354
|
+
URI Escape (`uri_escape`)::
|
|
355
|
+
+
|
|
356
|
+
--
|
|
357
|
+
Percent encodes any special characters in a URI.
|
|
358
|
+
URI escape normally replaces a space with `%20`.
|
|
359
|
+
link:https://en.wikipedia.org/wiki/Percent-encoding#Types_of_URI_characters[Reserved characters]
|
|
360
|
+
will not be escaped.
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
[horizontal]
|
|
364
|
+
Category::: String Escaping
|
|
365
|
+
|
|
366
|
+
[vertical]
|
|
367
|
+
Examples:::
|
|
368
|
+
+
|
|
369
|
+
====
|
|
370
|
+
.Input
|
|
371
|
+
[source,liquid]
|
|
372
|
+
----
|
|
373
|
+
{{ "http://foo.com/?q=foo, \bar?" | uri_escape }}
|
|
374
|
+
----
|
|
375
|
+
|
|
376
|
+
.Output
|
|
377
|
+
[source,liquid]
|
|
378
|
+
----
|
|
379
|
+
http://foo.com/?q=foo,%20%5Cbar?
|
|
380
|
+
----
|
|
381
|
+
====
|
|
382
|
+
--
|
|
383
|
+
[[filter__number_of_words,Number of Words]]
|
|
384
|
+
Number of Words (`number_of_words`)::
|
|
385
|
+
+
|
|
386
|
+
--
|
|
387
|
+
Count the number of words in a text.
|
|
388
|
+
|
|
389
|
+
[horizontal]
|
|
390
|
+
Category::: String Analysis
|
|
391
|
+
|
|
392
|
+
[vertical]
|
|
393
|
+
Examples:::
|
|
394
|
+
+
|
|
395
|
+
====
|
|
396
|
+
.Input
|
|
397
|
+
[source,liquid]
|
|
398
|
+
----
|
|
399
|
+
{{ page.content | number_of_words }}
|
|
400
|
+
----
|
|
401
|
+
|
|
402
|
+
.Output
|
|
403
|
+
[source,liquid]
|
|
404
|
+
----
|
|
405
|
+
3
|
|
406
|
+
----
|
|
407
|
+
====
|
|
408
|
+
--
|
|
409
|
+
[[filter__array_to_sentence_string,Array to Sentence]]
|
|
410
|
+
Array to Sentence (`array_to_sentence_string`)::
|
|
411
|
+
+
|
|
412
|
+
--
|
|
413
|
+
Convert an array into a sentence. Useful for listing tags.
|
|
414
|
+
Optional argument for connector.
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
[horizontal]
|
|
418
|
+
Category::: Object Conversion
|
|
419
|
+
|
|
420
|
+
[vertical]
|
|
421
|
+
Examples:::
|
|
422
|
+
+
|
|
423
|
+
====
|
|
424
|
+
.Input
|
|
425
|
+
[source,liquid]
|
|
426
|
+
----
|
|
427
|
+
{{ tags_array | array_to_sentence_string }}
|
|
428
|
+
----
|
|
429
|
+
|
|
430
|
+
.Output
|
|
431
|
+
[source,liquid]
|
|
432
|
+
----
|
|
433
|
+
foo, bar, and baz
|
|
434
|
+
----
|
|
435
|
+
====
|
|
436
|
+
+
|
|
437
|
+
====
|
|
438
|
+
.Input
|
|
439
|
+
[source,liquid]
|
|
440
|
+
----
|
|
441
|
+
{{ tags_array | array_to_sentence_string: "or" }}
|
|
442
|
+
----
|
|
443
|
+
|
|
444
|
+
.Output
|
|
445
|
+
[source,liquid]
|
|
446
|
+
----
|
|
447
|
+
foo, bar, or baz
|
|
448
|
+
----
|
|
449
|
+
====
|
|
450
|
+
--
|
|
451
|
+
[[filter__jsonify,Data To JSON]]
|
|
452
|
+
Data To JSON (`jsonify`)::
|
|
453
|
+
+
|
|
454
|
+
--
|
|
455
|
+
Convert Hash or Array to JSON.
|
|
456
|
+
|
|
457
|
+
[horizontal]
|
|
458
|
+
Category::: Object Conversion
|
|
459
|
+
|
|
460
|
+
[vertical]
|
|
461
|
+
Examples:::
|
|
462
|
+
+
|
|
463
|
+
====
|
|
464
|
+
.Input
|
|
465
|
+
[source,liquid]
|
|
466
|
+
----
|
|
467
|
+
{{ tags_array | jsonify }}
|
|
468
|
+
----
|
|
469
|
+
|
|
470
|
+
.Output
|
|
471
|
+
[source,liquid]
|
|
472
|
+
----
|
|
473
|
+
["foo","bar","baz"]
|
|
474
|
+
----
|
|
475
|
+
====
|
|
476
|
+
--
|
|
477
|
+
[[filter__normalize_whitespace,Normalize Whitespace]]
|
|
478
|
+
Normalize Whitespace (`normalize_whitespace`)::
|
|
479
|
+
+
|
|
480
|
+
--
|
|
481
|
+
Replace any occurrence of whitespace with a single space.
|
|
482
|
+
|
|
483
|
+
[horizontal]
|
|
484
|
+
Category::: String Conversion
|
|
485
|
+
|
|
486
|
+
[vertical]
|
|
487
|
+
Examples:::
|
|
488
|
+
+
|
|
489
|
+
====
|
|
490
|
+
.Input
|
|
491
|
+
[source,liquid]
|
|
492
|
+
----
|
|
493
|
+
{{ "a b" | normalize_whitespace }}
|
|
494
|
+
----
|
|
495
|
+
|
|
496
|
+
.Output
|
|
497
|
+
[source,liquid]
|
|
498
|
+
----
|
|
499
|
+
a b
|
|
500
|
+
----
|
|
501
|
+
====
|
|
502
|
+
--
|
|
503
|
+
[[filter__sort,Sort]]
|
|
504
|
+
Sort (`sort`)::
|
|
505
|
+
+
|
|
506
|
+
--
|
|
507
|
+
Sort an array. Optional arguments for hashes
|
|
508
|
+
1. property name
|
|
509
|
+
2. nils order (_first_ or _last_).
|
|
510
|
+
|
|
511
|
+
|
|
512
|
+
[horizontal]
|
|
513
|
+
Category::: Array Organizing
|
|
514
|
+
|
|
515
|
+
[vertical]
|
|
516
|
+
Examples:::
|
|
517
|
+
+
|
|
518
|
+
====
|
|
519
|
+
.Input
|
|
520
|
+
[source,liquid]
|
|
521
|
+
----
|
|
522
|
+
{{ page.tags | sort | inspect }}
|
|
523
|
+
----
|
|
524
|
+
|
|
525
|
+
.Output
|
|
526
|
+
[source,liquid]
|
|
527
|
+
----
|
|
528
|
+
["Seattle", "Spokane", "Tacoma"]
|
|
529
|
+
----
|
|
530
|
+
====
|
|
531
|
+
+
|
|
532
|
+
====
|
|
533
|
+
.Input
|
|
534
|
+
[source,liquid]
|
|
535
|
+
----
|
|
536
|
+
{{ site.posts | sort: "author" }}
|
|
537
|
+
----
|
|
538
|
+
====
|
|
539
|
+
+
|
|
540
|
+
====
|
|
541
|
+
.Input
|
|
542
|
+
[source,liquid]
|
|
543
|
+
----
|
|
544
|
+
{{ site.pages | sort: "title", "last" }}
|
|
545
|
+
----
|
|
546
|
+
====
|
|
547
|
+
--
|
|
548
|
+
[[filter__sample,Sample]]
|
|
549
|
+
Sample (`sample`)::
|
|
550
|
+
+
|
|
551
|
+
--
|
|
552
|
+
Pick a random value from an array. Optionally, pick multiple values.
|
|
553
|
+
|
|
554
|
+
[horizontal]
|
|
555
|
+
Category::: Array Selection
|
|
556
|
+
|
|
557
|
+
[vertical]
|
|
558
|
+
Examples:::
|
|
559
|
+
+
|
|
560
|
+
====
|
|
561
|
+
.Input
|
|
562
|
+
[source,liquid]
|
|
563
|
+
----
|
|
564
|
+
{{ site.pages | sample }}
|
|
565
|
+
----
|
|
566
|
+
====
|
|
567
|
+
+
|
|
568
|
+
====
|
|
569
|
+
.Input
|
|
570
|
+
[source,liquid]
|
|
571
|
+
----
|
|
572
|
+
{{ site.pages | sample: 2 }}
|
|
573
|
+
----
|
|
574
|
+
====
|
|
575
|
+
--
|
|
576
|
+
[[filter__to_integer,To Integer]]
|
|
577
|
+
To Integer (`to_integer`)::
|
|
578
|
+
+
|
|
579
|
+
--
|
|
580
|
+
Convert a string or boolean to integer.
|
|
581
|
+
|
|
582
|
+
[horizontal]
|
|
583
|
+
Category::: Object Conversion
|
|
584
|
+
|
|
585
|
+
[vertical]
|
|
586
|
+
Examples:::
|
|
587
|
+
+
|
|
588
|
+
====
|
|
589
|
+
.Input
|
|
590
|
+
[source,liquid]
|
|
591
|
+
----
|
|
592
|
+
{{ true | to_integer }}
|
|
593
|
+
----
|
|
594
|
+
|
|
595
|
+
.Output
|
|
596
|
+
[source,liquid]
|
|
597
|
+
----
|
|
598
|
+
1
|
|
599
|
+
----
|
|
600
|
+
====
|
|
601
|
+
+
|
|
602
|
+
====
|
|
603
|
+
.Input
|
|
604
|
+
[source,liquid]
|
|
605
|
+
----
|
|
606
|
+
{% assign five = "5" | to_integer %}
|
|
607
|
+
{% if five == 5 %}Samesies!{% endif %}
|
|
608
|
+
|
|
609
|
+
----
|
|
610
|
+
|
|
611
|
+
.Output
|
|
612
|
+
[source,liquid]
|
|
613
|
+
----
|
|
614
|
+
Samesies!
|
|
615
|
+
----
|
|
616
|
+
====
|
|
617
|
+
+
|
|
618
|
+
====
|
|
619
|
+
.Input
|
|
620
|
+
[source,liquid]
|
|
621
|
+
----
|
|
622
|
+
{{ "five" | to_integer }}
|
|
623
|
+
----
|
|
624
|
+
|
|
625
|
+
.Output
|
|
626
|
+
[source,liquid]
|
|
627
|
+
----
|
|
628
|
+
0
|
|
629
|
+
----
|
|
630
|
+
====
|
|
631
|
+
--
|
|
632
|
+
[[filter__push,Push]]
|
|
633
|
+
Push (`push`)::
|
|
634
|
+
+
|
|
635
|
+
--
|
|
636
|
+
Insert an item at the end of an array
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
[horizontal]
|
|
640
|
+
Category::: Array Management
|
|
641
|
+
|
|
642
|
+
[vertical]
|
|
643
|
+
Examples:::
|
|
644
|
+
+
|
|
645
|
+
====
|
|
646
|
+
.Input
|
|
647
|
+
[source,liquid]
|
|
648
|
+
----
|
|
649
|
+
{{ page.tags | push: "Spokane" | inspect }}
|
|
650
|
+
----
|
|
651
|
+
|
|
652
|
+
.Output
|
|
653
|
+
[source,liquid]
|
|
654
|
+
----
|
|
655
|
+
["Seattle", "Tacoma", "Spokane", "Spokane"]
|
|
656
|
+
----
|
|
657
|
+
====
|
|
658
|
+
--
|
|
659
|
+
[[filter__pop,Pop]]
|
|
660
|
+
Pop (`pop`)::
|
|
661
|
+
+
|
|
662
|
+
--
|
|
663
|
+
Remove an item from the end of an array
|
|
664
|
+
|
|
665
|
+
|
|
666
|
+
[horizontal]
|
|
667
|
+
Category::: Array Management
|
|
668
|
+
|
|
669
|
+
[vertical]
|
|
670
|
+
Examples:::
|
|
671
|
+
+
|
|
672
|
+
====
|
|
673
|
+
.Input
|
|
674
|
+
[source,liquid]
|
|
675
|
+
----
|
|
676
|
+
{{ page.tags | pop | inspect }}
|
|
677
|
+
----
|
|
678
|
+
|
|
679
|
+
.Output
|
|
680
|
+
[source,liquid]
|
|
681
|
+
----
|
|
682
|
+
["Seattle", "Tacoma"]
|
|
683
|
+
----
|
|
684
|
+
====
|
|
685
|
+
--
|
|
686
|
+
[[filter__shift,Shift]]
|
|
687
|
+
Shift (`shift`)::
|
|
688
|
+
+
|
|
689
|
+
--
|
|
690
|
+
Remove an item from the beginning of an array
|
|
691
|
+
|
|
692
|
+
|
|
693
|
+
[horizontal]
|
|
694
|
+
Category::: Array Management
|
|
695
|
+
|
|
696
|
+
[vertical]
|
|
697
|
+
Examples:::
|
|
698
|
+
+
|
|
699
|
+
====
|
|
700
|
+
.Input
|
|
701
|
+
[source,liquid]
|
|
702
|
+
----
|
|
703
|
+
{{ page.tags | shift | inspect }}
|
|
704
|
+
----
|
|
705
|
+
|
|
706
|
+
.Output
|
|
707
|
+
[source,liquid]
|
|
708
|
+
----
|
|
709
|
+
["Tacoma", "Spokane"]
|
|
710
|
+
----
|
|
711
|
+
====
|
|
712
|
+
--
|
|
713
|
+
[[filter__unshift,Unshift]]
|
|
714
|
+
Unshift (`unshift`)::
|
|
715
|
+
+
|
|
716
|
+
--
|
|
717
|
+
Insert an item at the beginning of an array
|
|
718
|
+
|
|
719
|
+
|
|
720
|
+
[horizontal]
|
|
721
|
+
Category::: Array Management
|
|
722
|
+
|
|
723
|
+
[vertical]
|
|
724
|
+
Examples:::
|
|
725
|
+
+
|
|
726
|
+
====
|
|
727
|
+
.Input
|
|
728
|
+
[source,liquid]
|
|
729
|
+
----
|
|
730
|
+
{{ page.tags | unshift: "Olympia" | inspect }}
|
|
731
|
+
----
|
|
732
|
+
|
|
733
|
+
.Output
|
|
734
|
+
[source,liquid]
|
|
735
|
+
----
|
|
736
|
+
["Olympia", "Seattle", "Tacoma", "Spokane"]
|
|
737
|
+
----
|
|
738
|
+
====
|
|
739
|
+
--
|
|
740
|
+
[[filter__relative_url,Relative URL]]
|
|
741
|
+
Relative URL (`relative_url`)::
|
|
742
|
+
+
|
|
743
|
+
--
|
|
744
|
+
Prepend `baseurl` config value to the input to convert a URL path into a relative URL.
|
|
745
|
+
This is recommended for a site that is hosted on a subpath of a domain.
|
|
746
|
+
|
|
747
|
+
NOTE: Requires registration of a `site.baseurl` object outside `jekyll build` contexts.
|
|
748
|
+
|
|
749
|
+
|
|
750
|
+
[horizontal]
|
|
751
|
+
Category::: String Conversion
|
|
752
|
+
|
|
753
|
+
[vertical]
|
|
754
|
+
Examples:::
|
|
755
|
+
+
|
|
756
|
+
====
|
|
757
|
+
.Input
|
|
758
|
+
[source,liquid]
|
|
759
|
+
----
|
|
760
|
+
{{ "test-path" | relative_url }}
|
|
761
|
+
----
|
|
762
|
+
|
|
763
|
+
.Output
|
|
764
|
+
[source,liquid]
|
|
765
|
+
----
|
|
766
|
+
/docs/test-path
|
|
767
|
+
----
|
|
768
|
+
====
|
|
769
|
+
--
|
|
770
|
+
[[filter__absolute_url,Absolute URL]]
|
|
771
|
+
Absolute URL (`absolute_url`)::
|
|
772
|
+
+
|
|
773
|
+
--
|
|
774
|
+
Prepend `url` and `baseurl` values to the input to convert a URL path to an absolute URL.
|
|
775
|
+
|
|
776
|
+
NOTE: Requires registration of `site.baseurl` and `site.url` objects outside `jekyll build` contexts.
|
|
777
|
+
|
|
778
|
+
|
|
779
|
+
[horizontal]
|
|
780
|
+
Category::: String Conversion
|
|
781
|
+
|
|
782
|
+
[vertical]
|
|
783
|
+
Examples:::
|
|
784
|
+
+
|
|
785
|
+
====
|
|
786
|
+
.Input
|
|
787
|
+
[source,liquid]
|
|
788
|
+
----
|
|
789
|
+
{{ "test-path" | absolute_url }}
|
|
790
|
+
----
|
|
791
|
+
|
|
792
|
+
.Output
|
|
793
|
+
[source,liquid]
|
|
794
|
+
----
|
|
795
|
+
https://example.com/docs/test-path
|
|
796
|
+
----
|
|
797
|
+
====
|
|
798
|
+
--
|
|
799
|
+
[[filter__markdownify,Markdownify]]
|
|
800
|
+
Markdownify (`markdownify`)::
|
|
801
|
+
+
|
|
802
|
+
--
|
|
803
|
+
Converts a Markdown string to HTML.
|
|
804
|
+
|
|
805
|
+
[horizontal]
|
|
806
|
+
Category::: String Conversion
|
|
807
|
+
|
|
808
|
+
[vertical]
|
|
809
|
+
Examples:::
|
|
810
|
+
+
|
|
811
|
+
====
|
|
812
|
+
.Input
|
|
813
|
+
[source,liquid]
|
|
814
|
+
----
|
|
815
|
+
{{ "Test with **bold** and a [link](https://example.com)." | markdownify }}
|
|
816
|
+
----
|
|
817
|
+
|
|
818
|
+
.Output
|
|
819
|
+
[source,liquid]
|
|
820
|
+
----
|
|
821
|
+
<p>Test with <strong>bold</strong> and a <a href="https://example.com">link</a>.</p>
|
|
822
|
+
----
|
|
823
|
+
====
|
|
824
|
+
--
|
|
825
|
+
[[filter__smartify,Smartify]]
|
|
826
|
+
Smartify (`smartify`)::
|
|
827
|
+
+
|
|
828
|
+
--
|
|
829
|
+
Convert "quotes" into “smart quotes.”
|
|
830
|
+
|
|
831
|
+
[horizontal]
|
|
832
|
+
Category::: String Conversion
|
|
833
|
+
|
|
834
|
+
[vertical]
|
|
835
|
+
Examples:::
|
|
836
|
+
+
|
|
837
|
+
====
|
|
838
|
+
.Input
|
|
839
|
+
[source,liquid]
|
|
840
|
+
----
|
|
841
|
+
{{ 'He said, "Hello!"' | smartify }}
|
|
842
|
+
|
|
843
|
+
----
|
|
844
|
+
|
|
845
|
+
.Output
|
|
846
|
+
[source,liquid]
|
|
847
|
+
----
|
|
848
|
+
He said, “Hello!”
|
|
849
|
+
----
|
|
850
|
+
====
|
|
851
|
+
--
|
|
852
|
+
[[filter__sassify,Sassify]]
|
|
853
|
+
Sassify (`sassify`)::
|
|
854
|
+
+
|
|
855
|
+
--
|
|
856
|
+
Convert an indented-syntax Sass string into CSS.
|
|
857
|
+
|
|
858
|
+
[horizontal]
|
|
859
|
+
Category::: String Conversion
|
|
860
|
+
|
|
861
|
+
[vertical]
|
|
862
|
+
Examples:::
|
|
863
|
+
+
|
|
864
|
+
====
|
|
865
|
+
.Input
|
|
866
|
+
[source,liquid]
|
|
867
|
+
----
|
|
868
|
+
{{ sass_text | sassify }}
|
|
869
|
+
|
|
870
|
+
----
|
|
871
|
+
|
|
872
|
+
.Output
|
|
873
|
+
[source,liquid]
|
|
874
|
+
----
|
|
875
|
+
body {
|
|
876
|
+
color: red;
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
----
|
|
880
|
+
====
|
|
881
|
+
--
|
|
882
|
+
[[filter__scssify,Scssify]]
|
|
883
|
+
Scssify (`scssify`)::
|
|
884
|
+
+
|
|
885
|
+
--
|
|
886
|
+
Convert a SCSS-formatted (brace/semicolon syntax) string into CSS.
|
|
887
|
+
|
|
888
|
+
[horizontal]
|
|
889
|
+
Category::: String Conversion
|
|
890
|
+
|
|
891
|
+
[vertical]
|
|
892
|
+
Examples:::
|
|
893
|
+
+
|
|
894
|
+
====
|
|
895
|
+
.Input
|
|
896
|
+
[source,liquid]
|
|
897
|
+
----
|
|
898
|
+
{{ scss_text | scssify }}
|
|
899
|
+
|
|
900
|
+
----
|
|
901
|
+
|
|
902
|
+
.Output
|
|
903
|
+
[source,liquid]
|
|
904
|
+
----
|
|
905
|
+
body {
|
|
906
|
+
color: red;
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
----
|
|
910
|
+
====
|
|
911
|
+
--
|
|
912
|
+
// end::jekyll[]
|
|
913
|
+
|
|
914
|
+
:example-capition!:
|
|
915
|
+
|
|
916
|
+
[[asciisourcerer]]
|
|
917
|
+
== Filters from AsciiSourcerer
|
|
918
|
+
|
|
919
|
+
// tag::asciisourcerer[]
|
|
920
|
+
[[filter__slugify,Slugify]]
|
|
921
|
+
Slugify (`slugify`)::
|
|
922
|
+
+
|
|
923
|
+
--
|
|
924
|
+
Convert a string into a lowercase URL "slug".
|
|
925
|
+
|
|
926
|
+
NOTE: This is not the Jekyll version.
|
|
927
|
+
|
|
928
|
+
|
|
929
|
+
[horizontal]
|
|
930
|
+
Category::: String Conversion
|
|
931
|
+
|
|
932
|
+
[vertical]
|
|
933
|
+
Examples:::
|
|
934
|
+
+
|
|
935
|
+
====
|
|
936
|
+
.Input
|
|
937
|
+
[source,liquid]
|
|
938
|
+
----
|
|
939
|
+
{{ "The _config.yml file" | slugify }}
|
|
940
|
+
----
|
|
941
|
+
|
|
942
|
+
.Output
|
|
943
|
+
[source,liquid]
|
|
944
|
+
----
|
|
945
|
+
the-config-yml-file
|
|
946
|
+
----
|
|
947
|
+
====
|
|
948
|
+
+
|
|
949
|
+
====
|
|
950
|
+
.Input
|
|
951
|
+
[source,liquid]
|
|
952
|
+
----
|
|
953
|
+
{{ "The _config.yml file" | slugify: "_" }}
|
|
954
|
+
----
|
|
955
|
+
|
|
956
|
+
.Output
|
|
957
|
+
[source,liquid]
|
|
958
|
+
----
|
|
959
|
+
the_config_yml_file
|
|
960
|
+
----
|
|
961
|
+
====
|
|
962
|
+
--
|
|
963
|
+
[[filter__inspect,Inspect]]
|
|
964
|
+
Inspect (`inspect`)::
|
|
965
|
+
+
|
|
966
|
+
--
|
|
967
|
+
Convert an object into its String representation for debugging.
|
|
968
|
+
Overrides Jekyll's `inspect` filter, adding an optional `format` argument:
|
|
969
|
+
`html` (default) reproduces Jekyll's own behavior exactly (an HTML-escaped
|
|
970
|
+
`Object#inspect` string, quotes become `"`); `yaml` and `json` render
|
|
971
|
+
the object in those formats instead.
|
|
972
|
+
|
|
973
|
+
|
|
974
|
+
[horizontal]
|
|
975
|
+
Category::: Object Analysis
|
|
976
|
+
|
|
977
|
+
[vertical]
|
|
978
|
+
Examples:::
|
|
979
|
+
+
|
|
980
|
+
.Default (html) format, matches Jekyll's inspect
|
|
981
|
+
====
|
|
982
|
+
.Input
|
|
983
|
+
[source,liquid]
|
|
984
|
+
----
|
|
985
|
+
{{ tags_array | inspect }}
|
|
986
|
+
----
|
|
987
|
+
|
|
988
|
+
.Output
|
|
989
|
+
[source,liquid]
|
|
990
|
+
----
|
|
991
|
+
["foo", "bar", "baz"]
|
|
992
|
+
----
|
|
993
|
+
====
|
|
994
|
+
+
|
|
995
|
+
.YAML format
|
|
996
|
+
====
|
|
997
|
+
.Input
|
|
998
|
+
[source,liquid]
|
|
999
|
+
----
|
|
1000
|
+
{{ tags_array | inspect: "yaml" }}
|
|
1001
|
+
|
|
1002
|
+
----
|
|
1003
|
+
|
|
1004
|
+
.Output
|
|
1005
|
+
[source,liquid]
|
|
1006
|
+
----
|
|
1007
|
+
---
|
|
1008
|
+
- foo
|
|
1009
|
+
- bar
|
|
1010
|
+
- baz
|
|
1011
|
+
|
|
1012
|
+
----
|
|
1013
|
+
====
|
|
1014
|
+
+
|
|
1015
|
+
.JSON format
|
|
1016
|
+
====
|
|
1017
|
+
.Input
|
|
1018
|
+
[source,liquid]
|
|
1019
|
+
----
|
|
1020
|
+
{{ tags_array | inspect: "json" }}
|
|
1021
|
+
----
|
|
1022
|
+
|
|
1023
|
+
.Output
|
|
1024
|
+
[source,liquid]
|
|
1025
|
+
----
|
|
1026
|
+
["foo","bar","baz"]
|
|
1027
|
+
----
|
|
1028
|
+
====
|
|
1029
|
+
--
|
|
1030
|
+
[[filter__sum,Sum]]
|
|
1031
|
+
Sum (`sum`)::
|
|
1032
|
+
+
|
|
1033
|
+
--
|
|
1034
|
+
Sums a numeric array, or an array of Hashes at the given property.
|
|
1035
|
+
|
|
1036
|
+
(This filter duplicates Shopify's `sum` filter.)
|
|
1037
|
+
|
|
1038
|
+
|
|
1039
|
+
[horizontal]
|
|
1040
|
+
Category::: Math Operations
|
|
1041
|
+
|
|
1042
|
+
[vertical]
|
|
1043
|
+
Examples:::
|
|
1044
|
+
+
|
|
1045
|
+
====
|
|
1046
|
+
.Input
|
|
1047
|
+
[source,liquid]
|
|
1048
|
+
----
|
|
1049
|
+
{{ data.members | sum: "grad_year" }}
|
|
1050
|
+
----
|
|
1051
|
+
|
|
1052
|
+
.Output
|
|
1053
|
+
[source,liquid]
|
|
1054
|
+
----
|
|
1055
|
+
6040
|
|
1056
|
+
----
|
|
1057
|
+
====
|
|
1058
|
+
--
|
|
1059
|
+
[[filter__remove_last,Remove Last]]
|
|
1060
|
+
Remove Last (`remove_last`)::
|
|
1061
|
+
+
|
|
1062
|
+
--
|
|
1063
|
+
Removes the last instance of a substring from a string.
|
|
1064
|
+
|
|
1065
|
+
(This filter duplicates Shopify's `remove_last` filter.)
|
|
1066
|
+
|
|
1067
|
+
|
|
1068
|
+
[horizontal]
|
|
1069
|
+
Category::: String Conversion
|
|
1070
|
+
|
|
1071
|
+
[vertical]
|
|
1072
|
+
Examples:::
|
|
1073
|
+
+
|
|
1074
|
+
====
|
|
1075
|
+
.Input
|
|
1076
|
+
[source,liquid]
|
|
1077
|
+
----
|
|
1078
|
+
{{ "Ground control to Major Tom." | remove_last: "o" }}
|
|
1079
|
+
----
|
|
1080
|
+
|
|
1081
|
+
.Output
|
|
1082
|
+
[source,liquid]
|
|
1083
|
+
----
|
|
1084
|
+
Ground control to Major Tm.
|
|
1085
|
+
----
|
|
1086
|
+
====
|
|
1087
|
+
--
|
|
1088
|
+
[[filter__replace_last,Replace Last]]
|
|
1089
|
+
Replace Last (`replace_last`)::
|
|
1090
|
+
+
|
|
1091
|
+
--
|
|
1092
|
+
Replaces the last instance of a substring in a string with a replacement.
|
|
1093
|
+
|
|
1094
|
+
(This filter duplicates Shopify's `replace_last` filter.)
|
|
1095
|
+
|
|
1096
|
+
|
|
1097
|
+
[horizontal]
|
|
1098
|
+
Category::: String Conversion
|
|
1099
|
+
|
|
1100
|
+
[vertical]
|
|
1101
|
+
Examples:::
|
|
1102
|
+
+
|
|
1103
|
+
====
|
|
1104
|
+
.Input
|
|
1105
|
+
[source,liquid]
|
|
1106
|
+
----
|
|
1107
|
+
{{ "Ground control to Major Tom." | replace_last: "o", "0" }}
|
|
1108
|
+
----
|
|
1109
|
+
|
|
1110
|
+
.Output
|
|
1111
|
+
[source,liquid]
|
|
1112
|
+
----
|
|
1113
|
+
Ground control to Major T0m.
|
|
1114
|
+
----
|
|
1115
|
+
====
|
|
1116
|
+
--
|
|
1117
|
+
[[filter__squish,Squish]]
|
|
1118
|
+
Squish (`squish`)::
|
|
1119
|
+
+
|
|
1120
|
+
--
|
|
1121
|
+
Strips leading and trailing whitespace and collapses interior runs of
|
|
1122
|
+
whitespace to a single space.
|
|
1123
|
+
|
|
1124
|
+
(This filter duplicates Liquid 5's `squish` filter.)
|
|
1125
|
+
|
|
1126
|
+
|
|
1127
|
+
[horizontal]
|
|
1128
|
+
Category::: String Conversion
|
|
1129
|
+
|
|
1130
|
+
[vertical]
|
|
1131
|
+
Examples:::
|
|
1132
|
+
+
|
|
1133
|
+
====
|
|
1134
|
+
.Input
|
|
1135
|
+
[source,liquid]
|
|
1136
|
+
----
|
|
1137
|
+
{{ " A string that is obviously longer than 25 characters " | squish }}
|
|
1138
|
+
----
|
|
1139
|
+
|
|
1140
|
+
.Output
|
|
1141
|
+
[source,liquid]
|
|
1142
|
+
----
|
|
1143
|
+
A string that is obviously longer than 25 characters
|
|
1144
|
+
----
|
|
1145
|
+
====
|
|
1146
|
+
--
|
|
1147
|
+
[[filter__wrap,Wrap]]
|
|
1148
|
+
Wrap (`wrap`)::
|
|
1149
|
+
+
|
|
1150
|
+
--
|
|
1151
|
+
|
|
1152
|
+
|
|
1153
|
+
[horizontal]
|
|
1154
|
+
Category::: String Conversion
|
|
1155
|
+
|
|
1156
|
+
[vertical]
|
|
1157
|
+
Examples:::
|
|
1158
|
+
+
|
|
1159
|
+
====
|
|
1160
|
+
.Input
|
|
1161
|
+
[source,liquid]
|
|
1162
|
+
----
|
|
1163
|
+
{{ "A string that is obviously longer than 25 characters" | wrap: 25 }}
|
|
1164
|
+
----
|
|
1165
|
+
|
|
1166
|
+
.Output
|
|
1167
|
+
[source,liquid]
|
|
1168
|
+
----
|
|
1169
|
+
A string that is
|
|
1170
|
+
obviously longer than 25
|
|
1171
|
+
characters
|
|
1172
|
+
|
|
1173
|
+
----
|
|
1174
|
+
====
|
|
1175
|
+
--
|
|
1176
|
+
[[filter__commentwrap,Comment Wrap]]
|
|
1177
|
+
Comment Wrap (`commentwrap`)::
|
|
1178
|
+
+
|
|
1179
|
+
--
|
|
1180
|
+
|
|
1181
|
+
|
|
1182
|
+
[horizontal]
|
|
1183
|
+
Category::: String Conversion
|
|
1184
|
+
|
|
1185
|
+
[vertical]
|
|
1186
|
+
Examples:::
|
|
1187
|
+
+
|
|
1188
|
+
====
|
|
1189
|
+
.Input
|
|
1190
|
+
[source,liquid]
|
|
1191
|
+
----
|
|
1192
|
+
{{ comment_text | commentwrap: 25, "// " }}
|
|
1193
|
+
----
|
|
1194
|
+
|
|
1195
|
+
.Output
|
|
1196
|
+
[source,liquid]
|
|
1197
|
+
----
|
|
1198
|
+
// A string that is
|
|
1199
|
+
// obviously longer than 25
|
|
1200
|
+
// characters
|
|
1201
|
+
|
|
1202
|
+
----
|
|
1203
|
+
====
|
|
1204
|
+
+
|
|
1205
|
+
====
|
|
1206
|
+
.Input
|
|
1207
|
+
[source,liquid]
|
|
1208
|
+
----
|
|
1209
|
+
{{ comment_text | commentwrap: 25, "xml" }}
|
|
1210
|
+
----
|
|
1211
|
+
|
|
1212
|
+
.Output
|
|
1213
|
+
[source,liquid]
|
|
1214
|
+
----
|
|
1215
|
+
<!-- A string that is
|
|
1216
|
+
obviously longer than 25
|
|
1217
|
+
characters -->
|
|
1218
|
+
|
|
1219
|
+
----
|
|
1220
|
+
====
|
|
1221
|
+
+
|
|
1222
|
+
====
|
|
1223
|
+
.Input
|
|
1224
|
+
[source,liquid]
|
|
1225
|
+
----
|
|
1226
|
+
{{ comment_text | commentwrap: 25, "/*|*/" }}
|
|
1227
|
+
----
|
|
1228
|
+
|
|
1229
|
+
.Output
|
|
1230
|
+
[source,liquid]
|
|
1231
|
+
----
|
|
1232
|
+
/* A string that is
|
|
1233
|
+
obviously longer than 25
|
|
1234
|
+
characters
|
|
1235
|
+
*/
|
|
1236
|
+
|
|
1237
|
+
----
|
|
1238
|
+
====
|
|
1239
|
+
--
|
|
1240
|
+
[[filter__to_cli_args,Convert to CLI Arguments]]
|
|
1241
|
+
Convert to CLI Arguments (`to_cli_args`)::
|
|
1242
|
+
+
|
|
1243
|
+
--
|
|
1244
|
+
Transform a Hash into a string of CLI-formatted arguments.
|
|
1245
|
+
Accepts an optional template name to format the output.
|
|
1246
|
+
See `parameters` section for all available templates and their output formats.
|
|
1247
|
+
When no template is specified, defaults to `long_space` format.
|
|
1248
|
+
Arguments are joined with a space by default; can be customized via delimiter parameter.
|
|
1249
|
+
|
|
1250
|
+
|
|
1251
|
+
[horizontal]
|
|
1252
|
+
Category::: Object Conversion
|
|
1253
|
+
|
|
1254
|
+
[vertical]
|
|
1255
|
+
Examples:::
|
|
1256
|
+
+
|
|
1257
|
+
.Default (long_space) format
|
|
1258
|
+
====
|
|
1259
|
+
.Input
|
|
1260
|
+
[source,liquid]
|
|
1261
|
+
----
|
|
1262
|
+
{{ my_flat_hash | to_cli_args }}
|
|
1263
|
+
----
|
|
1264
|
+
|
|
1265
|
+
.Output
|
|
1266
|
+
[source,liquid]
|
|
1267
|
+
----
|
|
1268
|
+
--key1 valuu_one --key2 val_two --key3 third value
|
|
1269
|
+
----
|
|
1270
|
+
====
|
|
1271
|
+
+
|
|
1272
|
+
.Long equals format
|
|
1273
|
+
====
|
|
1274
|
+
.Input
|
|
1275
|
+
[source,liquid]
|
|
1276
|
+
----
|
|
1277
|
+
{{ my_flat_hash | to_cli_args: "long_equals" }}
|
|
1278
|
+
----
|
|
1279
|
+
|
|
1280
|
+
.Output
|
|
1281
|
+
[source,liquid]
|
|
1282
|
+
----
|
|
1283
|
+
--key1=valuu_one --key2=val_two --key3=third value
|
|
1284
|
+
----
|
|
1285
|
+
====
|
|
1286
|
+
+
|
|
1287
|
+
.Single-letter flags with values
|
|
1288
|
+
====
|
|
1289
|
+
.Input
|
|
1290
|
+
[source,liquid]
|
|
1291
|
+
----
|
|
1292
|
+
{{ cli_flags_hash | to_cli_args: "short_space" }}
|
|
1293
|
+
----
|
|
1294
|
+
|
|
1295
|
+
.Output
|
|
1296
|
+
[source,liquid]
|
|
1297
|
+
----
|
|
1298
|
+
-k valuu_one -v val_two -o third value
|
|
1299
|
+
----
|
|
1300
|
+
====
|
|
1301
|
+
+
|
|
1302
|
+
.Positional arguments only
|
|
1303
|
+
====
|
|
1304
|
+
.Input
|
|
1305
|
+
[source,liquid]
|
|
1306
|
+
----
|
|
1307
|
+
{{ my_flat_hash | to_cli_args: "positional" }}
|
|
1308
|
+
----
|
|
1309
|
+
|
|
1310
|
+
.Output
|
|
1311
|
+
[source,liquid]
|
|
1312
|
+
----
|
|
1313
|
+
valuu_one val_two third value
|
|
1314
|
+
----
|
|
1315
|
+
====
|
|
1316
|
+
+
|
|
1317
|
+
.Environment variable format (uppercase keys)
|
|
1318
|
+
====
|
|
1319
|
+
.Input
|
|
1320
|
+
[source,liquid]
|
|
1321
|
+
----
|
|
1322
|
+
{{ my_flat_hash | to_cli_args: "env_arg" }}
|
|
1323
|
+
----
|
|
1324
|
+
|
|
1325
|
+
.Output
|
|
1326
|
+
[source,liquid]
|
|
1327
|
+
----
|
|
1328
|
+
KEY1=valuu_one KEY2=val_two KEY3=third value
|
|
1329
|
+
----
|
|
1330
|
+
====
|
|
1331
|
+
+
|
|
1332
|
+
.Key=value format
|
|
1333
|
+
====
|
|
1334
|
+
.Input
|
|
1335
|
+
[source,liquid]
|
|
1336
|
+
----
|
|
1337
|
+
{{ my_flat_hash | to_cli_args: "keyval" }}
|
|
1338
|
+
----
|
|
1339
|
+
|
|
1340
|
+
.Output
|
|
1341
|
+
[source,liquid]
|
|
1342
|
+
----
|
|
1343
|
+
key1=valuu_one key2=val_two key3=third value
|
|
1344
|
+
----
|
|
1345
|
+
====
|
|
1346
|
+
--
|
|
1347
|
+
[[filter__to_yaml,Data objects to YAML]]
|
|
1348
|
+
Data objects to YAML (`to_yaml`)::
|
|
1349
|
+
+
|
|
1350
|
+
--
|
|
1351
|
+
Turn any parameter or data object into YAML format.
|
|
1352
|
+
|
|
1353
|
+
[horizontal]
|
|
1354
|
+
Category::: Object Conversion
|
|
1355
|
+
|
|
1356
|
+
[vertical]
|
|
1357
|
+
Examples:::
|
|
1358
|
+
+
|
|
1359
|
+
====
|
|
1360
|
+
.Input
|
|
1361
|
+
[source,liquid]
|
|
1362
|
+
----
|
|
1363
|
+
{{ my_flat_hash | to_yaml }}
|
|
1364
|
+
----
|
|
1365
|
+
|
|
1366
|
+
.Output
|
|
1367
|
+
[source,liquid]
|
|
1368
|
+
----
|
|
1369
|
+
---
|
|
1370
|
+
key1: valuu_one
|
|
1371
|
+
key2: val_two
|
|
1372
|
+
key3: third value
|
|
1373
|
+
|
|
1374
|
+
----
|
|
1375
|
+
====
|
|
1376
|
+
+
|
|
1377
|
+
====
|
|
1378
|
+
.Input
|
|
1379
|
+
[source,liquid]
|
|
1380
|
+
----
|
|
1381
|
+
{{ my_flat_hash | to_yaml: "flow" }}
|
|
1382
|
+
----
|
|
1383
|
+
|
|
1384
|
+
.Output
|
|
1385
|
+
[source,liquid]
|
|
1386
|
+
----
|
|
1387
|
+
{key1: "valuu_one", key2: "val_two", key3: "third value"}
|
|
1388
|
+
----
|
|
1389
|
+
====
|
|
1390
|
+
+
|
|
1391
|
+
====
|
|
1392
|
+
.Input
|
|
1393
|
+
[source,liquid]
|
|
1394
|
+
----
|
|
1395
|
+
{{ page.tags | to_yaml }}
|
|
1396
|
+
----
|
|
1397
|
+
|
|
1398
|
+
.Output
|
|
1399
|
+
[source,liquid]
|
|
1400
|
+
----
|
|
1401
|
+
---
|
|
1402
|
+
- Seattle
|
|
1403
|
+
- Tacoma
|
|
1404
|
+
- Spokane
|
|
1405
|
+
|
|
1406
|
+
----
|
|
1407
|
+
====
|
|
1408
|
+
+
|
|
1409
|
+
====
|
|
1410
|
+
.Input
|
|
1411
|
+
[source,liquid]
|
|
1412
|
+
----
|
|
1413
|
+
{{ page.tags | to_yaml: "flow" }}
|
|
1414
|
+
----
|
|
1415
|
+
|
|
1416
|
+
.Output
|
|
1417
|
+
[source,liquid]
|
|
1418
|
+
----
|
|
1419
|
+
["Seattle", "Tacoma", "Spokane"]
|
|
1420
|
+
----
|
|
1421
|
+
====
|
|
1422
|
+
+
|
|
1423
|
+
====
|
|
1424
|
+
.Input
|
|
1425
|
+
[source,liquid]
|
|
1426
|
+
----
|
|
1427
|
+
{{ page.tags | to_yaml: "flow", "quotes" }}
|
|
1428
|
+
----
|
|
1429
|
+
|
|
1430
|
+
.Output
|
|
1431
|
+
[source,liquid]
|
|
1432
|
+
----
|
|
1433
|
+
["Seattle", "Tacoma", "Spokane"]
|
|
1434
|
+
----
|
|
1435
|
+
====
|
|
1436
|
+
--
|
|
1437
|
+
[[filter__to_json,Data objects to JSON]]
|
|
1438
|
+
Data objects to JSON (`to_json`)::
|
|
1439
|
+
+
|
|
1440
|
+
--
|
|
1441
|
+
Turn any parameter or data object into JSON format.
|
|
1442
|
+
|
|
1443
|
+
[horizontal]
|
|
1444
|
+
Category::: Object Conversion
|
|
1445
|
+
|
|
1446
|
+
[vertical]
|
|
1447
|
+
Examples:::
|
|
1448
|
+
+
|
|
1449
|
+
====
|
|
1450
|
+
.Input
|
|
1451
|
+
[source,liquid]
|
|
1452
|
+
----
|
|
1453
|
+
{{ my_flat_hash | to_json }}
|
|
1454
|
+
----
|
|
1455
|
+
|
|
1456
|
+
.Output
|
|
1457
|
+
[source,liquid]
|
|
1458
|
+
----
|
|
1459
|
+
{"key1":"valuu_one","key2":"val_two","key3":"third value"}
|
|
1460
|
+
|
|
1461
|
+
----
|
|
1462
|
+
====
|
|
1463
|
+
+
|
|
1464
|
+
====
|
|
1465
|
+
.Input
|
|
1466
|
+
[source,liquid]
|
|
1467
|
+
----
|
|
1468
|
+
{{ page.tags | to_json }}
|
|
1469
|
+
----
|
|
1470
|
+
|
|
1471
|
+
.Output
|
|
1472
|
+
[source,liquid]
|
|
1473
|
+
----
|
|
1474
|
+
["Seattle","Tacoma","Spokane"]
|
|
1475
|
+
|
|
1476
|
+
----
|
|
1477
|
+
====
|
|
1478
|
+
+
|
|
1479
|
+
====
|
|
1480
|
+
.Input
|
|
1481
|
+
[source,liquid]
|
|
1482
|
+
----
|
|
1483
|
+
{{ odd_keys_hash | to_json }}
|
|
1484
|
+
----
|
|
1485
|
+
|
|
1486
|
+
.Output
|
|
1487
|
+
[source,liquid]
|
|
1488
|
+
----
|
|
1489
|
+
{"key 1":"valuu_one","$key2":"val_two","key:3":"third value"}
|
|
1490
|
+
|
|
1491
|
+
----
|
|
1492
|
+
====
|
|
1493
|
+
--
|
|
1494
|
+
[[filter__replace_regex,Regular Expression Replace]]
|
|
1495
|
+
Regular Expression Replace (`replace_regex`)::
|
|
1496
|
+
+
|
|
1497
|
+
--
|
|
1498
|
+
Use regular expressions to match and replace text patterns.
|
|
1499
|
+
|
|
1500
|
+
[horizontal]
|
|
1501
|
+
Category::: String Management
|
|
1502
|
+
|
|
1503
|
+
[vertical]
|
|
1504
|
+
Examples:::
|
|
1505
|
+
+
|
|
1506
|
+
====
|
|
1507
|
+
.Input
|
|
1508
|
+
[source,liquid]
|
|
1509
|
+
----
|
|
1510
|
+
{{ "hello world" | replace_regex: "world", "there" }}
|
|
1511
|
+
----
|
|
1512
|
+
|
|
1513
|
+
.Output
|
|
1514
|
+
[source,liquid]
|
|
1515
|
+
----
|
|
1516
|
+
hello there
|
|
1517
|
+
----
|
|
1518
|
+
====
|
|
1519
|
+
+
|
|
1520
|
+
====
|
|
1521
|
+
.Input
|
|
1522
|
+
[source,liquid]
|
|
1523
|
+
----
|
|
1524
|
+
{{ "one,two,three" | replace_regex: ",", "-" }}
|
|
1525
|
+
----
|
|
1526
|
+
|
|
1527
|
+
.Output
|
|
1528
|
+
[source,liquid]
|
|
1529
|
+
----
|
|
1530
|
+
one-two-three
|
|
1531
|
+
----
|
|
1532
|
+
====
|
|
1533
|
+
--
|
|
1534
|
+
[[filter__match,Pattern Match]]
|
|
1535
|
+
Pattern Match (`match`)::
|
|
1536
|
+
+
|
|
1537
|
+
--
|
|
1538
|
+
Returns of string or number matches pattern.
|
|
1539
|
+
|
|
1540
|
+
[horizontal]
|
|
1541
|
+
Category::: String Analysis
|
|
1542
|
+
|
|
1543
|
+
[vertical]
|
|
1544
|
+
Examples:::
|
|
1545
|
+
+
|
|
1546
|
+
====
|
|
1547
|
+
.Input
|
|
1548
|
+
[source,liquid]
|
|
1549
|
+
----
|
|
1550
|
+
{% assign matched = "testword" | match: "^.*word$" %}
|
|
1551
|
+
{% if matched %}It matched!{% endif %}
|
|
1552
|
+
|
|
1553
|
+
----
|
|
1554
|
+
|
|
1555
|
+
.Output
|
|
1556
|
+
[source,liquid]
|
|
1557
|
+
----
|
|
1558
|
+
It matched!
|
|
1559
|
+
----
|
|
1560
|
+
====
|
|
1561
|
+
--
|
|
1562
|
+
[[filter__holds_liquid,Holds Liquid]]
|
|
1563
|
+
Holds Liquid (`holds_liquid`)::
|
|
1564
|
+
+
|
|
1565
|
+
--
|
|
1566
|
+
Returns true if a snippet of text contains Liquid markup tags.
|
|
1567
|
+
|
|
1568
|
+
[horizontal]
|
|
1569
|
+
Category::: Object Analysis
|
|
1570
|
+
|
|
1571
|
+
[vertical]
|
|
1572
|
+
Examples:::
|
|
1573
|
+
+
|
|
1574
|
+
====
|
|
1575
|
+
.Input
|
|
1576
|
+
[source,liquid]
|
|
1577
|
+
----
|
|
1578
|
+
{{ liquidy_text | holds_liquid }}
|
|
1579
|
+
|
|
1580
|
+
----
|
|
1581
|
+
|
|
1582
|
+
.Output
|
|
1583
|
+
[source,liquid]
|
|
1584
|
+
----
|
|
1585
|
+
true
|
|
1586
|
+
----
|
|
1587
|
+
====
|
|
1588
|
+
+
|
|
1589
|
+
====
|
|
1590
|
+
.Input
|
|
1591
|
+
[source,liquid]
|
|
1592
|
+
----
|
|
1593
|
+
{{ "This is just text." | holds_liquid }}
|
|
1594
|
+
|
|
1595
|
+
----
|
|
1596
|
+
|
|
1597
|
+
.Output
|
|
1598
|
+
[source,liquid]
|
|
1599
|
+
----
|
|
1600
|
+
false
|
|
1601
|
+
----
|
|
1602
|
+
====
|
|
1603
|
+
--
|
|
1604
|
+
[[filter__store_list_concat,Metastore list concat]]
|
|
1605
|
+
Metastore list concat (`store_list_concat`)::
|
|
1606
|
+
+
|
|
1607
|
+
--
|
|
1608
|
+
Concatenates each Array-formatted value of the same-named property across all nodes in an Array of Hashes (Metastore).
|
|
1609
|
+
Accepts an Array of Hashes and the keyname of a property to collect from.
|
|
1610
|
+
|
|
1611
|
+
|
|
1612
|
+
[horizontal]
|
|
1613
|
+
Category::: Array Management
|
|
1614
|
+
|
|
1615
|
+
[vertical]
|
|
1616
|
+
Examples:::
|
|
1617
|
+
+
|
|
1618
|
+
====
|
|
1619
|
+
.Input
|
|
1620
|
+
[source,liquid]
|
|
1621
|
+
----
|
|
1622
|
+
{{ data.metastore | store_list_concat: "children" | jsonify }}
|
|
1623
|
+
|
|
1624
|
+
----
|
|
1625
|
+
|
|
1626
|
+
.Output
|
|
1627
|
+
[source,liquid]
|
|
1628
|
+
----
|
|
1629
|
+
["child1","child2","child3","child4","child5","child6"]
|
|
1630
|
+
----
|
|
1631
|
+
====
|
|
1632
|
+
--
|
|
1633
|
+
[[filter__store_list_dupes,Metastore list duplicates]]
|
|
1634
|
+
Metastore list duplicates (`store_list_dupes`)::
|
|
1635
|
+
+
|
|
1636
|
+
--
|
|
1637
|
+
Returns a list of duplicate items among multiple Arrays across multiple same-named properties in an Array of Hashes (Metastore).
|
|
1638
|
+
Accepts an Array of Hashes and the keyname of a Scalar property to check; returns the names of duplicate properties.
|
|
1639
|
+
|
|
1640
|
+
|
|
1641
|
+
[horizontal]
|
|
1642
|
+
Category::: Array Management
|
|
1643
|
+
|
|
1644
|
+
[vertical]
|
|
1645
|
+
Examples:::
|
|
1646
|
+
+
|
|
1647
|
+
====
|
|
1648
|
+
.Input
|
|
1649
|
+
[source,liquid]
|
|
1650
|
+
----
|
|
1651
|
+
{{ data.metastore | store_list_dupes: "children" | jsonify }}
|
|
1652
|
+
|
|
1653
|
+
----
|
|
1654
|
+
|
|
1655
|
+
.Output
|
|
1656
|
+
[source,liquid]
|
|
1657
|
+
----
|
|
1658
|
+
["child1"]
|
|
1659
|
+
----
|
|
1660
|
+
====
|
|
1661
|
+
--
|
|
1662
|
+
// end::asciisourcerer[]
|
|
1663
|
+
|
|
1664
|
+
:example-capition!:
|
|
1665
|
+
|
|
1666
|
+
[[shopify]]
|
|
1667
|
+
== Filters from Shopify
|
|
1668
|
+
|
|
1669
|
+
// tag::shopify[]
|
|
1670
|
+
[[filter__abs,Absolute Value]]
|
|
1671
|
+
Absolute Value (`abs`)::
|
|
1672
|
+
+
|
|
1673
|
+
--
|
|
1674
|
+
Returns the absolute value of a number.
|
|
1675
|
+
|
|
1676
|
+
[horizontal]
|
|
1677
|
+
Category::: Math Operations
|
|
1678
|
+
|
|
1679
|
+
[vertical]
|
|
1680
|
+
Examples:::
|
|
1681
|
+
+
|
|
1682
|
+
====
|
|
1683
|
+
.Input
|
|
1684
|
+
[source,liquid]
|
|
1685
|
+
----
|
|
1686
|
+
{{ -17 | abs }}
|
|
1687
|
+
----
|
|
1688
|
+
|
|
1689
|
+
.Output
|
|
1690
|
+
[source,liquid]
|
|
1691
|
+
----
|
|
1692
|
+
17
|
|
1693
|
+
----
|
|
1694
|
+
====
|
|
1695
|
+
+
|
|
1696
|
+
====
|
|
1697
|
+
.Input
|
|
1698
|
+
[source,liquid]
|
|
1699
|
+
----
|
|
1700
|
+
{{ "-19.86" | abs }}
|
|
1701
|
+
----
|
|
1702
|
+
|
|
1703
|
+
.Output
|
|
1704
|
+
[source,liquid]
|
|
1705
|
+
----
|
|
1706
|
+
19.86
|
|
1707
|
+
----
|
|
1708
|
+
====
|
|
1709
|
+
--
|
|
1710
|
+
[[filter__append,Append]]
|
|
1711
|
+
Append (`append`)::
|
|
1712
|
+
+
|
|
1713
|
+
--
|
|
1714
|
+
Adds the specified string to the end of another string.
|
|
1715
|
+
|
|
1716
|
+
[horizontal]
|
|
1717
|
+
Category::: String Management
|
|
1718
|
+
|
|
1719
|
+
[vertical]
|
|
1720
|
+
Examples:::
|
|
1721
|
+
+
|
|
1722
|
+
====
|
|
1723
|
+
.Input
|
|
1724
|
+
[source,liquid]
|
|
1725
|
+
----
|
|
1726
|
+
{{ "/my/fancy/url" | append: ".html" }}
|
|
1727
|
+
----
|
|
1728
|
+
|
|
1729
|
+
.Output
|
|
1730
|
+
[source,liquid]
|
|
1731
|
+
----
|
|
1732
|
+
/my/fancy/url.html
|
|
1733
|
+
----
|
|
1734
|
+
====
|
|
1735
|
+
--
|
|
1736
|
+
[[filter__at_least,At Least]]
|
|
1737
|
+
At Least (`at_least`)::
|
|
1738
|
+
+
|
|
1739
|
+
--
|
|
1740
|
+
Limits a number to a minimum value; returns the input unchanged if it's already at or above the minimum.
|
|
1741
|
+
|
|
1742
|
+
[horizontal]
|
|
1743
|
+
Category::: Math Operations
|
|
1744
|
+
|
|
1745
|
+
[vertical]
|
|
1746
|
+
Examples:::
|
|
1747
|
+
+
|
|
1748
|
+
====
|
|
1749
|
+
.Input
|
|
1750
|
+
[source,liquid]
|
|
1751
|
+
----
|
|
1752
|
+
{{ 4 | at_least: 5 }}
|
|
1753
|
+
----
|
|
1754
|
+
|
|
1755
|
+
.Output
|
|
1756
|
+
[source,liquid]
|
|
1757
|
+
----
|
|
1758
|
+
5
|
|
1759
|
+
----
|
|
1760
|
+
====
|
|
1761
|
+
+
|
|
1762
|
+
====
|
|
1763
|
+
.Input
|
|
1764
|
+
[source,liquid]
|
|
1765
|
+
----
|
|
1766
|
+
{{ 4 | at_least: 3 }}
|
|
1767
|
+
----
|
|
1768
|
+
|
|
1769
|
+
.Output
|
|
1770
|
+
[source,liquid]
|
|
1771
|
+
----
|
|
1772
|
+
4
|
|
1773
|
+
----
|
|
1774
|
+
====
|
|
1775
|
+
--
|
|
1776
|
+
[[filter__at_most,At Most]]
|
|
1777
|
+
At Most (`at_most`)::
|
|
1778
|
+
+
|
|
1779
|
+
--
|
|
1780
|
+
Limits a number to a maximum value; returns the input unchanged if it's already at or below the maximum.
|
|
1781
|
+
|
|
1782
|
+
[horizontal]
|
|
1783
|
+
Category::: Math Operations
|
|
1784
|
+
|
|
1785
|
+
[vertical]
|
|
1786
|
+
Examples:::
|
|
1787
|
+
+
|
|
1788
|
+
====
|
|
1789
|
+
.Input
|
|
1790
|
+
[source,liquid]
|
|
1791
|
+
----
|
|
1792
|
+
{{ 4 | at_most: 5 }}
|
|
1793
|
+
----
|
|
1794
|
+
|
|
1795
|
+
.Output
|
|
1796
|
+
[source,liquid]
|
|
1797
|
+
----
|
|
1798
|
+
4
|
|
1799
|
+
----
|
|
1800
|
+
====
|
|
1801
|
+
+
|
|
1802
|
+
====
|
|
1803
|
+
.Input
|
|
1804
|
+
[source,liquid]
|
|
1805
|
+
----
|
|
1806
|
+
{{ 4 | at_most: 3 }}
|
|
1807
|
+
----
|
|
1808
|
+
|
|
1809
|
+
.Output
|
|
1810
|
+
[source,liquid]
|
|
1811
|
+
----
|
|
1812
|
+
3
|
|
1813
|
+
----
|
|
1814
|
+
====
|
|
1815
|
+
--
|
|
1816
|
+
[[filter__capitalize,Capitalize]]
|
|
1817
|
+
Capitalize (`capitalize`)::
|
|
1818
|
+
+
|
|
1819
|
+
--
|
|
1820
|
+
Capitalizes the first character of a string and downcases the rest. Only the first character is affected, so later words are not capitalized.
|
|
1821
|
+
|
|
1822
|
+
[horizontal]
|
|
1823
|
+
Category::: String Conversion
|
|
1824
|
+
|
|
1825
|
+
[vertical]
|
|
1826
|
+
Examples:::
|
|
1827
|
+
+
|
|
1828
|
+
====
|
|
1829
|
+
.Input
|
|
1830
|
+
[source,liquid]
|
|
1831
|
+
----
|
|
1832
|
+
{{ "my GREAT title" | capitalize }}
|
|
1833
|
+
----
|
|
1834
|
+
|
|
1835
|
+
.Output
|
|
1836
|
+
[source,liquid]
|
|
1837
|
+
----
|
|
1838
|
+
My great title
|
|
1839
|
+
----
|
|
1840
|
+
====
|
|
1841
|
+
--
|
|
1842
|
+
[[filter__ceil,Ceiling]]
|
|
1843
|
+
Ceiling (`ceil`)::
|
|
1844
|
+
+
|
|
1845
|
+
--
|
|
1846
|
+
Rounds a number up to the nearest whole number. Liquid tries to convert the input to a number before applying the filter.
|
|
1847
|
+
|
|
1848
|
+
[horizontal]
|
|
1849
|
+
Category::: Math Operations
|
|
1850
|
+
|
|
1851
|
+
[vertical]
|
|
1852
|
+
Examples:::
|
|
1853
|
+
+
|
|
1854
|
+
====
|
|
1855
|
+
.Input
|
|
1856
|
+
[source,liquid]
|
|
1857
|
+
----
|
|
1858
|
+
{{ 1.2 | ceil }}
|
|
1859
|
+
----
|
|
1860
|
+
|
|
1861
|
+
.Output
|
|
1862
|
+
[source,liquid]
|
|
1863
|
+
----
|
|
1864
|
+
2
|
|
1865
|
+
----
|
|
1866
|
+
====
|
|
1867
|
+
--
|
|
1868
|
+
[[filter__compact,Compact]]
|
|
1869
|
+
Compact (`compact`)::
|
|
1870
|
+
+
|
|
1871
|
+
--
|
|
1872
|
+
Removes any `nil` values from an array.
|
|
1873
|
+
|
|
1874
|
+
[horizontal]
|
|
1875
|
+
Category::: Array Management
|
|
1876
|
+
|
|
1877
|
+
[vertical]
|
|
1878
|
+
Examples:::
|
|
1879
|
+
+
|
|
1880
|
+
====
|
|
1881
|
+
.Input
|
|
1882
|
+
[source,liquid]
|
|
1883
|
+
----
|
|
1884
|
+
{% assign compacted = mixed_array | compact %}
|
|
1885
|
+
{{ compacted | join: "," }}
|
|
1886
|
+
|
|
1887
|
+
----
|
|
1888
|
+
|
|
1889
|
+
.Output
|
|
1890
|
+
[source,liquid]
|
|
1891
|
+
----
|
|
1892
|
+
a,b,c
|
|
1893
|
+
----
|
|
1894
|
+
====
|
|
1895
|
+
--
|
|
1896
|
+
[[filter__concat,Concatenate]]
|
|
1897
|
+
Concatenate (`concat`)::
|
|
1898
|
+
+
|
|
1899
|
+
--
|
|
1900
|
+
Concatenates (joins together) multiple arrays. The resulting array contains all the items from the input arrays.
|
|
1901
|
+
|
|
1902
|
+
[horizontal]
|
|
1903
|
+
Category::: Array Management
|
|
1904
|
+
|
|
1905
|
+
[vertical]
|
|
1906
|
+
Examples:::
|
|
1907
|
+
+
|
|
1908
|
+
====
|
|
1909
|
+
.Input
|
|
1910
|
+
[source,liquid]
|
|
1911
|
+
----
|
|
1912
|
+
{% assign fruits = "apples, oranges" | split: ", " %}
|
|
1913
|
+
{% assign veggies = "carrots, turnips" | split: ", " %}
|
|
1914
|
+
{{ fruits | concat: veggies | join: "," }}
|
|
1915
|
+
|
|
1916
|
+
----
|
|
1917
|
+
|
|
1918
|
+
.Output
|
|
1919
|
+
[source,liquid]
|
|
1920
|
+
----
|
|
1921
|
+
apples,oranges,carrots,turnips
|
|
1922
|
+
----
|
|
1923
|
+
====
|
|
1924
|
+
--
|
|
1925
|
+
[[filter__date,Date Format]]
|
|
1926
|
+
Date Format (`date`)::
|
|
1927
|
+
+
|
|
1928
|
+
--
|
|
1929
|
+
Converts a timestamp into another date format, using the same format
|
|
1930
|
+
syntax as `strftime`.
|
|
1931
|
+
|
|
1932
|
+
|
|
1933
|
+
[horizontal]
|
|
1934
|
+
Category::: Date Formatting
|
|
1935
|
+
|
|
1936
|
+
[vertical]
|
|
1937
|
+
Examples:::
|
|
1938
|
+
+
|
|
1939
|
+
====
|
|
1940
|
+
.Input
|
|
1941
|
+
[source,liquid]
|
|
1942
|
+
----
|
|
1943
|
+
{{ data.time | date: "%Y-%m-%d" }}
|
|
1944
|
+
----
|
|
1945
|
+
|
|
1946
|
+
.Output
|
|
1947
|
+
[source,liquid]
|
|
1948
|
+
----
|
|
1949
|
+
2008-11-07
|
|
1950
|
+
----
|
|
1951
|
+
====
|
|
1952
|
+
--
|
|
1953
|
+
[[filter__default,Default]]
|
|
1954
|
+
Default (`default`)::
|
|
1955
|
+
+
|
|
1956
|
+
--
|
|
1957
|
+
Sets a fallback value for a variable that is `nil`, `false`, or empty.
|
|
1958
|
+
Has no effect if the input already has a value.
|
|
1959
|
+
|
|
1960
|
+
|
|
1961
|
+
[horizontal]
|
|
1962
|
+
Category::: Variable Defaults
|
|
1963
|
+
|
|
1964
|
+
[vertical]
|
|
1965
|
+
Examples:::
|
|
1966
|
+
+
|
|
1967
|
+
====
|
|
1968
|
+
.Input
|
|
1969
|
+
[source,liquid]
|
|
1970
|
+
----
|
|
1971
|
+
{{ nonexistent_var | default: "fallback" }}
|
|
1972
|
+
----
|
|
1973
|
+
|
|
1974
|
+
.Output
|
|
1975
|
+
[source,liquid]
|
|
1976
|
+
----
|
|
1977
|
+
fallback
|
|
1978
|
+
----
|
|
1979
|
+
====
|
|
1980
|
+
--
|
|
1981
|
+
[[filter__divided_by,Divided By]]
|
|
1982
|
+
Divided By (`divided_by`)::
|
|
1983
|
+
+
|
|
1984
|
+
--
|
|
1985
|
+
Divides a number by another number. The result's type matches the
|
|
1986
|
+
divisor's: dividing by an integer floors to an integer, dividing by a
|
|
1987
|
+
float returns a float.
|
|
1988
|
+
|
|
1989
|
+
|
|
1990
|
+
[horizontal]
|
|
1991
|
+
Category::: Math Operations
|
|
1992
|
+
|
|
1993
|
+
[vertical]
|
|
1994
|
+
Examples:::
|
|
1995
|
+
+
|
|
1996
|
+
====
|
|
1997
|
+
.Input
|
|
1998
|
+
[source,liquid]
|
|
1999
|
+
----
|
|
2000
|
+
{{ 16 | divided_by: 4 }}
|
|
2001
|
+
----
|
|
2002
|
+
|
|
2003
|
+
.Output
|
|
2004
|
+
[source,liquid]
|
|
2005
|
+
----
|
|
2006
|
+
4
|
|
2007
|
+
----
|
|
2008
|
+
====
|
|
2009
|
+
+
|
|
2010
|
+
====
|
|
2011
|
+
.Input
|
|
2012
|
+
[source,liquid]
|
|
2013
|
+
----
|
|
2014
|
+
{{ 20 | divided_by: 7 }}
|
|
2015
|
+
----
|
|
2016
|
+
|
|
2017
|
+
.Output
|
|
2018
|
+
[source,liquid]
|
|
2019
|
+
----
|
|
2020
|
+
2
|
|
2021
|
+
----
|
|
2022
|
+
====
|
|
2023
|
+
+
|
|
2024
|
+
====
|
|
2025
|
+
.Input
|
|
2026
|
+
[source,liquid]
|
|
2027
|
+
----
|
|
2028
|
+
{{ 20 | divided_by: 7.0 }}
|
|
2029
|
+
----
|
|
2030
|
+
|
|
2031
|
+
.Output
|
|
2032
|
+
[source,liquid]
|
|
2033
|
+
----
|
|
2034
|
+
2.857142857142857
|
|
2035
|
+
----
|
|
2036
|
+
====
|
|
2037
|
+
--
|
|
2038
|
+
[[filter__downcase,Downcase]]
|
|
2039
|
+
Downcase (`downcase`)::
|
|
2040
|
+
+
|
|
2041
|
+
--
|
|
2042
|
+
Makes each character in a string lowercase.
|
|
2043
|
+
|
|
2044
|
+
[horizontal]
|
|
2045
|
+
Category::: String Conversion
|
|
2046
|
+
|
|
2047
|
+
[vertical]
|
|
2048
|
+
Examples:::
|
|
2049
|
+
+
|
|
2050
|
+
====
|
|
2051
|
+
.Input
|
|
2052
|
+
[source,liquid]
|
|
2053
|
+
----
|
|
2054
|
+
{{ "Parker Moore" | downcase }}
|
|
2055
|
+
----
|
|
2056
|
+
|
|
2057
|
+
.Output
|
|
2058
|
+
[source,liquid]
|
|
2059
|
+
----
|
|
2060
|
+
parker moore
|
|
2061
|
+
----
|
|
2062
|
+
====
|
|
2063
|
+
--
|
|
2064
|
+
[[filter__escape,Escape]]
|
|
2065
|
+
Escape (`escape`)::
|
|
2066
|
+
+
|
|
2067
|
+
--
|
|
2068
|
+
Escapes a string's HTML-unsafe characters (so it can safely be embedded in HTML markup).
|
|
2069
|
+
|
|
2070
|
+
[horizontal]
|
|
2071
|
+
Category::: String Conversion
|
|
2072
|
+
|
|
2073
|
+
[vertical]
|
|
2074
|
+
Examples:::
|
|
2075
|
+
+
|
|
2076
|
+
====
|
|
2077
|
+
.Input
|
|
2078
|
+
[source,liquid]
|
|
2079
|
+
----
|
|
2080
|
+
{{ "Have you read 'James & the Giant Peach'?" | escape }}
|
|
2081
|
+
----
|
|
2082
|
+
|
|
2083
|
+
.Output
|
|
2084
|
+
[source,liquid]
|
|
2085
|
+
----
|
|
2086
|
+
Have you read 'James & the Giant Peach'?
|
|
2087
|
+
----
|
|
2088
|
+
====
|
|
2089
|
+
--
|
|
2090
|
+
[[filter__escape_once,Escape Once]]
|
|
2091
|
+
Escape Once (`escape_once`)::
|
|
2092
|
+
+
|
|
2093
|
+
--
|
|
2094
|
+
Escapes a string's HTML-unsafe characters without double-escaping entities that are already escaped.
|
|
2095
|
+
|
|
2096
|
+
[horizontal]
|
|
2097
|
+
Category::: String Conversion
|
|
2098
|
+
|
|
2099
|
+
[vertical]
|
|
2100
|
+
Examples:::
|
|
2101
|
+
+
|
|
2102
|
+
====
|
|
2103
|
+
.Input
|
|
2104
|
+
[source,liquid]
|
|
2105
|
+
----
|
|
2106
|
+
{{ "1 < 2 & 3" | escape_once }}
|
|
2107
|
+
----
|
|
2108
|
+
|
|
2109
|
+
.Output
|
|
2110
|
+
[source,liquid]
|
|
2111
|
+
----
|
|
2112
|
+
1 < 2 & 3
|
|
2113
|
+
----
|
|
2114
|
+
====
|
|
2115
|
+
+
|
|
2116
|
+
====
|
|
2117
|
+
.Input
|
|
2118
|
+
[source,liquid]
|
|
2119
|
+
----
|
|
2120
|
+
{{ "1 < 2 & 3" | escape_once }}
|
|
2121
|
+
----
|
|
2122
|
+
|
|
2123
|
+
.Output
|
|
2124
|
+
[source,liquid]
|
|
2125
|
+
----
|
|
2126
|
+
1 < 2 & 3
|
|
2127
|
+
----
|
|
2128
|
+
====
|
|
2129
|
+
--
|
|
2130
|
+
[[filter__first,First]]
|
|
2131
|
+
First (`first`)::
|
|
2132
|
+
+
|
|
2133
|
+
--
|
|
2134
|
+
Returns the first item of an array.
|
|
2135
|
+
|
|
2136
|
+
[horizontal]
|
|
2137
|
+
Category::: Array Selection
|
|
2138
|
+
|
|
2139
|
+
[vertical]
|
|
2140
|
+
Examples:::
|
|
2141
|
+
+
|
|
2142
|
+
====
|
|
2143
|
+
.Input
|
|
2144
|
+
[source,liquid]
|
|
2145
|
+
----
|
|
2146
|
+
{{ "Ground control to Major Tom." | split: " " | first }}
|
|
2147
|
+
----
|
|
2148
|
+
|
|
2149
|
+
.Output
|
|
2150
|
+
[source,liquid]
|
|
2151
|
+
----
|
|
2152
|
+
Ground
|
|
2153
|
+
----
|
|
2154
|
+
====
|
|
2155
|
+
--
|
|
2156
|
+
[[filter__floor,Floor]]
|
|
2157
|
+
Floor (`floor`)::
|
|
2158
|
+
+
|
|
2159
|
+
--
|
|
2160
|
+
Rounds a number down to the nearest whole number. Liquid tries to convert the input to a number before applying the filter.
|
|
2161
|
+
|
|
2162
|
+
[horizontal]
|
|
2163
|
+
Category::: Math Operations
|
|
2164
|
+
|
|
2165
|
+
[vertical]
|
|
2166
|
+
Examples:::
|
|
2167
|
+
+
|
|
2168
|
+
====
|
|
2169
|
+
.Input
|
|
2170
|
+
[source,liquid]
|
|
2171
|
+
----
|
|
2172
|
+
{{ 1.2 | floor }}
|
|
2173
|
+
----
|
|
2174
|
+
|
|
2175
|
+
.Output
|
|
2176
|
+
[source,liquid]
|
|
2177
|
+
----
|
|
2178
|
+
1
|
|
2179
|
+
----
|
|
2180
|
+
====
|
|
2181
|
+
--
|
|
2182
|
+
[[filter__join,Join]]
|
|
2183
|
+
Join (`join`)::
|
|
2184
|
+
+
|
|
2185
|
+
--
|
|
2186
|
+
Combines the items in an array into a single string, using the argument as a separator.
|
|
2187
|
+
|
|
2188
|
+
[horizontal]
|
|
2189
|
+
Category::: Object Conversion
|
|
2190
|
+
|
|
2191
|
+
[vertical]
|
|
2192
|
+
Examples:::
|
|
2193
|
+
+
|
|
2194
|
+
====
|
|
2195
|
+
.Input
|
|
2196
|
+
[source,liquid]
|
|
2197
|
+
----
|
|
2198
|
+
{% assign beatles = "John, Paul, George, Ringo" | split: ", " %}
|
|
2199
|
+
{{ beatles | join: " and " }}
|
|
2200
|
+
|
|
2201
|
+
----
|
|
2202
|
+
|
|
2203
|
+
.Output
|
|
2204
|
+
[source,liquid]
|
|
2205
|
+
----
|
|
2206
|
+
John and Paul and George and Ringo
|
|
2207
|
+
----
|
|
2208
|
+
====
|
|
2209
|
+
--
|
|
2210
|
+
[[filter__last,Last]]
|
|
2211
|
+
Last (`last`)::
|
|
2212
|
+
+
|
|
2213
|
+
--
|
|
2214
|
+
Returns the last item of an array.
|
|
2215
|
+
|
|
2216
|
+
[horizontal]
|
|
2217
|
+
Category::: Array Selection
|
|
2218
|
+
|
|
2219
|
+
[vertical]
|
|
2220
|
+
Examples:::
|
|
2221
|
+
+
|
|
2222
|
+
====
|
|
2223
|
+
.Input
|
|
2224
|
+
[source,liquid]
|
|
2225
|
+
----
|
|
2226
|
+
{{ "Ground control to Major Tom." | split: " " | last }}
|
|
2227
|
+
----
|
|
2228
|
+
|
|
2229
|
+
.Output
|
|
2230
|
+
[source,liquid]
|
|
2231
|
+
----
|
|
2232
|
+
Tom.
|
|
2233
|
+
----
|
|
2234
|
+
====
|
|
2235
|
+
--
|
|
2236
|
+
[[filter__lstrip,Left Strip]]
|
|
2237
|
+
Left Strip (`lstrip`)::
|
|
2238
|
+
+
|
|
2239
|
+
--
|
|
2240
|
+
Removes whitespace (tabs, spaces, newlines) from the left side of a
|
|
2241
|
+
string. Does not affect spaces between words.
|
|
2242
|
+
|
|
2243
|
+
|
|
2244
|
+
[horizontal]
|
|
2245
|
+
Category::: String Management
|
|
2246
|
+
|
|
2247
|
+
[vertical]
|
|
2248
|
+
Examples:::
|
|
2249
|
+
+
|
|
2250
|
+
====
|
|
2251
|
+
.Input
|
|
2252
|
+
[source,liquid]
|
|
2253
|
+
----
|
|
2254
|
+
{{ " So much room " | lstrip }}!
|
|
2255
|
+
----
|
|
2256
|
+
|
|
2257
|
+
.Output
|
|
2258
|
+
[source,liquid]
|
|
2259
|
+
----
|
|
2260
|
+
So much room !
|
|
2261
|
+
----
|
|
2262
|
+
====
|
|
2263
|
+
--
|
|
2264
|
+
[[filter__map,Map]]
|
|
2265
|
+
Map (`map`)::
|
|
2266
|
+
+
|
|
2267
|
+
--
|
|
2268
|
+
Creates an array of values by extracting the values of a named property from an array of objects.
|
|
2269
|
+
|
|
2270
|
+
[horizontal]
|
|
2271
|
+
Category::: Object Conversion
|
|
2272
|
+
|
|
2273
|
+
[vertical]
|
|
2274
|
+
Examples:::
|
|
2275
|
+
+
|
|
2276
|
+
====
|
|
2277
|
+
.Input
|
|
2278
|
+
[source,liquid]
|
|
2279
|
+
----
|
|
2280
|
+
{{ data.members | map: "user" | join: "," }}
|
|
2281
|
+
|
|
2282
|
+
----
|
|
2283
|
+
|
|
2284
|
+
.Output
|
|
2285
|
+
[source,liquid]
|
|
2286
|
+
----
|
|
2287
|
+
andie,lonnie,cindy
|
|
2288
|
+
----
|
|
2289
|
+
====
|
|
2290
|
+
--
|
|
2291
|
+
[[filter__minus,Minus (subtract)]]
|
|
2292
|
+
Minus (subtract) (`minus`)::
|
|
2293
|
+
+
|
|
2294
|
+
--
|
|
2295
|
+
Subtracts a number from another number.
|
|
2296
|
+
|
|
2297
|
+
[horizontal]
|
|
2298
|
+
Category::: Math Operations
|
|
2299
|
+
|
|
2300
|
+
[vertical]
|
|
2301
|
+
Examples:::
|
|
2302
|
+
+
|
|
2303
|
+
====
|
|
2304
|
+
.Input
|
|
2305
|
+
[source,liquid]
|
|
2306
|
+
----
|
|
2307
|
+
{{ 4 | minus: 2 }}
|
|
2308
|
+
----
|
|
2309
|
+
|
|
2310
|
+
.Output
|
|
2311
|
+
[source,liquid]
|
|
2312
|
+
----
|
|
2313
|
+
2
|
|
2314
|
+
----
|
|
2315
|
+
====
|
|
2316
|
+
+
|
|
2317
|
+
====
|
|
2318
|
+
.Input
|
|
2319
|
+
[source,liquid]
|
|
2320
|
+
----
|
|
2321
|
+
{{ 16 | minus: 4 }}
|
|
2322
|
+
----
|
|
2323
|
+
|
|
2324
|
+
.Output
|
|
2325
|
+
[source,liquid]
|
|
2326
|
+
----
|
|
2327
|
+
12
|
|
2328
|
+
----
|
|
2329
|
+
====
|
|
2330
|
+
--
|
|
2331
|
+
[[filter__modulo,Modulo]]
|
|
2332
|
+
Modulo (`modulo`)::
|
|
2333
|
+
+
|
|
2334
|
+
--
|
|
2335
|
+
Returns the remainder of a division operation.
|
|
2336
|
+
|
|
2337
|
+
[horizontal]
|
|
2338
|
+
Category::: Math Operations
|
|
2339
|
+
|
|
2340
|
+
[vertical]
|
|
2341
|
+
Examples:::
|
|
2342
|
+
+
|
|
2343
|
+
====
|
|
2344
|
+
.Input
|
|
2345
|
+
[source,liquid]
|
|
2346
|
+
----
|
|
2347
|
+
{{ 3 | modulo: 2 }}
|
|
2348
|
+
----
|
|
2349
|
+
|
|
2350
|
+
.Output
|
|
2351
|
+
[source,liquid]
|
|
2352
|
+
----
|
|
2353
|
+
1
|
|
2354
|
+
----
|
|
2355
|
+
====
|
|
2356
|
+
+
|
|
2357
|
+
====
|
|
2358
|
+
.Input
|
|
2359
|
+
[source,liquid]
|
|
2360
|
+
----
|
|
2361
|
+
{{ 24 | modulo: 7 }}
|
|
2362
|
+
----
|
|
2363
|
+
|
|
2364
|
+
.Output
|
|
2365
|
+
[source,liquid]
|
|
2366
|
+
----
|
|
2367
|
+
3
|
|
2368
|
+
----
|
|
2369
|
+
====
|
|
2370
|
+
--
|
|
2371
|
+
[[filter__newline_to_br,Newline to Break Tag]]
|
|
2372
|
+
Newline to Break Tag (`newline_to_br`)::
|
|
2373
|
+
+
|
|
2374
|
+
--
|
|
2375
|
+
Inserts an HTML line break (`<br />`) in front of each newline in a string.
|
|
2376
|
+
|
|
2377
|
+
[horizontal]
|
|
2378
|
+
Category::: String Conversion
|
|
2379
|
+
|
|
2380
|
+
[vertical]
|
|
2381
|
+
Examples:::
|
|
2382
|
+
+
|
|
2383
|
+
====
|
|
2384
|
+
.Input
|
|
2385
|
+
[source,liquid]
|
|
2386
|
+
----
|
|
2387
|
+
{% capture s %}Hello
|
|
2388
|
+
there{% endcapture %}{{ s | newline_to_br }}
|
|
2389
|
+
|
|
2390
|
+
----
|
|
2391
|
+
|
|
2392
|
+
.Output
|
|
2393
|
+
[source,liquid]
|
|
2394
|
+
----
|
|
2395
|
+
Hello<br />
|
|
2396
|
+
there
|
|
2397
|
+
----
|
|
2398
|
+
====
|
|
2399
|
+
--
|
|
2400
|
+
[[filter__plus,Plus (add)]]
|
|
2401
|
+
Plus (add) (`plus`)::
|
|
2402
|
+
+
|
|
2403
|
+
--
|
|
2404
|
+
Adds a number to another number.
|
|
2405
|
+
|
|
2406
|
+
[horizontal]
|
|
2407
|
+
Category::: Math Operations
|
|
2408
|
+
|
|
2409
|
+
[vertical]
|
|
2410
|
+
Examples:::
|
|
2411
|
+
+
|
|
2412
|
+
====
|
|
2413
|
+
.Input
|
|
2414
|
+
[source,liquid]
|
|
2415
|
+
----
|
|
2416
|
+
{{ 4 | plus: 2 }}
|
|
2417
|
+
----
|
|
2418
|
+
|
|
2419
|
+
.Output
|
|
2420
|
+
[source,liquid]
|
|
2421
|
+
----
|
|
2422
|
+
6
|
|
2423
|
+
----
|
|
2424
|
+
====
|
|
2425
|
+
--
|
|
2426
|
+
[[filter__prepend,Prepend]]
|
|
2427
|
+
Prepend (`prepend`)::
|
|
2428
|
+
+
|
|
2429
|
+
--
|
|
2430
|
+
Adds the specified string to the beginning of another string.
|
|
2431
|
+
|
|
2432
|
+
[horizontal]
|
|
2433
|
+
Category::: String Management
|
|
2434
|
+
|
|
2435
|
+
[vertical]
|
|
2436
|
+
Examples:::
|
|
2437
|
+
+
|
|
2438
|
+
====
|
|
2439
|
+
.Input
|
|
2440
|
+
[source,liquid]
|
|
2441
|
+
----
|
|
2442
|
+
{{ "apples, oranges, and bananas" | prepend: "Some fruit: " }}
|
|
2443
|
+
----
|
|
2444
|
+
|
|
2445
|
+
.Output
|
|
2446
|
+
[source,liquid]
|
|
2447
|
+
----
|
|
2448
|
+
Some fruit: apples, oranges, and bananas
|
|
2449
|
+
----
|
|
2450
|
+
====
|
|
2451
|
+
--
|
|
2452
|
+
[[filter__remove,Remove]]
|
|
2453
|
+
Remove (`remove`)::
|
|
2454
|
+
+
|
|
2455
|
+
--
|
|
2456
|
+
Removes every occurrence of the specified substring from a string.
|
|
2457
|
+
|
|
2458
|
+
[horizontal]
|
|
2459
|
+
Category::: String Conversion
|
|
2460
|
+
|
|
2461
|
+
[vertical]
|
|
2462
|
+
Examples:::
|
|
2463
|
+
+
|
|
2464
|
+
====
|
|
2465
|
+
.Input
|
|
2466
|
+
[source,liquid]
|
|
2467
|
+
----
|
|
2468
|
+
{{ "I strained to see the train through the rain" | remove: "rain" }}
|
|
2469
|
+
----
|
|
2470
|
+
|
|
2471
|
+
.Output
|
|
2472
|
+
[source,liquid]
|
|
2473
|
+
----
|
|
2474
|
+
I sted to see the t through the
|
|
2475
|
+
----
|
|
2476
|
+
====
|
|
2477
|
+
--
|
|
2478
|
+
[[filter__remove_first,Remove First]]
|
|
2479
|
+
Remove First (`remove_first`)::
|
|
2480
|
+
+
|
|
2481
|
+
--
|
|
2482
|
+
Removes only the first occurrence of the specified substring from a string.
|
|
2483
|
+
|
|
2484
|
+
[horizontal]
|
|
2485
|
+
Category::: String Conversion
|
|
2486
|
+
|
|
2487
|
+
[vertical]
|
|
2488
|
+
Examples:::
|
|
2489
|
+
+
|
|
2490
|
+
====
|
|
2491
|
+
.Input
|
|
2492
|
+
[source,liquid]
|
|
2493
|
+
----
|
|
2494
|
+
{{ "I strained to see the train through the rain" | remove_first: "rain" }}
|
|
2495
|
+
----
|
|
2496
|
+
|
|
2497
|
+
.Output
|
|
2498
|
+
[source,liquid]
|
|
2499
|
+
----
|
|
2500
|
+
I sted to see the train through the rain
|
|
2501
|
+
----
|
|
2502
|
+
====
|
|
2503
|
+
--
|
|
2504
|
+
[[filter__replace,Replace]]
|
|
2505
|
+
Replace (`replace`)::
|
|
2506
|
+
+
|
|
2507
|
+
--
|
|
2508
|
+
Replaces every occurrence of the first argument in a string with the second argument.
|
|
2509
|
+
|
|
2510
|
+
[horizontal]
|
|
2511
|
+
Category::: String Conversion
|
|
2512
|
+
|
|
2513
|
+
[vertical]
|
|
2514
|
+
Examples:::
|
|
2515
|
+
+
|
|
2516
|
+
====
|
|
2517
|
+
.Input
|
|
2518
|
+
[source,liquid]
|
|
2519
|
+
----
|
|
2520
|
+
{{ "Take my protein pills and put my helmet on" | replace: "my", "your" }}
|
|
2521
|
+
----
|
|
2522
|
+
|
|
2523
|
+
.Output
|
|
2524
|
+
[source,liquid]
|
|
2525
|
+
----
|
|
2526
|
+
Take your protein pills and put your helmet on
|
|
2527
|
+
----
|
|
2528
|
+
====
|
|
2529
|
+
--
|
|
2530
|
+
[[filter__replace_first,Replace First]]
|
|
2531
|
+
Replace First (`replace_first`)::
|
|
2532
|
+
+
|
|
2533
|
+
--
|
|
2534
|
+
Replaces only the first occurrence of the first argument in a string with the second argument.
|
|
2535
|
+
|
|
2536
|
+
[horizontal]
|
|
2537
|
+
Category::: String Conversion
|
|
2538
|
+
|
|
2539
|
+
[vertical]
|
|
2540
|
+
Examples:::
|
|
2541
|
+
+
|
|
2542
|
+
====
|
|
2543
|
+
.Input
|
|
2544
|
+
[source,liquid]
|
|
2545
|
+
----
|
|
2546
|
+
{{ "Take my protein pills and put my helmet on" | replace_first: "my", "your" }}
|
|
2547
|
+
----
|
|
2548
|
+
|
|
2549
|
+
.Output
|
|
2550
|
+
[source,liquid]
|
|
2551
|
+
----
|
|
2552
|
+
Take your protein pills and put my helmet on
|
|
2553
|
+
----
|
|
2554
|
+
====
|
|
2555
|
+
--
|
|
2556
|
+
[[filter__reverse,Reverse]]
|
|
2557
|
+
Reverse (`reverse`)::
|
|
2558
|
+
+
|
|
2559
|
+
--
|
|
2560
|
+
Reverses the order of the items in an array. Cannot reverse a string
|
|
2561
|
+
directly; split it into an array first.
|
|
2562
|
+
|
|
2563
|
+
|
|
2564
|
+
[horizontal]
|
|
2565
|
+
Category::: Array Organizing
|
|
2566
|
+
|
|
2567
|
+
[vertical]
|
|
2568
|
+
Examples:::
|
|
2569
|
+
+
|
|
2570
|
+
====
|
|
2571
|
+
.Input
|
|
2572
|
+
[source,liquid]
|
|
2573
|
+
----
|
|
2574
|
+
{% assign arr = "apples, oranges, peaches, plums" | split: ", " %}
|
|
2575
|
+
{{ arr | reverse | join: ", " }}
|
|
2576
|
+
|
|
2577
|
+
----
|
|
2578
|
+
|
|
2579
|
+
.Output
|
|
2580
|
+
[source,liquid]
|
|
2581
|
+
----
|
|
2582
|
+
plums, peaches, oranges, apples
|
|
2583
|
+
----
|
|
2584
|
+
====
|
|
2585
|
+
--
|
|
2586
|
+
[[filter__round,Round]]
|
|
2587
|
+
Round (`round`)::
|
|
2588
|
+
+
|
|
2589
|
+
--
|
|
2590
|
+
Rounds a number to the nearest integer, or to a given number of decimal places if an argument is passed.
|
|
2591
|
+
|
|
2592
|
+
[horizontal]
|
|
2593
|
+
Category::: Math Operations
|
|
2594
|
+
|
|
2595
|
+
[vertical]
|
|
2596
|
+
Examples:::
|
|
2597
|
+
+
|
|
2598
|
+
====
|
|
2599
|
+
.Input
|
|
2600
|
+
[source,liquid]
|
|
2601
|
+
----
|
|
2602
|
+
{{ 1.2 | round }}
|
|
2603
|
+
----
|
|
2604
|
+
|
|
2605
|
+
.Output
|
|
2606
|
+
[source,liquid]
|
|
2607
|
+
----
|
|
2608
|
+
1
|
|
2609
|
+
----
|
|
2610
|
+
====
|
|
2611
|
+
+
|
|
2612
|
+
====
|
|
2613
|
+
.Input
|
|
2614
|
+
[source,liquid]
|
|
2615
|
+
----
|
|
2616
|
+
{{ 2.7 | round }}
|
|
2617
|
+
----
|
|
2618
|
+
|
|
2619
|
+
.Output
|
|
2620
|
+
[source,liquid]
|
|
2621
|
+
----
|
|
2622
|
+
3
|
|
2623
|
+
----
|
|
2624
|
+
====
|
|
2625
|
+
+
|
|
2626
|
+
====
|
|
2627
|
+
.Input
|
|
2628
|
+
[source,liquid]
|
|
2629
|
+
----
|
|
2630
|
+
{{ 183.357 | round: 2 }}
|
|
2631
|
+
----
|
|
2632
|
+
|
|
2633
|
+
.Output
|
|
2634
|
+
[source,liquid]
|
|
2635
|
+
----
|
|
2636
|
+
183.36
|
|
2637
|
+
----
|
|
2638
|
+
====
|
|
2639
|
+
--
|
|
2640
|
+
[[filter__rstrip,Right Strip]]
|
|
2641
|
+
Right Strip (`rstrip`)::
|
|
2642
|
+
+
|
|
2643
|
+
--
|
|
2644
|
+
Removes whitespace (tabs, spaces, newlines) from the right side of a
|
|
2645
|
+
string. Does not affect spaces between words.
|
|
2646
|
+
|
|
2647
|
+
|
|
2648
|
+
[horizontal]
|
|
2649
|
+
Category::: String Conversion
|
|
2650
|
+
|
|
2651
|
+
[vertical]
|
|
2652
|
+
Examples:::
|
|
2653
|
+
+
|
|
2654
|
+
====
|
|
2655
|
+
.Input
|
|
2656
|
+
[source,liquid]
|
|
2657
|
+
----
|
|
2658
|
+
{{ " So much room " | rstrip }}!
|
|
2659
|
+
----
|
|
2660
|
+
|
|
2661
|
+
.Output
|
|
2662
|
+
[source,liquid]
|
|
2663
|
+
----
|
|
2664
|
+
So much room!
|
|
2665
|
+
----
|
|
2666
|
+
====
|
|
2667
|
+
--
|
|
2668
|
+
[[filter__size,Size]]
|
|
2669
|
+
Size (`size`)::
|
|
2670
|
+
+
|
|
2671
|
+
--
|
|
2672
|
+
Returns the number of characters in a string, or the number of items in an array.
|
|
2673
|
+
|
|
2674
|
+
[horizontal]
|
|
2675
|
+
Category::: Object Analysis
|
|
2676
|
+
|
|
2677
|
+
[vertical]
|
|
2678
|
+
Examples:::
|
|
2679
|
+
+
|
|
2680
|
+
====
|
|
2681
|
+
.Input
|
|
2682
|
+
[source,liquid]
|
|
2683
|
+
----
|
|
2684
|
+
{{ "Ground control to Major Tom." | size }}
|
|
2685
|
+
----
|
|
2686
|
+
|
|
2687
|
+
.Output
|
|
2688
|
+
[source,liquid]
|
|
2689
|
+
----
|
|
2690
|
+
28
|
|
2691
|
+
----
|
|
2692
|
+
====
|
|
2693
|
+
--
|
|
2694
|
+
[[filter__slice,Slice]]
|
|
2695
|
+
Slice (`slice`)::
|
|
2696
|
+
+
|
|
2697
|
+
--
|
|
2698
|
+
Returns a substring or array slice, starting at the index given by the
|
|
2699
|
+
first argument. An optional second argument gives the length. Negative
|
|
2700
|
+
indices count from the end.
|
|
2701
|
+
|
|
2702
|
+
|
|
2703
|
+
[horizontal]
|
|
2704
|
+
Category::: Object Conversion
|
|
2705
|
+
|
|
2706
|
+
[vertical]
|
|
2707
|
+
Examples:::
|
|
2708
|
+
+
|
|
2709
|
+
====
|
|
2710
|
+
.Input
|
|
2711
|
+
[source,liquid]
|
|
2712
|
+
----
|
|
2713
|
+
{{ "Liquid" | slice: 0 }}
|
|
2714
|
+
----
|
|
2715
|
+
|
|
2716
|
+
.Output
|
|
2717
|
+
[source,liquid]
|
|
2718
|
+
----
|
|
2719
|
+
L
|
|
2720
|
+
----
|
|
2721
|
+
====
|
|
2722
|
+
+
|
|
2723
|
+
====
|
|
2724
|
+
.Input
|
|
2725
|
+
[source,liquid]
|
|
2726
|
+
----
|
|
2727
|
+
{{ "Liquid" | slice: 2, 3 }}
|
|
2728
|
+
----
|
|
2729
|
+
|
|
2730
|
+
.Output
|
|
2731
|
+
[source,liquid]
|
|
2732
|
+
----
|
|
2733
|
+
qui
|
|
2734
|
+
----
|
|
2735
|
+
====
|
|
2736
|
+
+
|
|
2737
|
+
====
|
|
2738
|
+
.Input
|
|
2739
|
+
[source,liquid]
|
|
2740
|
+
----
|
|
2741
|
+
{{ "Liquid" | slice: -3, 2 }}
|
|
2742
|
+
----
|
|
2743
|
+
|
|
2744
|
+
.Output
|
|
2745
|
+
[source,liquid]
|
|
2746
|
+
----
|
|
2747
|
+
ui
|
|
2748
|
+
----
|
|
2749
|
+
====
|
|
2750
|
+
--
|
|
2751
|
+
[[filter__split,Split]]
|
|
2752
|
+
Split (`split`)::
|
|
2753
|
+
+
|
|
2754
|
+
--
|
|
2755
|
+
Divides a string into an array using the argument as a separator.
|
|
2756
|
+
Commonly used to convert delimited text into an array.
|
|
2757
|
+
|
|
2758
|
+
|
|
2759
|
+
[horizontal]
|
|
2760
|
+
Category::: Object Conversion
|
|
2761
|
+
|
|
2762
|
+
[vertical]
|
|
2763
|
+
Examples:::
|
|
2764
|
+
+
|
|
2765
|
+
====
|
|
2766
|
+
.Input
|
|
2767
|
+
[source,liquid]
|
|
2768
|
+
----
|
|
2769
|
+
{% assign beatles = "John, Paul, George, Ringo" | split: ", " %}
|
|
2770
|
+
{{ beatles | join: "|" }}
|
|
2771
|
+
|
|
2772
|
+
----
|
|
2773
|
+
|
|
2774
|
+
.Output
|
|
2775
|
+
[source,liquid]
|
|
2776
|
+
----
|
|
2777
|
+
John|Paul|George|Ringo
|
|
2778
|
+
----
|
|
2779
|
+
====
|
|
2780
|
+
--
|
|
2781
|
+
[[filter__strip,Strip]]
|
|
2782
|
+
Strip (`strip`)::
|
|
2783
|
+
+
|
|
2784
|
+
--
|
|
2785
|
+
Removes whitespace (tabs, spaces, newlines) from both sides of a
|
|
2786
|
+
string. Does not affect spaces between words.
|
|
2787
|
+
|
|
2788
|
+
|
|
2789
|
+
[horizontal]
|
|
2790
|
+
Category::: String Conversion
|
|
2791
|
+
|
|
2792
|
+
[vertical]
|
|
2793
|
+
Examples:::
|
|
2794
|
+
+
|
|
2795
|
+
====
|
|
2796
|
+
.Input
|
|
2797
|
+
[source,liquid]
|
|
2798
|
+
----
|
|
2799
|
+
{{ " So much room " | strip }}!
|
|
2800
|
+
----
|
|
2801
|
+
|
|
2802
|
+
.Output
|
|
2803
|
+
[source,liquid]
|
|
2804
|
+
----
|
|
2805
|
+
So much room!
|
|
2806
|
+
----
|
|
2807
|
+
====
|
|
2808
|
+
--
|
|
2809
|
+
[[filter__strip_html,Strip HTML]]
|
|
2810
|
+
Strip HTML (`strip_html`)::
|
|
2811
|
+
+
|
|
2812
|
+
--
|
|
2813
|
+
Removes any HTML tags from a string.
|
|
2814
|
+
|
|
2815
|
+
[horizontal]
|
|
2816
|
+
Category::: String Conversion
|
|
2817
|
+
|
|
2818
|
+
[vertical]
|
|
2819
|
+
Examples:::
|
|
2820
|
+
+
|
|
2821
|
+
====
|
|
2822
|
+
.Input
|
|
2823
|
+
[source,liquid]
|
|
2824
|
+
----
|
|
2825
|
+
{{ "Have <em>you</em> read <strong>Ulysses</strong>?" | strip_html }}
|
|
2826
|
+
----
|
|
2827
|
+
|
|
2828
|
+
.Output
|
|
2829
|
+
[source,liquid]
|
|
2830
|
+
----
|
|
2831
|
+
Have you read Ulysses?
|
|
2832
|
+
----
|
|
2833
|
+
====
|
|
2834
|
+
--
|
|
2835
|
+
[[filter__strip_newlines,Strip Newlines]]
|
|
2836
|
+
Strip Newlines (`strip_newlines`)::
|
|
2837
|
+
+
|
|
2838
|
+
--
|
|
2839
|
+
Removes any newline characters from a string.
|
|
2840
|
+
|
|
2841
|
+
[horizontal]
|
|
2842
|
+
Category::: String Conversion
|
|
2843
|
+
|
|
2844
|
+
[vertical]
|
|
2845
|
+
Examples:::
|
|
2846
|
+
+
|
|
2847
|
+
====
|
|
2848
|
+
.Input
|
|
2849
|
+
[source,liquid]
|
|
2850
|
+
----
|
|
2851
|
+
{% capture s %}Hello
|
|
2852
|
+
there{% endcapture %}{{ s | strip_newlines }}
|
|
2853
|
+
|
|
2854
|
+
----
|
|
2855
|
+
|
|
2856
|
+
.Output
|
|
2857
|
+
[source,liquid]
|
|
2858
|
+
----
|
|
2859
|
+
Hellothere
|
|
2860
|
+
----
|
|
2861
|
+
====
|
|
2862
|
+
--
|
|
2863
|
+
[[filter__times,Times (multiply)]]
|
|
2864
|
+
Times (multiply) (`times`)::
|
|
2865
|
+
+
|
|
2866
|
+
--
|
|
2867
|
+
Multiplies a number by another number.
|
|
2868
|
+
|
|
2869
|
+
[horizontal]
|
|
2870
|
+
Category::: Math Operations
|
|
2871
|
+
|
|
2872
|
+
[vertical]
|
|
2873
|
+
Examples:::
|
|
2874
|
+
+
|
|
2875
|
+
====
|
|
2876
|
+
.Input
|
|
2877
|
+
[source,liquid]
|
|
2878
|
+
----
|
|
2879
|
+
{{ 3 | times: 2 }}
|
|
2880
|
+
----
|
|
2881
|
+
|
|
2882
|
+
.Output
|
|
2883
|
+
[source,liquid]
|
|
2884
|
+
----
|
|
2885
|
+
6
|
|
2886
|
+
----
|
|
2887
|
+
====
|
|
2888
|
+
--
|
|
2889
|
+
[[filter__truncate,Truncate]]
|
|
2890
|
+
Truncate (`truncate`)::
|
|
2891
|
+
+
|
|
2892
|
+
--
|
|
2893
|
+
Shortens a string to the given number of characters. If shortened, an
|
|
2894
|
+
ellipsis (`...`) is appended and counts against the total; pass a
|
|
2895
|
+
second argument to use a different (or no) ellipsis.
|
|
2896
|
+
|
|
2897
|
+
|
|
2898
|
+
[horizontal]
|
|
2899
|
+
Category::: String Management
|
|
2900
|
+
|
|
2901
|
+
[vertical]
|
|
2902
|
+
Examples:::
|
|
2903
|
+
+
|
|
2904
|
+
====
|
|
2905
|
+
.Input
|
|
2906
|
+
[source,liquid]
|
|
2907
|
+
----
|
|
2908
|
+
{{ "Ground control to Major Tom." | truncate: 20 }}
|
|
2909
|
+
----
|
|
2910
|
+
|
|
2911
|
+
.Output
|
|
2912
|
+
[source,liquid]
|
|
2913
|
+
----
|
|
2914
|
+
Ground control to...
|
|
2915
|
+
----
|
|
2916
|
+
====
|
|
2917
|
+
+
|
|
2918
|
+
====
|
|
2919
|
+
.Input
|
|
2920
|
+
[source,liquid]
|
|
2921
|
+
----
|
|
2922
|
+
{{ "Ground control to Major Tom." | truncate: 25, ", and so on" }}
|
|
2923
|
+
----
|
|
2924
|
+
|
|
2925
|
+
.Output
|
|
2926
|
+
[source,liquid]
|
|
2927
|
+
----
|
|
2928
|
+
Ground control, and so on
|
|
2929
|
+
----
|
|
2930
|
+
====
|
|
2931
|
+
--
|
|
2932
|
+
[[filter__truncatewords,Truncate Words]]
|
|
2933
|
+
Truncate Words (`truncatewords`)::
|
|
2934
|
+
+
|
|
2935
|
+
--
|
|
2936
|
+
Shortens a string to the given number of words. If shortened, an
|
|
2937
|
+
ellipsis (`...`) is appended; pass a second argument to use a
|
|
2938
|
+
different (or no) ellipsis.
|
|
2939
|
+
|
|
2940
|
+
|
|
2941
|
+
[horizontal]
|
|
2942
|
+
Category::: String Conversion
|
|
2943
|
+
|
|
2944
|
+
[vertical]
|
|
2945
|
+
Examples:::
|
|
2946
|
+
+
|
|
2947
|
+
====
|
|
2948
|
+
.Input
|
|
2949
|
+
[source,liquid]
|
|
2950
|
+
----
|
|
2951
|
+
{{ "Ground control to Major Tom." | truncatewords: 3 }}
|
|
2952
|
+
----
|
|
2953
|
+
|
|
2954
|
+
.Output
|
|
2955
|
+
[source,liquid]
|
|
2956
|
+
----
|
|
2957
|
+
Ground control to...
|
|
2958
|
+
----
|
|
2959
|
+
====
|
|
2960
|
+
--
|
|
2961
|
+
[[filter__uniq,Uniq]]
|
|
2962
|
+
Uniq (`uniq`)::
|
|
2963
|
+
+
|
|
2964
|
+
--
|
|
2965
|
+
Removes any duplicate items from an array, preserving the first occurrence's order.
|
|
2966
|
+
|
|
2967
|
+
[horizontal]
|
|
2968
|
+
Category::: Array Management
|
|
2969
|
+
|
|
2970
|
+
[vertical]
|
|
2971
|
+
Examples:::
|
|
2972
|
+
+
|
|
2973
|
+
====
|
|
2974
|
+
.Input
|
|
2975
|
+
[source,liquid]
|
|
2976
|
+
----
|
|
2977
|
+
{% assign arr = "ants, bugs, bees, bugs, ants" | split: ", " %}
|
|
2978
|
+
{{ arr | uniq | join: "," }}
|
|
2979
|
+
|
|
2980
|
+
----
|
|
2981
|
+
|
|
2982
|
+
.Output
|
|
2983
|
+
[source,liquid]
|
|
2984
|
+
----
|
|
2985
|
+
ants,bugs,bees
|
|
2986
|
+
----
|
|
2987
|
+
====
|
|
2988
|
+
--
|
|
2989
|
+
[[filter__upcase,Upcase]]
|
|
2990
|
+
Upcase (`upcase`)::
|
|
2991
|
+
+
|
|
2992
|
+
--
|
|
2993
|
+
Makes each character in a string uppercase.
|
|
2994
|
+
|
|
2995
|
+
[horizontal]
|
|
2996
|
+
Category::: String Conversion
|
|
2997
|
+
|
|
2998
|
+
[vertical]
|
|
2999
|
+
Examples:::
|
|
3000
|
+
+
|
|
3001
|
+
====
|
|
3002
|
+
.Input
|
|
3003
|
+
[source,liquid]
|
|
3004
|
+
----
|
|
3005
|
+
{{ "Parker Moore" | upcase }}
|
|
3006
|
+
----
|
|
3007
|
+
|
|
3008
|
+
.Output
|
|
3009
|
+
[source,liquid]
|
|
3010
|
+
----
|
|
3011
|
+
PARKER MOORE
|
|
3012
|
+
----
|
|
3013
|
+
====
|
|
3014
|
+
--
|
|
3015
|
+
[[filter__url_decode,URL Decode]]
|
|
3016
|
+
URL Decode (`url_decode`)::
|
|
3017
|
+
+
|
|
3018
|
+
--
|
|
3019
|
+
Decodes a string that has been encoded as a URL, or by `url_encode`.
|
|
3020
|
+
|
|
3021
|
+
[horizontal]
|
|
3022
|
+
Category::: String Recode
|
|
3023
|
+
|
|
3024
|
+
[vertical]
|
|
3025
|
+
Examples:::
|
|
3026
|
+
+
|
|
3027
|
+
====
|
|
3028
|
+
.Input
|
|
3029
|
+
[source,liquid]
|
|
3030
|
+
----
|
|
3031
|
+
{{ "%27Stop%21%27+said+Fred" | url_decode }}
|
|
3032
|
+
----
|
|
3033
|
+
|
|
3034
|
+
.Output
|
|
3035
|
+
[source,liquid]
|
|
3036
|
+
----
|
|
3037
|
+
'Stop!' said Fred
|
|
3038
|
+
----
|
|
3039
|
+
====
|
|
3040
|
+
--
|
|
3041
|
+
[[filter__url_encode,URL Encode]]
|
|
3042
|
+
URL Encode (`url_encode`)::
|
|
3043
|
+
+
|
|
3044
|
+
--
|
|
3045
|
+
Converts any URL-unsafe characters in a string into percent-encoded
|
|
3046
|
+
characters. A space becomes a `+` rather than a percent-encoded
|
|
3047
|
+
character.
|
|
3048
|
+
|
|
3049
|
+
|
|
3050
|
+
[horizontal]
|
|
3051
|
+
Category::: String Recode
|
|
3052
|
+
|
|
3053
|
+
[vertical]
|
|
3054
|
+
Examples:::
|
|
3055
|
+
+
|
|
3056
|
+
====
|
|
3057
|
+
.Input
|
|
3058
|
+
[source,liquid]
|
|
3059
|
+
----
|
|
3060
|
+
{{ "john@liquid.com" | url_encode }}
|
|
3061
|
+
----
|
|
3062
|
+
|
|
3063
|
+
.Output
|
|
3064
|
+
[source,liquid]
|
|
3065
|
+
----
|
|
3066
|
+
john%40liquid.com
|
|
3067
|
+
----
|
|
3068
|
+
====
|
|
3069
|
+
+
|
|
3070
|
+
====
|
|
3071
|
+
.Input
|
|
3072
|
+
[source,liquid]
|
|
3073
|
+
----
|
|
3074
|
+
{{ "Tetsuro Takara" | url_encode }}
|
|
3075
|
+
----
|
|
3076
|
+
|
|
3077
|
+
.Output
|
|
3078
|
+
[source,liquid]
|
|
3079
|
+
----
|
|
3080
|
+
Tetsuro+Takara
|
|
3081
|
+
----
|
|
3082
|
+
====
|
|
3083
|
+
--
|
|
3084
|
+
// end::shopify[]
|
|
3085
|
+
|
|
3086
|
+
:example-capition!:
|
|
3087
|
+
|
|
3088
|
+
[[schemagraphy]]
|
|
3089
|
+
== Filters from schemagraphy
|
|
3090
|
+
|
|
3091
|
+
// tag::schemagraphy[]
|
|
3092
|
+
[[filter__sgyml_type,SGYML Type]]
|
|
3093
|
+
SGYML Type (`sgyml_type`)::
|
|
3094
|
+
+
|
|
3095
|
+
--
|
|
3096
|
+
|
|
3097
|
+
|
|
3098
|
+
[horizontal]
|
|
3099
|
+
Category::: data-type
|
|
3100
|
+
--
|
|
3101
|
+
// end::schemagraphy[]
|
|
3102
|
+
|
|
3103
|
+
:example-capition!:
|
|
3104
|
+
|
|
3105
|
+
[[jekyll-asciidoc]]
|
|
3106
|
+
== Filters from jekyll-asciidoc
|
|
3107
|
+
|
|
3108
|
+
// tag::jekyll-asciidoc[]
|
|
3109
|
+
[[filter__asciidocify,AsciiDocify]]
|
|
3110
|
+
AsciiDocify (`asciidocify`)::
|
|
3111
|
+
+
|
|
3112
|
+
--
|
|
3113
|
+
Convert an AsciiDoc string to HTML, with or without paragraphing.
|
|
3114
|
+
|
|
3115
|
+
[horizontal]
|
|
3116
|
+
Category::: String Conversion
|
|
3117
|
+
|
|
3118
|
+
[vertical]
|
|
3119
|
+
Examples:::
|
|
3120
|
+
+
|
|
3121
|
+
====
|
|
3122
|
+
.Input
|
|
3123
|
+
[source,liquid]
|
|
3124
|
+
----
|
|
3125
|
+
{{ "Test with *bold* and a http://example.com[link]." | asciidocify }}
|
|
3126
|
+
|
|
3127
|
+
----
|
|
3128
|
+
|
|
3129
|
+
.Output
|
|
3130
|
+
[source,liquid]
|
|
3131
|
+
----
|
|
3132
|
+
<div class="paragraph">
|
|
3133
|
+
<p>Test with <strong>bold</strong> and a <a href="http://example.com">link</a>.</p>
|
|
3134
|
+
</div>
|
|
3135
|
+
|
|
3136
|
+
----
|
|
3137
|
+
====
|
|
3138
|
+
+
|
|
3139
|
+
====
|
|
3140
|
+
.Input
|
|
3141
|
+
[source,liquid]
|
|
3142
|
+
----
|
|
3143
|
+
{{ "Test with *bold* and a http://example.com[link]." | asciidocify: "inline" }}
|
|
3144
|
+
|
|
3145
|
+
----
|
|
3146
|
+
|
|
3147
|
+
.Output
|
|
3148
|
+
[source,liquid]
|
|
3149
|
+
----
|
|
3150
|
+
Test with <strong>bold</strong> and a <a href="http://example.com">link</a>.
|
|
3151
|
+
|
|
3152
|
+
----
|
|
3153
|
+
====
|
|
3154
|
+
--
|
|
3155
|
+
// end::jekyll-asciidoc[]
|