mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-15 20:30:39 -07:00
Deploying to gh-pages from @ harttle/liquidjs@ed15a52c26 🚀
This commit is contained in:
@@ -39,6 +39,7 @@
|
||||
<script src="https://cdn.cookiehub.eu/c2/e8e44c93.js"></script>
|
||||
<script type="text/javascript">
|
||||
document.addEventListener("DOMContentLoaded", function(event) {
|
||||
if (location.hostname === 'localhost' || location.hostname === '127.0.0.1') return;
|
||||
var cpm = {};
|
||||
window.cookiehub.load(cpm);
|
||||
});
|
||||
@@ -99,13 +100,13 @@
|
||||
|
||||
</header>
|
||||
<div class="article-content" itemprop="articleBody">
|
||||
<p>LiquidJS operators are very simple and different. There’re 2 types of operators supported:</p>
|
||||
<p>LiquidJS operators are very simple and different. There are 2 types of operators supported:</p>
|
||||
<ul>
|
||||
<li>Comparison operators: <code>==</code>, <code>!=</code>, <code>></code>, <code><</code>, <code>>=</code>, <code><=</code></li>
|
||||
<li>Logic operators: <code>not</code>, <code>or</code>, <code>and</code>, <code>contains</code></li>
|
||||
<li>Logical operators: <code>not</code>, <code>or</code>, <code>and</code>, <code>contains</code></li>
|
||||
</ul>
|
||||
<p>Thus numerical operators are not supported and you cannot even plus two numbers like this <code>{{a + b}}</code>, instead we need a filter <code>{{ a | plus: b}}</code>. Actually <code>+</code> is a valid variable name in LiquidJS.</p>
|
||||
<h2 id="Logic-Operators" class="article-heading"><a href="#Logic-Operators" class="headerlink" title="Logic Operators"></a>Logic Operators<a class="article-anchor" href="#Logic-Operators" aria-hidden="true"></a></h2><h3 id="not" class="article-heading"><a href="#not" class="headerlink" title="not"></a>not<a class="article-anchor" href="#not" aria-hidden="true"></a></h3><p>Negates a condition. Returns <code>true</code> if the condition is false, and <code>false</code> if the condition is true.</p>
|
||||
<p>Thus arithmetic operators are not supported and you cannot add two numbers like this <code>{{a + b}}</code>. Instead, use a filter: <code>{{ a | plus: b}}</code>. Actually <code>+</code> is a valid variable name in LiquidJS.</p>
|
||||
<h2 id="Logical-Operators" class="article-heading"><a href="#Logical-Operators" class="headerlink" title="Logical Operators"></a>Logical Operators<a class="article-anchor" href="#Logical-Operators" aria-hidden="true"></a></h2><h3 id="not" class="article-heading"><a href="#not" class="headerlink" title="not"></a>not<a class="article-anchor" href="#not" aria-hidden="true"></a></h3><p>Negates a condition. Returns <code>true</code> if the condition is false, and <code>false</code> if the condition is true.</p>
|
||||
<p>Input</p>
|
||||
<pre class="line-numbers language-liquid" data-language="liquid"><code class="language-liquid"><span class="token liquid language-liquid"><span class="token delimiter punctuation">{%</span> <span class="token keyword">if</span> not user<span class="token punctuation">.</span>active <span class="token delimiter punctuation">%}</span></span>
|
||||
User is inactive
|
||||
@@ -132,13 +133,13 @@
|
||||
<h2 id="Precedence" class="article-heading"><a href="#Precedence" class="headerlink" title="Precedence"></a>Precedence<a class="article-anchor" href="#Precedence" aria-hidden="true"></a></h2><ol>
|
||||
<li>Comparison operators, and <code>contains</code>. All comparison operators alongside <code>contains</code> have the same (highest) precedence.</li>
|
||||
<li><code>not</code> operator. It has slightly more precedence than <code>or</code> and <code>and</code>.</li>
|
||||
<li><code>or</code> and <code>and</code> operators. These logic operators have the same (lowest) precedence.</li>
|
||||
<li><code>or</code> and <code>and</code> operators. These logical operators have the same (lowest) precedence.</li>
|
||||
</ol>
|
||||
<h2 id="Associativity" class="article-heading"><a href="#Associativity" class="headerlink" title="Associativity"></a>Associativity<a class="article-anchor" href="#Associativity" aria-hidden="true"></a></h2><p>Logic operators are evaluated from right to left, see <a target="_blank" rel="noopener external nofollow noreferrer" href="https://shopify.dev/docs/api/liquid/basics#order-of-operations">shopify docs</a>.</p>
|
||||
<h2 id="Associativity" class="article-heading"><a href="#Associativity" class="headerlink" title="Associativity"></a>Associativity<a class="article-anchor" href="#Associativity" aria-hidden="true"></a></h2><p>Logical operators are evaluated from right to left, see <a target="_blank" rel="noopener external nofollow noreferrer" href="https://shopify.dev/docs/api/liquid/basics#order-of-operations">shopify docs</a>.</p>
|
||||
|
||||
</div>
|
||||
<footer class="article-footer">
|
||||
<time class="article-footer-updated" datetime="2026-06-06T17:38:08.031Z" itemprop="dateModified">Last updated: 2026-06-06</time>
|
||||
<time class="article-footer-updated" datetime="2026-06-07T16:27:07.442Z" itemprop="dateModified">Last updated: 2026-06-07</time>
|
||||
<a href="plugins.html" class="article-footer-prev" title="Plugins"><i class="icon-chevron-left"></i><span>Prev</span></a><a href="truthy-and-falsy.html" class="article-footer-next" title="Truthy and Falsy"><span>Next</span><i class="icon-chevron-right"></i></a>
|
||||
</footer>
|
||||
</div>
|
||||
@@ -147,7 +148,7 @@
|
||||
<div id="article-toc-inner">
|
||||
<div id="article-toc-inner-list">
|
||||
<strong class="sidebar-title">Contents</strong>
|
||||
<ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#Logic-Operators"><span class="toc-text">Logic Operators</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#not"><span class="toc-text">not</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#and"><span class="toc-text">and</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#or"><span class="toc-text">or</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#contains"><span class="toc-text">contains</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Precedence"><span class="toc-text">Precedence</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Associativity"><span class="toc-text">Associativity</span></a></li></ol>
|
||||
<ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#Logical-Operators"><span class="toc-text">Logical Operators</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#not"><span class="toc-text">not</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#and"><span class="toc-text">and</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#or"><span class="toc-text">or</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#contains"><span class="toc-text">contains</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Precedence"><span class="toc-text">Precedence</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Associativity"><span class="toc-text">Associativity</span></a></li></ol>
|
||||
</div>
|
||||
<a href="#" id="article-toc-top">Back to Top</a>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user