Add some more docs

This commit is contained in:
Garen Torikian
2015-03-15 22:10:36 -07:00
parent 601e49dc55
commit d65511e328
6 changed files with 54 additions and 0 deletions
+9
View File
@@ -1,3 +1,12 @@
---
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.
+10
View File
@@ -1,3 +1,13 @@
---
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.
+8
View File
@@ -1,3 +1,11 @@
---
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"]`.
+11
View File
@@ -1,3 +1,14 @@
---
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.
+8
View File
@@ -1,3 +1,11 @@
---
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"]`.
+8
View File
@@ -1,3 +1,11 @@
---
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"]`.