mirror of
https://github.com/kemko/liquid.git
synced 2026-01-03 08:45:42 +03:00
A lot more updates
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
---
|
||||
title: map
|
||||
---
|
||||
|
||||
Collects an array of properties from a hash.
|
||||
|
||||
| Code | Output |
|
||||
|-------------------------------------------------------:|:-------------------|
|
||||
| {% raw %}`{{ product | map: 'tag' }}`{% endraw %} | `["sale", "mens", "womens", "awesome"]` |
|
||||
|
||||
In the sample above, assume that `product` resolves to: `[{ tags: "sale"}, { tags: "mens"}, { tags: "womens"}, { tags: "awesome"}]`.
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
---
|
||||
title: minus
|
||||
---
|
||||
|
||||
Subtracts two numbers.
|
||||
|
||||
| Code | Output |
|
||||
|-------------------------------------------------------:|:-------------------|
|
||||
| {% raw %}`{{ 100 | minus: 10 }}`{% endraw %} | `90` |
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
---
|
||||
title: modulo
|
||||
---
|
||||
|
||||
Performs a modulo operation (eg., fetches the remainder).
|
||||
|
||||
| Code | Output |
|
||||
|-------------------------------------------------------:|:-------------------|
|
||||
| {% raw %}`{{ 2 | modulo: 2 }}`{% endraw %} | `1` |
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
---
|
||||
title: newline_to_br
|
||||
---
|
||||
|
||||
Replace every newline (`n`) with an HTML break (`<br>`).
|
||||
|
||||
| Code | Output |
|
||||
|-------------------------------------------------------:|:-------------------|
|
||||
| {% raw %}`{{ "hello\nthere" | newline_to_br }}`{% endraw %} | `hello<br/>there` |
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
---
|
||||
title: plus
|
||||
---
|
||||
|
||||
Adds two numbers.
|
||||
|
||||
| Code | Output |
|
||||
|-------------------------------------------------------:|:-------------------|
|
||||
| {% raw %}`{{ 100 | plus: 10 }}`{% endraw %} | `110` |
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
---
|
||||
title: prepend
|
||||
---
|
||||
|
||||
Prepends a string onto another.
|
||||
|
||||
| Code | Output |
|
||||
|-------------------------------------------------------:|:-------------------|
|
||||
| {% raw %}`{{ 'world' | prepend: 'hello ' }}`{% endraw %} | `hello world` |
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
---
|
||||
title: remove
|
||||
---
|
||||
|
||||
Removes every occurrence of a given string.
|
||||
|
||||
| Code | Output |
|
||||
|-------------------------------------------------------:|:-------------------|
|
||||
| {% raw %}`{{ 'hello, hello world' | remove: 'hello' }}`{% endraw %} | `, world` |
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
---
|
||||
title: remove_first
|
||||
---
|
||||
|
||||
Removes the first occurrence of a given string.
|
||||
|
||||
| Code | Output |
|
||||
|-------------------------------------------------------:|:-------------------|
|
||||
| {% raw %}`{{ 'hello, hello world' | remove_first: 'hello' }}`{% endraw %} | `, hello world` |
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
---
|
||||
title: replace
|
||||
---
|
||||
|
||||
Replaces every occurrence of a given string.
|
||||
|
||||
| Code | Output |
|
||||
|-------------------------------------------------------:|:-------------------|
|
||||
| {% raw %}`{{ 'hello, hello world' | replace: 'hello', 'goodbye' }}`{% endraw %} | `goodbye, goodbye world` |
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
---
|
||||
title: replace_first
|
||||
---
|
||||
|
||||
Replaces the first occurrence of a given string.
|
||||
|
||||
| Code | Output |
|
||||
|-------------------------------------------------------:|:-------------------|
|
||||
| {% raw %}`{{ 'hello, hello world' | replace_first: 'hello', 'goodbye' }}`{% endraw %} | `goodbye, hello world` |
|
||||
|
||||
Reference in New Issue
Block a user