From c744422d0ef60f78530a6abf8ee561edb523b5f7 Mon Sep 17 00:00:00 2001 From: Tetsuro Date: Thu, 15 Oct 2015 11:45:13 -0400 Subject: [PATCH] Added a bunch of missing filters, made some of the copy more consistent --- Gruntfile.js | 1 - _filters/append.md | 2 +- _filters/capitalize.md | 2 +- _filters/default.md | 6 +++--- _filters/divided_by.md | 2 +- _filters/downcase.md | 4 ++-- _filters/first.md | 3 +-- _filters/modulo.md | 4 ++-- _filters/reverse.md | 12 ++++++++++++ _filters/strip_html.md | 8 ++++++++ _filters/strip_newlines.md | 2 ++ _filters/times.md | 6 ++++++ _sass/modules/_base.scss | 1 + _tags/control-flow-tags.md | 4 +--- _tags/iteration-tags.md | 4 +--- _tags/theme-tags.md | 9 +-------- _tags/variable-tags.md | 4 +--- 17 files changed, 44 insertions(+), 30 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index ba8dd398..a1b7acc2 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -43,7 +43,6 @@ require('load-grunt-tasks')(grunt); } }, - postcss: { options: { map: true, diff --git a/_filters/append.md b/_filters/append.md index cfc79011..33b25f35 100644 --- a/_filters/append.md +++ b/_filters/append.md @@ -16,7 +16,7 @@ It can also be used with variables: {% highlight liquid %} {% raw %} {% assign filename = "/index.html" %} -{{ product.url | append:filename }} +{{ product.url | append: filename }} {% endraw %} # => "#{product.url}/index.html" {% endhighlight %} diff --git a/_filters/capitalize.md b/_filters/capitalize.md index 41da42bd..c91af9c4 100644 --- a/_filters/capitalize.md +++ b/_filters/capitalize.md @@ -2,7 +2,7 @@ title: capitalize --- -`capitalize` ensures the first character of your string is capitalized. +`capitalize` makes the first character of your string capitalized. | Input | Output | |:-----------------------------------------------------------|:-----------------| diff --git a/_filters/default.md b/_filters/default.md index fa24f7a7..0726fadb 100644 --- a/_filters/default.md +++ b/_filters/default.md @@ -2,11 +2,11 @@ title: default --- -`default` offers a means of having a fall-back value in case your value doesn't exist. +`default` offers a means of having a fallback in case your value doesn't exist. {% highlight liquid %} {% raw %} -{{ product_price | default:2.99 }} +{{ product_price | default: 2.99 }} // => outputs "2.99" {% assign product_price = 4.99 %} @@ -14,7 +14,7 @@ title: default // => outputs "4.99" {% assign product_price = "" %} -{{ product_price | default:2.99 }} +{{ product_price | default: 2.99 }} // => outputs "2.99" {% endraw %} {% endhighlight %} diff --git a/_filters/divided_by.md b/_filters/divided_by.md index ba26b263..7c8e52cd 100644 --- a/_filters/divided_by.md +++ b/_filters/divided_by.md @@ -2,7 +2,7 @@ title: divided_by --- -This filter divides its input by its parameter. +This filter divides its input by its argument. | Code | Output | |:--------------------------------------------------|:-------| diff --git a/_filters/downcase.md b/_filters/downcase.md index 979e31f7..91ce71c1 100644 --- a/_filters/downcase.md +++ b/_filters/downcase.md @@ -2,10 +2,10 @@ title: downcase --- -This filter makes the entire input string the lower case version of each character within. +`downcase` makes each character in a string lowercase. | Code | Output | |:-------------------------------------------------------|:-----------------| | {% raw %}`{{ "Peter Parker" | downcase }}`{% endraw %} | `"peter parker"` | -It doesn't modify strings which are already entirely lowercase. It works with anything that has a `#to_s` method. +It doesn't modify strings which are already entirely lowercase. diff --git a/_filters/first.md b/_filters/first.md index 200b5a8b..11228b70 100644 --- a/_filters/first.md +++ b/_filters/first.md @@ -2,10 +2,9 @@ title: first --- -Return the first element of an array. +Returns the first element of an array. For example, if you have an array called `product.tags` that resolves to: `["sale", "mens", "womens", "awesome"]`: | Code | Output | |:-------------------------------------------------------|:-------------------| | {% raw %}`{{ product.tags | first }}`{% endraw %} | `"sale"` | -In the sample above, assume that `product.tags` resolves to: `["sale", "mens", "womens", "awesome"]`. diff --git a/_filters/modulo.md b/_filters/modulo.md index c9b70b27..0d9b4e30 100644 --- a/_filters/modulo.md +++ b/_filters/modulo.md @@ -2,8 +2,8 @@ title: modulo --- -Performs a modulo operation (eg., fetches the remainder). +Performs a modulo operation, i.e. returns the remainder. | Code | Output | |:-------------------------------------------------------|:-------------------| -| {% raw %}`{{ 2 | modulo: 2 }}`{% endraw %} | `1` | +| {% raw %}`{{ 3 | modulo: 2 }}`{% endraw %} | `1` | diff --git a/_filters/reverse.md b/_filters/reverse.md index 3d0fe8a0..baa3dbb4 100644 --- a/_filters/reverse.md +++ b/_filters/reverse.md @@ -1,3 +1,15 @@ --- title: reverse --- + +Reverses the order of an array. + +{% highlight liquid %} +{% raw %} +{{ product.tags }} +// ['cool', 'sale', 'purple', 'awesome'] + +{{ product.tags | reverse }} +// ['awesome', 'purple', 'sale', 'cool'] +{% endraw %} +{% endhighlight %} diff --git a/_filters/strip_html.md b/_filters/strip_html.md index 1fdfb48f..7def0511 100644 --- a/_filters/strip_html.md +++ b/_filters/strip_html.md @@ -1,3 +1,11 @@ --- title: strip_html --- + +

Strips all HTML tags from a string.

+ +

Input

+ +| Code | Output | +|:-------------------------------------------------------|:-------------------| +| {% raw %}`{{ "

Hello

World" | strip_html }}`{% endraw %} | `Hello World` | diff --git a/_filters/strip_newlines.md b/_filters/strip_newlines.md index 9d3949d1..619eb73d 100644 --- a/_filters/strip_newlines.md +++ b/_filters/strip_newlines.md @@ -1,3 +1,5 @@ --- title: strip_newlines --- + +Removes any line breaks/newlines from a string. diff --git a/_filters/times.md b/_filters/times.md index 9589b443..407e0308 100644 --- a/_filters/times.md +++ b/_filters/times.md @@ -1,3 +1,9 @@ --- title: times --- + +Multiplies two numbers. + +| Code | Output | +|:-------------------------------------------------------|:-------------------| +| {% raw %}`{{ 200 | times: 2 }}`{% endraw %} | `400` | diff --git a/_sass/modules/_base.scss b/_sass/modules/_base.scss index f5b5fd3d..ddd20ac7 100644 --- a/_sass/modules/_base.scss +++ b/_sass/modules/_base.scss @@ -123,6 +123,7 @@ code { pre { padding: 8px 12px; + word-wrap: break-word; > code { border: 0; diff --git a/_tags/control-flow-tags.md b/_tags/control-flow-tags.md index 64298352..a8909e8e 100644 --- a/_tags/control-flow-tags.md +++ b/_tags/control-flow-tags.md @@ -1,9 +1,7 @@ --- -title: Control Flow Tags +title: Control Flow --- -# Control Flow Tags - Control Flow tags determine which block of code should be executed based on different conditions. diff --git a/_tags/iteration-tags.md b/_tags/iteration-tags.md index 0581d0f5..3cee979a 100644 --- a/_tags/iteration-tags.md +++ b/_tags/iteration-tags.md @@ -1,9 +1,7 @@ --- -title: Iteration Tags +title: Iteration --- -# Iteration Tags - Iteration Tags are used to run a block of code repeatedly. diff --git a/_tags/theme-tags.md b/_tags/theme-tags.md index dcc729ff..e8fe70fe 100644 --- a/_tags/theme-tags.md +++ b/_tags/theme-tags.md @@ -1,14 +1,7 @@ --- -layout: default -title: Theme Tags -landing_as_article: true - -nav: - group: Liquid Documentation - weight: 1 +title: Theme --- -# Theme Tags Theme Tags have various functions, including: diff --git a/_tags/variable-tags.md b/_tags/variable-tags.md index f358cf1a..50a76850 100644 --- a/_tags/variable-tags.md +++ b/_tags/variable-tags.md @@ -1,9 +1,7 @@ --- -title: Variable Tags +title: Variable --- -# Variable Tags - Variable Tags are used to create new Liquid variables.