mirror of
https://github.com/kemko/liquid.git
synced 2026-01-08 03:05:42 +03:00
Prefer double quotes for strings
This commit is contained in:
@@ -70,7 +70,7 @@ You can use multiple operators in a tag:
|
||||
|
||||
```liquid
|
||||
{% raw %}
|
||||
{% if product.title contains 'Pack' %}
|
||||
{% if product.title contains "Pack" %}
|
||||
This product's title contains the word Pack.
|
||||
{% endif %}
|
||||
{% endraw %}
|
||||
@@ -80,8 +80,8 @@ You can use multiple operators in a tag:
|
||||
|
||||
```liquid
|
||||
{% raw %}
|
||||
{% if product.tags contains 'Hello' %}
|
||||
This product has been tagged with 'Hello'.
|
||||
{% if product.tags contains "Hello" %}
|
||||
This product has been tagged with "Hello".
|
||||
{% endif %}
|
||||
{% endraw %}
|
||||
```
|
||||
@@ -95,7 +95,7 @@ In tags with more than one `and` or `or` operator, operators are checked in orde
|
||||
```liquid
|
||||
{% raw %}
|
||||
{% if true or false and false %}
|
||||
This evaluates to true, since the 'and' condition is checked first.
|
||||
This evaluates to true, since the `and` condition is checked first.
|
||||
{% endif %}
|
||||
{% endraw %}
|
||||
```
|
||||
|
||||
@@ -10,7 +10,7 @@ For this example, assume `site.pages` is an array of content pages for a website
|
||||
<p class="code-label">Input</p>
|
||||
```liquid
|
||||
{% raw %}
|
||||
{% assign site_categories = site.pages | map: 'category' %}
|
||||
{% assign site_categories = site.pages | map: "category" %}
|
||||
|
||||
{% for category in site_categories %}
|
||||
- {{ category }}
|
||||
@@ -34,7 +34,7 @@ By using `compact` when we create our `site_categories` array, we can remove all
|
||||
<p class="code-label">Input</p>
|
||||
```liquid
|
||||
{% raw %}
|
||||
{% assign site_categories = site.pages | map: 'category' | compact %}
|
||||
{% assign site_categories = site.pages | map: "category" | compact %}
|
||||
|
||||
{% for category in site_categories %}
|
||||
- {{ category }}
|
||||
|
||||
@@ -13,7 +13,7 @@ Executes a block of code only if a certain condition is `true`.
|
||||
<p class="code-label">Input</p>
|
||||
```liquid
|
||||
{% raw %}
|
||||
{% if product.title == 'Awesome Shoes' %}
|
||||
{% if product.title == "Awesome Shoes" %}
|
||||
These shoes are awesome!
|
||||
{% endif %}
|
||||
{% endraw %}
|
||||
@@ -31,7 +31,7 @@ The opposite of `if` – executes a block of code only if a certain condition is
|
||||
<p class="code-label">Input</p>
|
||||
```liquid
|
||||
{% raw %}
|
||||
{% unless product.title == 'Awesome Shoes' %}
|
||||
{% unless product.title == "Awesome Shoes" %}
|
||||
These shoes are not awesome.
|
||||
{% endunless %}
|
||||
{% endraw %}
|
||||
@@ -46,7 +46,7 @@ This would be the equivalent of doing the following:
|
||||
|
||||
```liquid
|
||||
{% raw %}
|
||||
{% if product.title != 'Awesome Shoes' %}
|
||||
{% if product.title != "Awesome Shoes" %}
|
||||
These shoes are not awesome.
|
||||
{% endif %}
|
||||
{% endraw %}
|
||||
@@ -59,10 +59,10 @@ Adds more conditions within an `if` or `unless` block.
|
||||
<p class="code-label">Input</p>
|
||||
```liquid
|
||||
{% raw %}
|
||||
<!-- If customer.name = 'anonymous' -->
|
||||
{% if customer.name == 'kevin' %}
|
||||
<!-- If customer.name = "anonymous" -->
|
||||
{% if customer.name == "kevin" %}
|
||||
Hey Kevin!
|
||||
{% elsif customer.name == 'anonymous' %}
|
||||
{% elsif customer.name == "anonymous" %}
|
||||
Hey Anonymous!
|
||||
{% else %}
|
||||
Hi Stranger!
|
||||
@@ -82,11 +82,11 @@ Creates a switch statement to compare a variable with different values. `case` i
|
||||
<p class="code-label">Input</p>
|
||||
```liquid
|
||||
{% raw %}
|
||||
{% assign handle = 'cake' %}
|
||||
{% assign handle = "cake" %}
|
||||
{% case handle %}
|
||||
{% when 'cake' %}
|
||||
{% when "cake" %}
|
||||
This is a cake
|
||||
{% when 'cookie' %}
|
||||
{% when "cookie" %}
|
||||
This is a cookie
|
||||
{% else %}
|
||||
This is not a cake nor a cookie
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: Iteration
|
||||
description: An overview of iteration or 'loop' tags in the Liquid template language.
|
||||
description: An overview of iteration or "loop" tags in the Liquid template language.
|
||||
---
|
||||
|
||||
Iteration tags run blocks of code repeatedly.
|
||||
@@ -179,10 +179,10 @@ Loops through a group of strings and outputs them in the order that they were pa
|
||||
<p class="code-label">Input</p>
|
||||
```liquid
|
||||
{% raw %}
|
||||
{% cycle 'one', 'two', 'three' %}
|
||||
{% cycle 'one', 'two', 'three' %}
|
||||
{% cycle 'one', 'two', 'three' %}
|
||||
{% cycle 'one', 'two', 'three' %}
|
||||
{% cycle "one", "two", "three" %}
|
||||
{% cycle "one", "two", "three" %}
|
||||
{% cycle "one", "two", "three" %}
|
||||
{% cycle "one", "two", "three" %}
|
||||
{% endraw %}
|
||||
```
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ Using `capture`, you can create complex strings using other variables created wi
|
||||
<p class="code-label">Input</p>
|
||||
```liquid
|
||||
{% raw %}
|
||||
{% assign favorite_food = 'pizza' %}
|
||||
{% assign favorite_food = "pizza" %}
|
||||
{% assign age = 35 %}
|
||||
|
||||
{% capture about_me %}
|
||||
|
||||
Reference in New Issue
Block a user