Wener Notes

Liquid

约 1 分钟阅读
  • shopify/liquidGitHubshopify/liquidshopify/liquid · MIT, Ruby · 非图灵完备 · adopted by: Shopify, BigCommerce(有 handlebars 支持), Zendesk, Jekyll, Eleventy · 参考 · Spec https://shopify.github.io/liquid/笔记:Liquid
    • MIT, Ruby
    • 非图灵完备
    • adopted by: Shopify, BigCommerce(有 handlebars 支持), Zendesk, Jekyll, Eleventy
  • 参考
  • if/else/endif,unless/endunless,case/when/else/endcase
  • for/else/continue/break/endfor
  • echo, render, liquid, raw/endraw
  • assign,increment,decrement
  • include
  • capture/endcapture
  • operators: ==, !=, <, <=, >, >=, and, or, contains
liquid
{% assign username = "John G. Chalmers-Smith" -%}
{%- if username and username.size > 10 -%}
  Wow, {{ username -}} , you have a long name!
{%- else -%}
  Hello there!
{%- endif %}


{% for item in array limit:2 offset:2 %}
  {{ item }}
{% endfor %}

{% for i in (3..5) %}
  {{ i }}
{% endfor %}


{% assign num = 4 %}
{% assign range = (1..num) %}
{% for i in range reversed %}
  {{ i }}
{% endfor %}


{% liquid
  # this is a comment
  assign topic = 'Learning about comments!'
  echo topic
%}

{% # comment %}

{% raw %}
In Handlebars, {{ this }} will be HTML-escaped, but {{{ that }}} will not.
{% endraw %}

关联信息

反向链接、本文链接的其他页面和外部资料。

References

GitHub6 条
其他外链2 条
最近更新commit 9ed3793Edit

On this page