From 1aeb8a33052aafb73faa450c93e8ba00c02e7df2 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Fri, 20 Mar 2015 16:51:51 -0700 Subject: [PATCH] A lot more updates --- _filters/map.md | 8 ++++++++ _filters/minus.md | 6 ++++++ _filters/modulo.md | 6 ++++++ _filters/newline_to_br.md | 6 ++++++ _filters/plus.md | 6 ++++++ _filters/prepend.md | 6 ++++++ _filters/remove.md | 6 ++++++ _filters/remove_first.md | 6 ++++++ _filters/replace.md | 6 ++++++ _filters/replace_first.md | 6 ++++++ 10 files changed, 62 insertions(+) diff --git a/_filters/map.md b/_filters/map.md index 4f61c75..c6f82e6 100644 --- a/_filters/map.md +++ b/_filters/map.md @@ -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"}]`. diff --git a/_filters/minus.md b/_filters/minus.md index 3a15ef0..890b1d4 100644 --- a/_filters/minus.md +++ b/_filters/minus.md @@ -1,3 +1,9 @@ --- title: minus --- + +Subtracts two numbers. + +| Code | Output | +|-------------------------------------------------------:|:-------------------| +| {% raw %}`{{ 100 | minus: 10 }}`{% endraw %} | `90` | diff --git a/_filters/modulo.md b/_filters/modulo.md index cb24318..ccbe87a 100644 --- a/_filters/modulo.md +++ b/_filters/modulo.md @@ -1,3 +1,9 @@ --- title: modulo --- + +Performs a modulo operation (eg., fetches the remainder). + +| Code | Output | +|-------------------------------------------------------:|:-------------------| +| {% raw %}`{{ 2 | modulo: 2 }}`{% endraw %} | `1` | diff --git a/_filters/newline_to_br.md b/_filters/newline_to_br.md index f06db7a..9084229 100644 --- a/_filters/newline_to_br.md +++ b/_filters/newline_to_br.md @@ -1,3 +1,9 @@ --- title: newline_to_br --- + +Replace every newline (`n`) with an HTML break (`
`). + +| Code | Output | +|-------------------------------------------------------:|:-------------------| +| {% raw %}`{{ "hello\nthere" | newline_to_br }}`{% endraw %} | `hello
there` | diff --git a/_filters/plus.md b/_filters/plus.md index e1c36b4..d8aceee 100644 --- a/_filters/plus.md +++ b/_filters/plus.md @@ -1,3 +1,9 @@ --- title: plus --- + +Adds two numbers. + +| Code | Output | +|-------------------------------------------------------:|:-------------------| +| {% raw %}`{{ 100 | plus: 10 }}`{% endraw %} | `110` | diff --git a/_filters/prepend.md b/_filters/prepend.md index 804e35e..cddfaac 100644 --- a/_filters/prepend.md +++ b/_filters/prepend.md @@ -1,3 +1,9 @@ --- title: prepend --- + +Prepends a string onto another. + +| Code | Output | +|-------------------------------------------------------:|:-------------------| +| {% raw %}`{{ 'world' | prepend: 'hello ' }}`{% endraw %} | `hello world` | diff --git a/_filters/remove.md b/_filters/remove.md index 36b34a8..b0842e6 100644 --- a/_filters/remove.md +++ b/_filters/remove.md @@ -1,3 +1,9 @@ --- title: remove --- + +Removes every occurrence of a given string. + +| Code | Output | +|-------------------------------------------------------:|:-------------------| +| {% raw %}`{{ 'hello, hello world' | remove: 'hello' }}`{% endraw %} | `, world` | diff --git a/_filters/remove_first.md b/_filters/remove_first.md index 9ccc7c4..468b000 100644 --- a/_filters/remove_first.md +++ b/_filters/remove_first.md @@ -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` | diff --git a/_filters/replace.md b/_filters/replace.md index 17c614c..e661be3 100644 --- a/_filters/replace.md +++ b/_filters/replace.md @@ -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` | diff --git a/_filters/replace_first.md b/_filters/replace_first.md index 25d3229..6eb958e 100644 --- a/_filters/replace_first.md +++ b/_filters/replace_first.md @@ -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` |