mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-29 15:15:23 -07:00
docs: zh-cn doc for inline comment
This commit is contained in:
@@ -13,6 +13,6 @@ Iteration | iterate over a collection | for, cycle, tablerow
|
|||||||
Control Flow | control the execution branch of template rendering | if, unless, elsif, else, case, when
|
Control Flow | control the execution branch of template rendering | if, unless, elsif, else, case, when
|
||||||
Variable | define and alter variables | assign, increment, decrement, capture, echo
|
Variable | define and alter variables | assign, increment, decrement, capture, echo
|
||||||
File | include another template or extend a layout template | render, include, layout
|
File | include another template or extend a layout template | render, include, layout
|
||||||
Language | temporarily disable LiquidJS syntax | raw, comment, liquid
|
Language | temporarily disable LiquidJS syntax | # (inline comment), raw, comment, liquid
|
||||||
|
|
||||||
[shopify/liquid]: https://github.com/Shopify/liquid
|
[shopify/liquid]: https://github.com/Shopify/liquid
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
---
|
||||||
|
title: "#(单行注释)"
|
||||||
|
---
|
||||||
|
|
||||||
|
{% since %}v9.38.0{% endsince %}
|
||||||
|
|
||||||
|
在 Liquid 模板中添加注释,注释标签内的文字不会被输出。
|
||||||
|
|
||||||
|
输入
|
||||||
|
```liquid
|
||||||
|
注释标签内的东西都不会输出。
|
||||||
|
{% # this is an inline comment %}
|
||||||
|
但每行都必须以 '#' 开头。
|
||||||
|
{%
|
||||||
|
# this is a comment
|
||||||
|
# that spans multiple lines
|
||||||
|
%}
|
||||||
|
```
|
||||||
|
|
||||||
|
输出
|
||||||
|
```text
|
||||||
|
注释标签内的东西都不会输出。
|
||||||
|
但每行都必须以 '#' 开头。
|
||||||
|
```
|
||||||
|
|
||||||
|
在 <a href="./liquid.html">`liquid`</a> 标签里也可以使用注释标签。
|
||||||
|
|
||||||
|
```liquid
|
||||||
|
{% liquid
|
||||||
|
# required args
|
||||||
|
assign product = collection.products.first
|
||||||
|
|
||||||
|
# optional args
|
||||||
|
assign should_show_border = should_show_border | default: true
|
||||||
|
assign should_highlight = should_highlight | default: false
|
||||||
|
%}
|
||||||
|
```
|
||||||
|
|
||||||
|
但注释标签不能用于把其他标签注释掉。这时应该使用 <a href="./comment.html">`comment`</a> 标签来临时禁用其他标签。
|
||||||
|
|
||||||
|
输入
|
||||||
|
```liquid
|
||||||
|
{%- # {% echo 'Welcome to LiquidJS!' %} -%}
|
||||||
|
{% comment %}{% echo 'Welcome to LiquidJS!' %}{% endcomment %}
|
||||||
|
```
|
||||||
|
|
||||||
|
输出
|
||||||
|
```text
|
||||||
|
-%}
|
||||||
|
```
|
||||||
@@ -13,6 +13,6 @@ LiquidJS 支持十几个过滤器,可以分为如下几类:
|
|||||||
控制流 | 控制模板渲染的执行分支 | if, unless, elif, else, case, when
|
控制流 | 控制模板渲染的执行分支 | if, unless, elif, else, case, when
|
||||||
变量 | 定义和修改变量 | assign, increment, decrement, capture, echo
|
变量 | 定义和修改变量 | assign, increment, decrement, capture, echo
|
||||||
文件 | 引入或继承其他模板 | render, include, layout
|
文件 | 引入或继承其他模板 | render, include, layout
|
||||||
语言 | 暂时禁用 Liquid 语法 | raw, comment, liquid
|
语言 | 暂时禁用 Liquid 语法 | # (单行注释), raw, comment, liquid
|
||||||
|
|
||||||
[shopify/liquid]: https://github.com/Shopify/liquid
|
[shopify/liquid]: https://github.com/Shopify/liquid
|
||||||
|
|||||||
Vendored
+1
@@ -59,6 +59,7 @@ sidebar:
|
|||||||
overview: 概述
|
overview: 概述
|
||||||
tags:
|
tags:
|
||||||
overview: 概述
|
overview: 概述
|
||||||
|
'# (inline comment)': '#(单行注释)'
|
||||||
api:
|
api:
|
||||||
quick_entry: 快速入口
|
quick_entry: 快速入口
|
||||||
classes: 类
|
classes: 类
|
||||||
|
|||||||
Reference in New Issue
Block a user