mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-29 07:05:12 -07:00
Merge pull request #1 from parkr/updates-to-doc-update
Continue updating documentation
This commit is contained in:
@@ -1,3 +1,12 @@
|
|||||||
---
|
---
|
||||||
title: date
|
title: date
|
||||||
---
|
---
|
||||||
|
|
||||||
|
`date` converts a timestamp into another date format.
|
||||||
|
|
||||||
|
| Input | Output |
|
||||||
|
|--------------------------------------------------------------------------:|:---------------------|
|
||||||
|
| {% raw %}`{{ article.published_at | date: "%a, %b %d, %y" }}`{% endraw %} | Tue, Apr 22, 14 |
|
||||||
|
| {% raw %}`{{ article.published_at | date: "%Y" }}`{% endraw %} | 2014 |
|
||||||
|
|
||||||
|
The format for this syntax is the same as [`strftime`](http://strftime.net/).
|
||||||
|
|||||||
@@ -1,3 +1,12 @@
|
|||||||
---
|
---
|
||||||
title: escape
|
title: escape
|
||||||
---
|
---
|
||||||
|
|
||||||
|
Escapes a string by replacing characters with escape sequences (so that the string can be used in a URI).
|
||||||
|
|
||||||
|
| Code | Output |
|
||||||
|
|-------------------------------------------------------:|:-------------------|
|
||||||
|
| {% raw %}`{{ "Need tips? Ask a friend!" | escape }}`{% endraw %} | `"Need%20tips%3F%Ask%20a%20friend%21"` |
|
||||||
|
| {% raw %}`{{ "Nope" | escape }}`{% endraw %} | `"Nope"` |
|
||||||
|
|
||||||
|
It doesn't modify strings that have nothing to escape.
|
||||||
|
|||||||
@@ -1,3 +1,13 @@
|
|||||||
---
|
---
|
||||||
title: escape_once
|
title: escape_once
|
||||||
---
|
---
|
||||||
|
|
||||||
|
Escapes a string without affecting existing escaped entities.
|
||||||
|
|
||||||
|
| Code | Output |
|
||||||
|
|-------------------------------------------------------:|:-------------------|
|
||||||
|
| {% raw %}`{{ "1 < 2 & 3" | escape_once }}`{% endraw %} | `"1 < 2 & 3"` |
|
||||||
|
| {% raw %}`{{ "<< Accept & Checkout" | escape_once }}`{% endraw %} | `"<< Accept & Checkout"` |
|
||||||
|
| {% raw %}`{{ "Nope" | escape_once }}`{% endraw %} | `"Nope"` |
|
||||||
|
|
||||||
|
It doesn't modify strings that have nothing to escape.
|
||||||
|
|||||||
@@ -1,3 +1,11 @@
|
|||||||
---
|
---
|
||||||
title: first
|
title: first
|
||||||
---
|
---
|
||||||
|
|
||||||
|
Return the first element of an array.
|
||||||
|
|
||||||
|
| Code | Output |
|
||||||
|
|-------------------------------------------------------:|:-------------------|
|
||||||
|
| {% raw %}`{{ product.tags | first }}`{% endraw %} | `"sale"` |
|
||||||
|
|
||||||
|
In the sample above, assume that `product.tags` resolves to: `["sale", "mens", "womens", "awesome"]`.
|
||||||
|
|||||||
@@ -1,3 +1,14 @@
|
|||||||
---
|
---
|
||||||
title: floor
|
title: floor
|
||||||
---
|
---
|
||||||
|
|
||||||
|
`floor` rounds the input down to the nearest whole number.
|
||||||
|
|
||||||
|
| Input | Output |
|
||||||
|
|-------------------------------------------:|:-------|
|
||||||
|
| {% raw %}`{{ 1.2 | floor }}` {% endraw %} | 1 |
|
||||||
|
| {% raw %}`{{ 1.7 | floor }}` {% endraw %} | 1 |
|
||||||
|
| {% raw %}`{{ 2.0 | floor }}` {% endraw %} | 2 |
|
||||||
|
| {% raw %}`{{ "18.3" | floor }}`{% endraw %} | 18 |
|
||||||
|
|
||||||
|
It will attempt to cast any input to a number.
|
||||||
|
|||||||
@@ -1,3 +1,11 @@
|
|||||||
---
|
---
|
||||||
title: join
|
title: join
|
||||||
---
|
---
|
||||||
|
|
||||||
|
`join` joins the elements of an array, using the character you provide.
|
||||||
|
|
||||||
|
| Code | Output |
|
||||||
|
|-------------------------------------------------------:|:-------------------|
|
||||||
|
| {% raw %}`{{ product.tags | join: ', ' }}`{% endraw %} | `"sale, mens, womens, awesome` |
|
||||||
|
|
||||||
|
In the sample above, assume that `product.tags` resolves to: `["sale", "mens", "womens", "awesome"]`.
|
||||||
|
|||||||
@@ -1,3 +1,11 @@
|
|||||||
---
|
---
|
||||||
title: last
|
title: last
|
||||||
---
|
---
|
||||||
|
|
||||||
|
Return the last element of an array.
|
||||||
|
|
||||||
|
| Code | Output |
|
||||||
|
|-------------------------------------------------------:|:-------------------|
|
||||||
|
| {% raw %}`{{ product.tags | last }}`{% endraw %} | `"awesome"` |
|
||||||
|
|
||||||
|
In the sample above, assume that `product.tags` resolves to: `["sale", "mens", "womens", "awesome"]`.
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ $on-laptop: 900px;
|
|||||||
width: $sidebar-width;
|
width: $sidebar-width;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
|
overflow: scroll;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar--logo {
|
.sidebar--logo {
|
||||||
|
|||||||
Reference in New Issue
Block a user