Deploying to gh-pages from @ harttle/liquidjs@70fdb7af48 🚀

This commit is contained in:
harttle
2021-09-30 16:55:43 +00:00
parent cec0814a9b
commit 9a2a2bfd55
515 changed files with 11719 additions and 9833 deletions
+12 -12
View File
@@ -36,8 +36,8 @@
<link rel="stylesheet" href="../../css/navy.css">
<link rel="alternate" href="../../atom.xml" title="LiquidJS">
</head>
<link rel="alternate" href="../../atom.xml" title="LiquidJS" type="application/atom+xml">
<meta name="generator" content="Hexo 5.4.0"></head>
<body>
<div id="container">
@@ -63,7 +63,7 @@
</select>
</div>
<a href="https://github.com/harttle/liquidjs" target="_blank" rel="noopener external nofollow noreferrer" id="github-link-wrap" class="main-nav-link"><i class="icon-github"></i>Github</a>
<a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/harttle/liquidjs" id="github-link-wrap" class="main-nav-link"><i class="icon-github"></i>Github</a>
<a id="mobile-nav-toggle">
<span class="mobile-nav-toggle-bar"></span>
<span class="mobile-nav-toggle-bar"></span>
@@ -87,24 +87,24 @@
<header class="article-header">
<h1 class="article-title" itemprop="name">和 Shopify/liquid 的区别</h1>
<a href="https://github.com/harttle/liquidjs/edit/master/docs/source/zh-cn/tutorials/differences.md" target="_blank" rel="noopener external nofollow noreferrer" class="article-edit-link" title="改进这篇文档"><i class="icon-pencil"></i></a>
<a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/harttle/liquidjs/edit/master/docs/source/zh-cn/tutorials/differences.md" class="article-edit-link" title="改进这篇文档"><i class="icon-pencil"></i></a>
</header>
<div class="article-content" itemprop="articleBody">
<p><a href="https://github.com/Shopify/liquid" target="_blank" rel="noopener external nofollow noreferrer">Shopify/liquid</a> 中的所有标签和过滤器 LiquidJS 都支持,但不包括 Shopify 主题中业务逻辑相关的标签和过滤器(如果你在找这些标签可以参考 <a href="./plugins.html#插件列表">插件列表</a>,也欢迎把你的插件添加到列表中)。尽管原则上我们尽力兼容于 Shopify/liquid,但仍然存在一些区别:</p>
<p><a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/Shopify/liquid">Shopify/liquid</a> 中的所有标签和过滤器 LiquidJS 都支持,但不包括 Shopify 主题中业务逻辑相关的标签和过滤器(如果你在找这些标签可以参考 <a href="./plugins.html#插件列表">插件列表</a>,也欢迎把你的插件添加到列表中)。尽管原则上我们尽力兼容于 Shopify/liquid,但仍然存在一些区别:</p>
<ul>
<li>真和假。在 LiquidJS 中 <code>undefined</code>, <code>null</code>, <code>false</code> 是假,之外的都是真;在 Ruby 中 <code>nil</code><code>false</code> 是假,其他都是真。见 <a href="https://github.com/harttle/liquidjs/pull/26" target="_blank" rel="noopener external nofollow noreferrer">#26</a></li>
<li>数字。JavaScript 不区分浮点数和整数,因此缺失一部分整数算术,见 <a href="https://github.com/harttle/liquidjs/issues/59" target="_blank" rel="noopener external nofollow noreferrer">#59</a>。此外 <code>size</code> 过滤器作用于数字时总是返回零,而不是 Ruby 中的浮点数或整数的内存大小。</li>
<li>Drop 中的 <a href="https://github.com/Shopify/liquid/wiki/Introduction-to-Drops" target="_blank" rel="noopener external nofollow noreferrer">.to_liquid()</a> 替换为 <code>.toLiquid()</code></li>
<li>数据的 <a href="https://www.rubydoc.info/gems/liquid/Liquid/Drop" target="_blank" rel="noopener external nofollow noreferrer">.to_s()</a> 替换为 <code>.toString()</code></li>
<li>真和假。在 LiquidJS 中 <code>undefined</code>, <code>null</code>, <code>false</code> 是假,之外的都是真;在 Ruby 中 <code>nil</code><code>false</code> 是假,其他都是真。见 <a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/harttle/liquidjs/pull/26">#26</a></li>
<li>数字。JavaScript 不区分浮点数和整数,因此缺失一部分整数算术,见 <a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/harttle/liquidjs/issues/59">#59</a>。此外 <code>size</code> 过滤器作用于数字时总是返回零,而不是 Ruby 中的浮点数或整数的内存大小。</li>
<li>Drop 中的 <a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/Shopify/liquid/wiki/Introduction-to-Drops">.to_liquid()</a> 替换为 <code>.toLiquid()</code></li>
<li>数据的 <a target="_blank" rel="noopener external nofollow noreferrer" href="https://www.rubydoc.info/gems/liquid/Liquid/Drop">.to_s()</a> 替换为 <code>.toString()</code></li>
<li>对象的迭代顺序。JavaScript 对象的迭代顺序是插入顺序和数字键递增顺序的组合,但 Ruby Hash 中只是插入顺序(JavaScript 字面量 Object 和 Ruby 字面量 Hash 的插入顺序解释也不同)。</li>
<li>排序稳定性。shopify/liquid 和 LiquidJS 都没有定义 <a href="https://liquidjs.com/filters/sort.html">sort</a> 过滤器的稳定性在,它取决于 Ruby/JavaScript 内置的排序算法,在 Node.js 12+ 和 Google Chrome 70+ LiquidJS 的排序是 <a href="https://v8.dev/features/stable-sort" target="_blank" rel="noopener external nofollow noreferrer">稳定的</a></li>
<li>shopify/liquid 允许过滤器尾部的未匹配字符,但 LiquidJS 不允许。这就是说如果过滤器参数前忘记写冒号比如 <code>{{ "a b" | split " "}}</code> LiquidJS 会抛出异常。这是为了提升 Liquid 模板的易用性,参考 <a href="https://github.com/harttle/liquidjs/issues/208" target="_blank" rel="noopener external nofollow noreferrer">#208</a><a href="https://github.com/harttle/liquidjs/issues/212" target="_blank" rel="noopener external nofollow noreferrer">#212</a></li>
<li>排序稳定性。shopify/liquid 和 LiquidJS 都没有定义 <a href="https://liquidjs.com/filters/sort.html">sort</a> 过滤器的稳定性在,它取决于 Ruby/JavaScript 内置的排序算法,在 Node.js 12+ 和 Google Chrome 70+ LiquidJS 的排序是 <a target="_blank" rel="noopener external nofollow noreferrer" href="https://v8.dev/features/stable-sort">稳定的</a></li>
<li>shopify/liquid 允许过滤器尾部的未匹配字符,但 LiquidJS 不允许。这就是说如果过滤器参数前忘记写冒号比如 <code>{{ "a b" | split " "}}</code> LiquidJS 会抛出异常。这是为了提升 Liquid 模板的易用性,参考 <a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/harttle/liquidjs/issues/208">#208</a><a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/harttle/liquidjs/issues/212">#212</a></li>
</ul>
</div>
<footer class="article-footer">
<time class="article-footer-updated" datetime="2021-09-26T12:45:03.359Z" itemprop="dateModified">上次更新:2021-09-26</time>
<time class="article-footer-updated" datetime="2021-09-30T16:54:19.718Z" itemprop="dateModified">上次更新:2021-09-30</time>
<a href="changelog.html" class="article-footer-prev" title="更新日志"><i class="icon-chevron-left"></i><span>上一页</span></a><a href="contribution-guidelines.html" class="article-footer-next" title="贡献指南"><span>下一页</span><i class="icon-chevron-right"></i></a>
</footer>
</div>