mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-26 13:45:13 -07:00
Added a use case example for capture tag
This commit is contained in:
@@ -55,6 +55,24 @@ Captures the string inside of the opening and closing tags and assigns it to a v
|
|||||||
```text
|
```text
|
||||||
I am being captured.
|
I am being captured.
|
||||||
```
|
```
|
||||||
|
Using `capture`, you can create complex strings using other variables created with `assign`.
|
||||||
|
|
||||||
|
<p class="code-label">Input</p>
|
||||||
|
```text
|
||||||
|
{% assign favorite_food = 'pizza' %}
|
||||||
|
{% assign age = 35 %}
|
||||||
|
|
||||||
|
{% capture about_me %}
|
||||||
|
I am {{ age }} and my favorite food is {{ favorite_food }}.
|
||||||
|
{% endcapture %}
|
||||||
|
|
||||||
|
{{ about_me }}
|
||||||
|
```
|
||||||
|
|
||||||
|
<p class="code-label">Output</p>
|
||||||
|
```text
|
||||||
|
I am 35 and my favourite food is pizza.
|
||||||
|
```
|
||||||
|
|
||||||
## increment
|
## increment
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user