diff --git a/_basics/introduction.md b/_basics/introduction.md index 0ed78cc..cdf3fd4 100644 --- a/_basics/introduction.md +++ b/_basics/introduction.md @@ -12,7 +12,7 @@ Liquid uses a combination of [**objects**](#objects), [**tags**](#tags), and [**
Input
```liquid -{% raw %} +{%- raw -%} {{ page.title }} {% endraw %} ``` @@ -30,7 +30,7 @@ In this case, Liquid is rendering the content of the `title` property of the `paInput
```liquid -{% raw %} +{%- raw -%} {% if user %} Hello {{ user.name }}! {% endif %} @@ -57,7 +57,7 @@ You can read more about each type of tag in their respective sections.Input
```liquid -{% raw %} +{%- raw -%} {{ "/my/fancy/url" | append: ".html" }} {% endraw %} ``` @@ -71,7 +71,7 @@ Multiple filters can be used on one output, and are applied from left to right.Input
```liquid -{% raw %} +{%- raw -%} {{ "adam!" | capitalize | prepend: "Hello " }} {% endraw %} ``` diff --git a/_basics/operators.md b/_basics/operators.md index 05e1759..a1858c9 100644 --- a/_basics/operators.md +++ b/_basics/operators.md @@ -47,7 +47,7 @@ Liquid includes many logical and comparison operators. You can use operators to For example: ```liquid -{% raw %} +{%- raw -%} {% if product.title == "Awesome Shoes" %} These shoes are awesome! {% endif %} @@ -57,7 +57,7 @@ For example: You can do multiple comparisons in a tag using the `and` and `or` operators: ```liquid -{% raw %} +{%- raw -%} {% if product.type == "Shirt" or product.type == "Shoes" %} This is a shirt or a pair of shoes. {% endif %} @@ -69,7 +69,7 @@ You can do multiple comparisons in a tag using the `and` and `or` operators: `contains` checks for the presence of a substring inside a string. ```liquid -{% raw %} +{%- raw -%} {% if product.title contains "Pack" %} This product's title contains the word Pack. {% endif %} @@ -79,7 +79,7 @@ You can do multiple comparisons in a tag using the `and` and `or` operators: `contains` can also check for the presence of a string in an array of strings. ```liquid -{% raw %} +{%- raw -%} {% if product.tags contains "Hello" %} This product has been tagged with "Hello". {% endif %} @@ -93,7 +93,7 @@ You can do multiple comparisons in a tag using the `and` and `or` operators: In tags with more than one `and` or `or` operator, operators are checked in order *from right to left*. You cannot change the order of operations using parentheses — parentheses are invalid characters in Liquid and will prevent your tags from working. ```liquid -{% raw %} +{%- raw -%} {% if true or false and false %} This evaluates to true, since the `and` condition is checked first. {% endif %} @@ -101,7 +101,7 @@ In tags with more than one `and` or `or` operator, operators are checked in orde ``` ```liquid -{% raw %} +{%- raw -%} {% if true and false and false or true %} This evaluates to false, since the tags are checked like this: diff --git a/_basics/truthy-and-falsy.md b/_basics/truthy-and-falsy.md index cc367f0..492b7ad 100644 --- a/_basics/truthy-and-falsy.md +++ b/_basics/truthy-and-falsy.md @@ -12,7 +12,7 @@ All values in Liquid are truthy except `nil` and `false`. In the example below, the text "Tobi" is not a boolean, but it is truthy in a conditional: ```liquid -{% raw %} +{%- raw -%} {% assign name = "Tobi" %} {% if name %} @@ -25,7 +25,7 @@ In the example below, the text "Tobi" is not a boolean, but it is truthy in a coInput
```liquid -{% raw %} +{%- raw -%} {% if page.category %}Input
```liquid -{% raw %} +{%- raw -%} The current user is {{ user.name }} {% endraw %} ``` @@ -88,7 +88,7 @@ To access all the items in an array, you can loop through each item in the arrayInput
```liquid -{% raw %} +{%- raw -%} {% for user in site.users %} {{ user }} @@ -107,7 +107,7 @@ You can use square bracket `[` `]` notation to access a specific item in an arraInput
```liquid -{% raw %} +{%- raw -%} {{ site.users[0] }} {{ site.users[1] }} @@ -133,7 +133,7 @@ You can, however, use the [`split`]({{ "/filters/split/" | prepend: site.baseurl An EmptyDrop object is returned if you try to access a deleted object. In the example below, `page_1`, `page_2` and `page_3` are all EmptyDrop objects: ```liquid -{% raw %} +{%- raw -%} {% assign variable = "hello" %} {% assign page_1 = pages[variable] %} {% assign page_2 = pages["does-not-exist"] %} @@ -146,7 +146,7 @@ An EmptyDrop object is returned if you try to access a deleted object. In the ex You can check to see if an object exists or not before you access any of its attributes. ```liquid -{% raw %} +{%- raw -%} {% unless pages == empty %}Input
```liquid -{% raw %} +{%- raw -%} {% assign my_variable = "tomato" %} {{ my_variable }} {% endraw %} @@ -27,7 +27,7 @@ By including a hyphen in your `assign` closing delimiter, you can strip the whitInput
```liquid -{% raw %} +{%- raw -%} {% assign my_variable = "tomato" -%} {{ my_variable }} {% endraw %} @@ -43,7 +43,7 @@ If you don't want any of your tags to print whitespace, as a general rule you caInput
```liquid -{% raw %} +{%- raw -%} {% assign username = "John G. Chalmers-Smith" %} {% if username and username.size > 10 %} Wow, {{ username }} , you have a long name! @@ -65,7 +65,7 @@ If you don't want any of your tags to print whitespace, as a general rule you caInput
```liquid -{% raw %} +{%- raw -%} {% assign username = "John G. Chalmers-Smith" -%} {%- if username and username.size > 10 -%} Wow, {{ username -}} , you have a long name! diff --git a/_filters/abs.md b/_filters/abs.md index 808551a..6763ecc 100644 --- a/_filters/abs.md +++ b/_filters/abs.md @@ -8,7 +8,7 @@ Returns the absolute value of a number.Input
```liquid -{% raw %} +{%- raw -%} {{ -17 | abs }} {{ 4 | abs }} {% endraw %} @@ -24,7 +24,7 @@ Returns the absolute value of a number.Input
```liquid -{% raw %} +{%- raw -%} {{ "-19.86" | abs }} {% endraw %} ``` diff --git a/_filters/append.md b/_filters/append.md index f2073d8..ab8356c 100644 --- a/_filters/append.md +++ b/_filters/append.md @@ -7,7 +7,7 @@ Adds the specified string to the end of another string.Input
```liquid -{% raw %} +{%- raw -%} {{ "/my/fancy/url" | append: ".html" }} {% endraw %} ``` @@ -21,7 +21,7 @@ Adds the specified string to the end of another string.Input
```liquid -{% raw %} +{%- raw -%} {% assign filename = "/index.html" %} {{ "website.com" | append: filename }} {% endraw %} diff --git a/_filters/at_least.md b/_filters/at_least.md index ab61b36..3f23b70 100644 --- a/_filters/at_least.md +++ b/_filters/at_least.md @@ -8,7 +8,7 @@ Limits a number to a minimum value.Input
```liquid -{% raw %} +{%- raw -%} {{ 4 | at_least: 5 }} {{ 4 | at_least: 3 }} {% endraw %} diff --git a/_filters/at_most.md b/_filters/at_most.md index f8f208c..728e796 100644 --- a/_filters/at_most.md +++ b/_filters/at_most.md @@ -8,7 +8,7 @@ Limits a number to a maximum value.Input
```liquid -{% raw %} +{%- raw -%} {{ 4 | at_most: 5 }} {{ 4 | at_most: 3 }} {% endraw %} diff --git a/_filters/capitalize.md b/_filters/capitalize.md index 7fb1a49..99475e3 100644 --- a/_filters/capitalize.md +++ b/_filters/capitalize.md @@ -7,7 +7,7 @@ Makes the first character of a string capitalized and converts the remaining chaInput
```liquid -{% raw %} +{%- raw -%} {{ "title" | capitalize }} {% endraw %} ``` @@ -21,7 +21,7 @@ Only the first character of a string is capitalized, so later words are not capiInput
```liquid -{% raw %} +{%- raw -%} {{ "my GREAT title" | capitalize }} {% endraw %} ``` diff --git a/_filters/ceil.md b/_filters/ceil.md index 7dedd17..80c67f3 100644 --- a/_filters/ceil.md +++ b/_filters/ceil.md @@ -7,7 +7,7 @@ Rounds an input up to the nearest whole number. Liquid tries to convert the inpuInput
```liquid -{% raw %} +{%- raw -%} {{ 1.2 | ceil }} {{ 2.0 | ceil }} {{ 183.357 | ceil }} @@ -25,7 +25,7 @@ Here the input value is a string:Input
```liquid -{% raw %} +{%- raw -%} {{ "3.5" | ceil }} {% endraw %} ``` diff --git a/_filters/compact.md b/_filters/compact.md index d9c3075..174339f 100644 --- a/_filters/compact.md +++ b/_filters/compact.md @@ -10,7 +10,7 @@ For this example, assume `site.pages` is an array of content pages for a websiteInput
```liquid -{% raw %} +{%- raw -%} {% assign site_categories = site.pages | map: "category" %} {% for category in site_categories %} @@ -34,7 +34,7 @@ By using `compact` when we create our `site_categories` array, we can remove allInput
```liquid -{% raw %} +{%- raw -%} {% assign site_categories = site.pages | map: "category" | compact %} {% for category in site_categories %} diff --git a/_filters/concat.md b/_filters/concat.md index 3df9caa..7ce565a 100644 --- a/_filters/concat.md +++ b/_filters/concat.md @@ -8,7 +8,7 @@ Concatenates (joins together) multiple arrays. The resulting array contains allInput
```liquid -{% raw %} +{%- raw -%} {% assign fruits = "apples, oranges, peaches" | split: ", " %} {% assign vegetables = "carrots, turnips, potatoes" | split: ", " %} @@ -34,7 +34,7 @@ You can string together multiple `concat` filters to join more than two arrays.Input
```liquid -{% raw %} +{%- raw -%} {% assign furniture = "chairs, tables, shelves" | split: ", " %} {% assign everything = fruits | concat: vegetables | concat: furniture %} diff --git a/_filters/date.md b/_filters/date.md index 4b8a612..cc0b79f 100644 --- a/_filters/date.md +++ b/_filters/date.md @@ -7,7 +7,7 @@ Converts a timestamp into another date format. The format for this syntax is theInput
```liquid -{% raw %} +{%- raw -%} {{ article.published_at | date: "%a, %b %d, %y" }} {% endraw %} ``` @@ -19,7 +19,7 @@ Fri, Jul 17, 15Input
```liquid -{% raw %} +{%- raw -%} {{ article.published_at | date: "%Y" }} {% endraw %} ``` @@ -33,7 +33,7 @@ Fri, Jul 17, 15Input
```liquid -{% raw %} +{%- raw -%} {{ "March 14, 2016" | date: "%b %d, %y" }} {% endraw %} ``` @@ -47,7 +47,7 @@ To get the current time, pass the special word `"now"` (or `"today"`) to `date`.Input
```liquid -{% raw %} +{%- raw -%} This page was last updated at {{ "now" | date: "%Y-%m-%d %H:%M" }}. {% endraw %} ``` diff --git a/_filters/default.md b/_filters/default.md index 123b12b..9231b85 100644 --- a/_filters/default.md +++ b/_filters/default.md @@ -9,7 +9,7 @@ In this example, `product_price` is not defined, so the default value is used.Input
```liquid -{% raw %} +{%- raw -%} {{ product_price | default: 2.99 }} {% endraw %} ``` @@ -23,7 +23,7 @@ In this example, `product_price` is defined, so the default value is not used.Input
```liquid -{% raw %} +{%- raw -%} {% assign product_price = 4.99 %} {{ product_price | default: 2.99 }} {% endraw %} @@ -39,7 +39,7 @@ In this example, `product_price` is empty, so the default value is used.Input
```liquid -{% raw %} +{%- raw -%} {% assign product_price = "" %} {{ product_price | default: 2.99 }} {% endraw %} @@ -57,7 +57,7 @@ To allow variables to return `false` instead of the default value, you can use tInput
```liquid -{% raw %} +{%- raw -%} {% assign display_price = false %} {{ display_price | default: true, allow_false: true }} {% endraw %} diff --git a/_filters/divided_by.md b/_filters/divided_by.md index 500ca56..72c83db 100644 --- a/_filters/divided_by.md +++ b/_filters/divided_by.md @@ -9,7 +9,7 @@ The result is rounded down to the nearest integer (that is, the [floor]({{ "/filInput
```liquid -{% raw %} +{%- raw -%} {{ 16 | divided_by: 4 }} {{ 5 | divided_by: 3 }} {% endraw %} @@ -29,7 +29,7 @@ For example, here the divisor is an integer:Input
```liquid -{% raw %} +{%- raw -%} {{ 20 | divided_by: 7 }} {% endraw %} ``` @@ -43,7 +43,7 @@ Here it is a float:Input
```liquid -{% raw %} +{%- raw -%} {{ 20 | divided_by: 7.0 }} {% endraw %} ``` @@ -61,7 +61,7 @@ In this example, we're dividing by a variable that contains an integer, so we geInput
```liquid -{% raw %} +{%- raw -%} {% assign my_integer = 7 %} {{ 20 | divided_by: my_integer }} {% endraw %} @@ -77,7 +77,7 @@ Here, we [multiply]({{ "/filters/times/" | prepend: site.baseurl }}) the variablInput
```liquid -{% raw %} +{%- raw -%} {% assign my_integer = 7 %} {% assign my_float = my_integer | times: 1.0 %} {{ 20 | divided_by: my_float }} diff --git a/_filters/downcase.md b/_filters/downcase.md index e66239e..e732127 100644 --- a/_filters/downcase.md +++ b/_filters/downcase.md @@ -7,7 +7,7 @@ Makes each character in a string lowercase. It has no effect on strings which arInput
```liquid -{% raw %} +{%- raw -%} {{ "Parker Moore" | downcase }} {% endraw %} ``` @@ -19,7 +19,7 @@ Makes each character in a string lowercase. It has no effect on strings which arInput
```liquid -{% raw %} +{%- raw -%} {{ "apple" | downcase }} {% endraw %} ``` diff --git a/_filters/escape.md b/_filters/escape.md index 479325b..1a7db61 100644 --- a/_filters/escape.md +++ b/_filters/escape.md @@ -7,7 +7,7 @@ Escapes a string by replacing characters with escape sequences (so that the striInput
```liquid -{% raw %} +{%- raw -%} {{ "Have you read 'James & the Giant Peach'?" | escape }} {% endraw %} ``` @@ -19,7 +19,7 @@ Escapes a string by replacing characters with escape sequences (so that the striInput
```liquid -{% raw %} +{%- raw -%} {{ "Tetsuro Takara" | escape }} {% endraw %} ``` diff --git a/_filters/escape_once.md b/_filters/escape_once.md index 6ee787e..1aa358b 100644 --- a/_filters/escape_once.md +++ b/_filters/escape_once.md @@ -7,7 +7,7 @@ Escapes a string without changing existing escaped entities. It doesn't change sInput
```liquid -{% raw %} +{%- raw -%} {{ "1 < 2 & 3" | escape_once }} {% endraw %} ``` @@ -19,7 +19,7 @@ Escapes a string without changing existing escaped entities. It doesn't change sInput
```liquid -{% raw %} +{%- raw -%} {{ "1 < 2 & 3" | escape_once }} {% endraw %} ``` diff --git a/_filters/first.md b/_filters/first.md index a534597..386975d 100644 --- a/_filters/first.md +++ b/_filters/first.md @@ -7,7 +7,7 @@ Returns the first item of an array.Input
```liquid -{% raw %} +{%- raw -%} {{ "Ground control to Major Tom." | split: " " | first }} {% endraw %} ``` @@ -19,7 +19,7 @@ Returns the first item of an array.Input
```liquid -{% raw %} +{%- raw -%} {% assign my_array = "zebra, octopus, giraffe, tiger" | split: ", " %} {{ my_array.first }} @@ -36,7 +36,7 @@ Returns the first item of an array. You can use `first` with dot notation when you need to use the filter inside a tag: ```liquid -{% raw %} +{%- raw -%} {% if my_array.first == "zebra" %} Here comes a zebra! {% endif %} diff --git a/_filters/floor.md b/_filters/floor.md index 90c5cf6..70ea9c9 100644 --- a/_filters/floor.md +++ b/_filters/floor.md @@ -7,7 +7,7 @@ Rounds an input down to the nearest whole number. Liquid tries to convert the inInput
```liquid -{% raw %} +{%- raw -%} {{ 1.2 | floor }} {{ 2.0 | floor }} {{ 183.357 | floor }} @@ -25,7 +25,7 @@ Here the input value is a string:Input
```liquid -{% raw %} +{%- raw -%} {{ "3.5" | floor }} {% endraw %} ``` diff --git a/_filters/join.md b/_filters/join.md index 2cd589c..1e3391b 100644 --- a/_filters/join.md +++ b/_filters/join.md @@ -7,7 +7,7 @@ Combines the items in an array into a single string using the argument as a sepaInput
```liquid -{% raw %} +{%- raw -%} {% assign beatles = "John, Paul, George, Ringo" | split: ", " %} {{ beatles | join: " and " }} diff --git a/_filters/last.md b/_filters/last.md index 5337abb..7d3c911 100644 --- a/_filters/last.md +++ b/_filters/last.md @@ -7,7 +7,7 @@ Returns the last item of an array.Input
```liquid -{% raw %} +{%- raw -%} {{ "Ground control to Major Tom." | split: " " | last }} {% endraw %} ``` @@ -19,7 +19,7 @@ Returns the last item of an array.Input
```liquid -{% raw %} +{%- raw -%} {% assign my_array = "zebra, octopus, giraffe, tiger" | split: ", " %} {{ my_array.last }} @@ -36,7 +36,7 @@ Returns the last item of an array. You can use `last` with dot notation when you need to use the filter inside a tag: ```liquid -{% raw %} +{%- raw -%} {% if my_array.last == "tiger" %} There goes a tiger! {% endif %} diff --git a/_filters/lstrip.md b/_filters/lstrip.md index 944118b..df7ec6e 100644 --- a/_filters/lstrip.md +++ b/_filters/lstrip.md @@ -7,7 +7,7 @@ Removes all whitespace (tabs, spaces, and newlines) from the **left** side of aInput
```liquid -{% raw %} +{%- raw -%} {{ " So much room for activities " | lstrip }}! {% endraw %} ``` diff --git a/_filters/map.md b/_filters/map.md index ddeff20..62e754d 100644 --- a/_filters/map.md +++ b/_filters/map.md @@ -9,7 +9,7 @@ In this example, assume the object `site.pages` contains all the metadata for aInput
```liquid -{% raw %} +{%- raw -%} {% assign all_categories = site.pages | map: "category" %} {% for item in all_categories %} diff --git a/_filters/minus.md b/_filters/minus.md index 60963ec..5323293 100644 --- a/_filters/minus.md +++ b/_filters/minus.md @@ -7,7 +7,7 @@ Subtracts a number from another number.Input
```liquid -{% raw %} +{%- raw -%} {{ 4 | minus: 2 }} {{ 16 | minus: 4 }} {{ 183.357 | minus: 12 }} diff --git a/_filters/modulo.md b/_filters/modulo.md index f71c3dc..b0de01a 100644 --- a/_filters/modulo.md +++ b/_filters/modulo.md @@ -7,7 +7,7 @@ Returns the remainder of a division operation.Input
```liquid -{% raw %} +{%- raw -%} {{ 3 | modulo: 2 }} {{ 24 | modulo: 7 }} {{ 183.357 | modulo: 12 }} diff --git a/_filters/newline_to_br.md b/_filters/newline_to_br.md index 033c4d1..70b1974 100644 --- a/_filters/newline_to_br.md +++ b/_filters/newline_to_br.md @@ -7,7 +7,7 @@ Inserts an HTML line break (`Input
```liquid -{% raw %} +{%- raw -%} {% capture string_with_newlines %} Hello there diff --git a/_filters/plus.md b/_filters/plus.md index a677940..039f221 100644 --- a/_filters/plus.md +++ b/_filters/plus.md @@ -7,7 +7,7 @@ Adds a number to another number.Input
```liquid -{% raw %} +{%- raw -%} {{ 4 | plus: 2 }} {{ 16 | plus: 4 }} {{ 183.357 | plus: 12 }} diff --git a/_filters/prepend.md b/_filters/prepend.md index ad6b362..6d39521 100644 --- a/_filters/prepend.md +++ b/_filters/prepend.md @@ -7,7 +7,7 @@ Adds the specified string to the beginning of another string.Input
```liquid -{% raw %} +{%- raw -%} {{ "apples, oranges, and bananas" | prepend: "Some fruit: " }} {% endraw %} ``` @@ -21,7 +21,7 @@ Adds the specified string to the beginning of another string.Input
```liquid -{% raw %} +{%- raw -%} {% assign url = "example.com" %} {{ "/index.html" | prepend: url }} {% endraw %} diff --git a/_filters/remove.md b/_filters/remove.md index 0a294ab..8349b0b 100644 --- a/_filters/remove.md +++ b/_filters/remove.md @@ -7,7 +7,7 @@ Removes every occurrence of the specified substring from a string.Input
```liquid -{% raw %} +{%- raw -%} {{ "I strained to see the train through the rain" | remove: "rain" }} {% endraw %} ``` diff --git a/_filters/remove_first.md b/_filters/remove_first.md index ead16b9..4c65917 100644 --- a/_filters/remove_first.md +++ b/_filters/remove_first.md @@ -7,7 +7,7 @@ Removes only the first occurrence of the specified substring from a string.Input
```liquid -{% raw %} +{%- raw -%} {{ "I strained to see the train through the rain" | remove_first: "rain" }} {% endraw %} ``` diff --git a/_filters/replace.md b/_filters/replace.md index aba612f..3fde134 100644 --- a/_filters/replace.md +++ b/_filters/replace.md @@ -7,7 +7,7 @@ Replaces every occurrence of the first argument in a string with the second arguInput
```liquid -{% raw %} +{%- raw -%} {{ "Take my protein pills and put my helmet on" | replace: "my", "your" }} {% endraw %} ``` diff --git a/_filters/replace_first.md b/_filters/replace_first.md index c25ee3a..5c46ac4 100644 --- a/_filters/replace_first.md +++ b/_filters/replace_first.md @@ -7,7 +7,7 @@ Replaces only the first occurrence of the first argument in a string with the seInput
```liquid -{% raw %} +{%- raw -%} {{ "Take my protein pills and put my helmet on" | replace_first: "my", "your" }} {% endraw %} ``` diff --git a/_filters/reverse.md b/_filters/reverse.md index 4da95ca..b7d88bc 100644 --- a/_filters/reverse.md +++ b/_filters/reverse.md @@ -7,7 +7,7 @@ Reverses the order of the items in an array. `reverse` cannot reverse a string.Input
```liquid -{% raw %} +{%- raw -%} {% assign my_array = "apples, oranges, peaches, plums" | split: ", " %} {{ my_array | reverse | join: ", " }} @@ -25,7 +25,7 @@ Although `reverse` cannot be used directly on a string, you can split a string iInput
```liquid -{% raw %} +{%- raw -%} {{ "Ground control to Major Tom." | split: "" | reverse | join: "" }} {% endraw %} ``` diff --git a/_filters/round.md b/_filters/round.md index 7050fbd..6eb2e65 100644 --- a/_filters/round.md +++ b/_filters/round.md @@ -7,7 +7,7 @@ Rounds a number to the nearest integer or, if a number is passed as an argument,Input
```liquid -{% raw %} +{%- raw -%} {{ 1.2 | round }} {{ 2.7 | round }} {{ 183.357 | round: 2 }} diff --git a/_filters/rstrip.md b/_filters/rstrip.md index 99d913c..5226dd9 100644 --- a/_filters/rstrip.md +++ b/_filters/rstrip.md @@ -7,7 +7,7 @@ Removes all whitespace (tabs, spaces, and newlines) from the **right** side of aInput
```liquid -{% raw %} +{%- raw -%} {{ " So much room for activities " | rstrip }}! {% endraw %} ``` diff --git a/_filters/size.md b/_filters/size.md index 96d8a09..4d50dfc 100644 --- a/_filters/size.md +++ b/_filters/size.md @@ -7,7 +7,7 @@ Returns the number of characters in a string or the number of items in an array.Input
```liquid -{% raw %} +{%- raw -%} {{ "Ground control to Major Tom." | size }} {% endraw %} ``` @@ -19,7 +19,7 @@ Returns the number of characters in a string or the number of items in an array.Input
```liquid -{% raw %} +{%- raw -%} {% assign my_array = "apples, oranges, peaches, plums" | split: ", " %} {{ my_array.size }} @@ -36,7 +36,7 @@ Returns the number of characters in a string or the number of items in an array. You can use `size` with dot notation when you need to use the filter inside a tag: ```liquid -{% raw %} +{%- raw -%} {% if site.pages.size > 10 %} This is a big website! {% endif %} diff --git a/_filters/slice.md b/_filters/slice.md index 43e8e7f..2f6c704 100644 --- a/_filters/slice.md +++ b/_filters/slice.md @@ -9,7 +9,7 @@ String or array indices are numbered starting from 0.Input
```liquid -{% raw %} +{%- raw -%} {{ "Liquid" | slice: 0 }} {% endraw %} ``` @@ -21,7 +21,7 @@ String or array indices are numbered starting from 0.Input
```liquid -{% raw %} +{%- raw -%} {{ "Liquid" | slice: 2 }} {% endraw %} ``` @@ -33,7 +33,7 @@ String or array indices are numbered starting from 0.Input
```liquid -{% raw %} +{%- raw -%} {{ "Liquid" | slice: 2, 5 }} {% endraw %} ``` @@ -47,7 +47,7 @@ Here the input value is an array:Input
```liquid -{% raw %} +{%- raw -%} {% assign beatles = "John, Paul, George, Ringo" | split: ", " %} {{ beatles | slice: 1, 2 }} {% endraw %} @@ -63,7 +63,7 @@ If the first argument is a negative number, the indices are counted from the endInput
```liquid -{% raw %} +{%- raw -%} {{ "Liquid" | slice: -3, 2 }} {% endraw %} ``` diff --git a/_filters/sort.md b/_filters/sort.md index f890d5c..72f0a99 100644 --- a/_filters/sort.md +++ b/_filters/sort.md @@ -7,7 +7,7 @@ Sorts items in an array in case-sensitive order.Input
```liquid -{% raw %} +{%- raw -%} {% assign my_array = "zebra, octopus, giraffe, Sally Snake" | split: ", " %} {{ my_array | sort | join: ", " }} @@ -24,7 +24,7 @@ Sorts items in an array in case-sensitive order. An optional argument specifies which property of the array's items to use for sorting. ```liquid -{% raw %} +{%- raw -%} {% assign products_by_price = collection.products | sort: "price" %} {% for product in products_by_price %}Input
```liquid -{% raw %} +{%- raw -%} {% assign my_array = "zebra, octopus, giraffe, Sally Snake" | split: ", " %} {{ my_array | sort_natural | join: ", " }} @@ -25,7 +25,7 @@ Sorts items in an array in case-insensitive order. An optional argument specifies which property of the array's items to use for sorting. ```liquid -{% raw %} +{%- raw -%} {% assign products_by_company = collection.products | sort_natural: "company" %} {% for product in products_by_company %}Input
```liquid -{% raw %} +{%- raw -%} {% assign beatles = "John, Paul, George, Ringo" | split: ", " %} {% for member in beatles %} diff --git a/_filters/strip.md b/_filters/strip.md index 59d2402..a79816a 100644 --- a/_filters/strip.md +++ b/_filters/strip.md @@ -7,7 +7,7 @@ Removes all whitespace (tabs, spaces, and newlines) from both the left and rightInput
```liquid -{% raw %} +{%- raw -%} {{ " So much room for activities " | strip }}! {% endraw %} ``` diff --git a/_filters/strip_html.md b/_filters/strip_html.md index 9ca00f0..8842599 100644 --- a/_filters/strip_html.md +++ b/_filters/strip_html.md @@ -7,7 +7,7 @@ Removes any HTML tags from a string.Input
```liquid -{% raw %} +{%- raw -%} {{ "Have you read Ulysses?" | strip_html }} {% endraw %} ``` diff --git a/_filters/strip_newlines.md b/_filters/strip_newlines.md index c05deaa..0a2324b 100644 --- a/_filters/strip_newlines.md +++ b/_filters/strip_newlines.md @@ -7,7 +7,7 @@ Removes any newline characters (line breaks) from a string.Input
```liquid -{% raw %} +{%- raw -%} {% capture string_with_newlines %} Hello there diff --git a/_filters/times.md b/_filters/times.md index 8863996..90c2757 100644 --- a/_filters/times.md +++ b/_filters/times.md @@ -7,7 +7,7 @@ Multiplies a number by another number.Input
```liquid -{% raw %} +{%- raw -%} {{ 3 | times: 2 }} {{ 24 | times: 7 }} {{ 183.357 | times: 12 }} diff --git a/_filters/truncate.md b/_filters/truncate.md index 7b192dc..0881fb0 100644 --- a/_filters/truncate.md +++ b/_filters/truncate.md @@ -7,7 +7,7 @@ Shortens a string down to the number of characters passed as an argument. If theInput
```liquid -{% raw %} +{%- raw -%} {{ "Ground control to Major Tom." | truncate: 20 }} {% endraw %} ``` @@ -25,7 +25,7 @@ The length of the second argument counts against the number of characters specifInput
```liquid -{% raw %} +{%- raw -%} {{ "Ground control to Major Tom." | truncate: 25, ", and so on" }} {% endraw %} ``` @@ -41,7 +41,7 @@ You can truncate to the exact number of characters specified by the first argumeInput
```liquid -{% raw %} +{%- raw -%} {{ "Ground control to Major Tom." | truncate: 20, "" }} {% endraw %} ``` diff --git a/_filters/truncatewords.md b/_filters/truncatewords.md index 15d7313..5cc57a5 100644 --- a/_filters/truncatewords.md +++ b/_filters/truncatewords.md @@ -7,7 +7,7 @@ Shortens a string down to the number of words passed as an argument. If the specInput
```liquid -{% raw %} +{%- raw -%} {{ "Ground control to Major Tom." | truncatewords: 3 }} {% endraw %} ``` @@ -23,7 +23,7 @@ Shortens a string down to the number of words passed as an argument. If the specInput
```liquid -{% raw %} +{%- raw -%} {{ "Ground control to Major Tom." | truncatewords: 3, "--" }} {% endraw %} ``` @@ -39,7 +39,7 @@ You can avoid showing trailing characters by passing a blank string as the seconInput
```liquid -{% raw %} +{%- raw -%} {{ "Ground control to Major Tom." | truncatewords: 3, "" }} {% endraw %} ``` diff --git a/_filters/uniq.md b/_filters/uniq.md index c512da7..0f87b5c 100644 --- a/_filters/uniq.md +++ b/_filters/uniq.md @@ -7,7 +7,7 @@ Removes any duplicate items in an array.Input
```liquid -{% raw %} +{%- raw -%} {% assign my_array = "ants, bugs, bees, bugs, ants" | split: ", " %} {{ my_array | uniq | join: ", " }} diff --git a/_filters/upcase.md b/_filters/upcase.md index 6278537..d131b43 100644 --- a/_filters/upcase.md +++ b/_filters/upcase.md @@ -7,7 +7,7 @@ Makes each character in a string uppercase. It has no effect on strings which arInput
```liquid -{% raw %} +{%- raw -%} {{ "Parker Moore" | upcase }} {% endraw %} ``` @@ -19,7 +19,7 @@ Makes each character in a string uppercase. It has no effect on strings which arInput
```liquid -{% raw %} +{%- raw -%} {{ "APPLE" | upcase }} {% endraw %} ``` diff --git a/_filters/url_decode.md b/_filters/url_decode.md index 5ec572f..e5559c9 100644 --- a/_filters/url_decode.md +++ b/_filters/url_decode.md @@ -8,7 +8,7 @@ Decodes a string that has been encoded as a URL or by [`url_encode`]({{ "/filterInput
```liquid -{% raw %} +{%- raw -%} {{ "%27Stop%21%27+said+Fred" | url_decode }} {% endraw %} ``` diff --git a/_filters/url_encode.md b/_filters/url_encode.md index b07af5b..74fe929 100644 --- a/_filters/url_encode.md +++ b/_filters/url_encode.md @@ -7,7 +7,7 @@ Converts any URL-unsafe characters in a string into percent-encoded characters.Input
```liquid -{% raw %} +{%- raw -%} {{ "john@liquid.com" | url_encode }} {% endraw %} ``` @@ -21,7 +21,7 @@ Note that `url_encode` will turn a space into a `+` sign instead of a percent-enInput
```liquid -{% raw %} +{%- raw -%} {{ "Tetsuro Takara" | url_encode }} {% endraw %} ``` diff --git a/_filters/where.md b/_filters/where.md index d28967e..80d8004 100644 --- a/_filters/where.md +++ b/_filters/where.md @@ -10,7 +10,7 @@ In this example, assume you have a list of products and you want to show your kiInput
```liquid -{% raw %} +{%- raw -%} All products: {% for product in products %} - {{ product.title }} @@ -42,7 +42,7 @@ Say instead you have a list of products and you only want to show those that areInput
```liquid -{% raw %} +{%- raw -%} All products: {% for product in products %} - {{ product.title }} @@ -73,7 +73,7 @@ The `where` filter can also be used to find a single object in an array when comInput
```liquid -{% raw %} +{%- raw -%} {% assign new_shirt = products | where: "type", "shirt" | first %} Featured product: {{ new_shirt.title }} diff --git a/_tags/control-flow.md b/_tags/control-flow.md index 6a6bfc3..457f560 100644 --- a/_tags/control-flow.md +++ b/_tags/control-flow.md @@ -12,7 +12,7 @@ Executes a block of code only if a certain condition is `true`.Input
```liquid -{% raw %} +{%- raw -%} {% if product.title == "Awesome Shoes" %} These shoes are awesome! {% endif %} @@ -30,7 +30,7 @@ The opposite of `if` – executes a block of code only if a certain condition isInput
```liquid -{% raw %} +{%- raw -%} {% unless product.title == "Awesome Shoes" %} These shoes are not awesome. {% endunless %} @@ -45,7 +45,7 @@ These shoes are not awesome. This would be the equivalent of doing the following: ```liquid -{% raw %} +{%- raw -%} {% if product.title != "Awesome Shoes" %} These shoes are not awesome. {% endif %} @@ -58,7 +58,7 @@ Adds more conditions within an `if` or `unless` block.Input
```liquid -{% raw %} +{%- raw -%} {% if customer.name == "kevin" %} Hey Kevin! @@ -83,7 +83,7 @@ An optional `else` statement at the end of the case provides code to execute ifInput
```liquid -{% raw %} +{%- raw -%} {% assign handle = "cake" %} {% case handle %} {% when "cake" %} diff --git a/_tags/iteration.md b/_tags/iteration.md index ea06959..2d68031 100644 --- a/_tags/iteration.md +++ b/_tags/iteration.md @@ -11,7 +11,7 @@ Repeatedly executes a block of code. For a full list of attributes available witInput
```liquid -{% raw %} +{%- raw -%} {% for product in collection.products %} {{ product.title }} {% endfor %} @@ -29,7 +29,7 @@ Specifies a fallback case for a `for` loop which will run if the loop has zero lInput
```liquid -{% raw %} +{%- raw -%} {% for product in collection.products %} {{ product.title }} {% else %} @@ -49,7 +49,7 @@ Causes the loop to stop iterating when it encounters the `break` tag.Input
```liquid -{% raw %} +{%- raw -%} {% for i in (1..5) %} {% if i == 4 %} {% break %} @@ -71,7 +71,7 @@ Causes the loop to skip the current iteration when it encounters the `continue`Input
```liquid -{% raw %} +{%- raw -%} {% for i in (1..5) %} {% if i == 4 %} {% continue %} @@ -95,7 +95,7 @@ Limits the loop to the specified number of iterations.Input
```liquid -{% raw %} +{%- raw -%} {% for item in array limit:2 %} {{ item }} @@ -114,7 +114,7 @@ Begins the loop at the specified index.Input
```liquid -{% raw %} +{%- raw -%} {% for item in array offset:2 %} {{ item }} @@ -131,7 +131,7 @@ To start a loop from where the last loop using the same iterator left off, passInput
```liquid -{% raw %} +{%- raw -%} {% for item in array limit: 3 %} {{ item }} @@ -154,7 +154,7 @@ Defines a range of numbers to loop through. The range can be defined by both litInput
```liquid -{% raw %} +{%- raw -%} {% for i in (3..5) %} {{ i }} {% endfor %} @@ -179,7 +179,7 @@ Reverses the order of the loop. Note that this flag's spelling is different fromInput
```liquid -{% raw %} +{%- raw -%} {% for item in array reversed %} {{ item }} @@ -200,7 +200,7 @@ Loops through a group of strings and prints them in the order that they were pasInput
```liquid -{% raw %} +{%- raw -%} {% cycle "one", "two", "three" %} {% cycle "one", "two", "three" %} {% cycle "one", "two", "three" %} @@ -227,7 +227,7 @@ Uses for `cycle` include:Input
```liquid -{% raw %} +{%- raw -%} {% cycle "first": "one", "two", "three" %} {% cycle "second": "one", "two", "three" %} {% cycle "second": "one", "two", "three" %} @@ -249,7 +249,7 @@ Generates an HTML table. Must be wrapped in opening `