docs: add versions to tags/filters, see #305

This commit is contained in:
harttle
2021-03-21 22:17:17 +08:00
parent 2133ed20d7
commit 695e3c18bc
129 changed files with 262 additions and 2 deletions
+6 -2
View File
@@ -2,7 +2,7 @@
'use strict' 'use strict'
hexo.extend.tag.register('note', (args, content) => { hexo.extend.tag.register('note', (args, text) => {
const className = args.shift() const className = args.shift()
let header = '' let header = ''
let result = '' let result = ''
@@ -12,8 +12,12 @@ hexo.extend.tag.register('note', (args, content) => {
} }
result += `<blockquote class="note ${className}">${header}` result += `<blockquote class="note ${className}">${header}`
result += hexo.render.renderSync({ text: content, engine: 'markdown' }) result += hexo.render.renderSync({ text, engine: 'markdown' })
result += '</blockquote>' result += '</blockquote>'
return result return result
}, true) }, true)
hexo.extend.tag.register('since', (args, text) => {
return `<p class="since">Added in: ${text.trim()}</p>`
}, true)
+2
View File
@@ -2,6 +2,8 @@
title: abs title: abs
--- ---
{% since %}v1.9.1{% endsince %}
Liquid filter that returns the absolute value of a number. Liquid filter that returns the absolute value of a number.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: append title: append
--- ---
{% since %}v1.9.1{% endsince %}
Concatenates two strings and returns the concatenated value. Concatenates two strings and returns the concatenated value.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: at_least title: at_least
--- ---
{% since %}v8.4.0{% endsince %}
Limits a number to a minimum value. Limits a number to a minimum value.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: at_most title: at_most
--- ---
{% since %}v8.4.0{% endsince %}
Limits a number to a maximum value. Limits a number to a maximum value.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: capitalize title: capitalize
--- ---
{% since %}v1.9.1{% endsince %}
Makes the first character of a string capitalized. Makes the first character of a string capitalized.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: ceil title: ceil
--- ---
{% since %}v1.9.1{% endsince %}
Rounds the input up to the nearest whole number. LiquidJS tries to convert the input to a number before the filter is applied. Rounds the input up to the nearest whole number. LiquidJS tries to convert the input to a number before the filter is applied.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: compact title: compact
--- ---
{% since %}v9.22.0{% endsince %}
Removes any `nil` values from an array. Removes any `nil` values from an array.
For this example, assume `site.pages` is an array of content pages for a website, and some of these pages have an attribute called `category` that specifies their content category. If we `map` those categories to an array, some of the array items might be `nil` if any pages do not have a `category` attribute. For this example, assume `site.pages` is an array of content pages for a website, and some of these pages have an attribute called `category` that specifies their content category. If we `map` those categories to an array, some of the array items might be `nil` if any pages do not have a `category` attribute.
+2
View File
@@ -2,6 +2,8 @@
title: date title: date
--- ---
{% since %}v1.9.1{% endsince %}
Converts a timestamp into another date format. LiquidJS tries to be conformant with Shopify/Liquid which is using Ruby's core [Time#strftime(string)](http://www.ruby-doc.org/core/Time.html#method-i-strftime). The input is firstly converted to `Date` object via [new Date()][newDate]. Converts a timestamp into another date format. LiquidJS tries to be conformant with Shopify/Liquid which is using Ruby's core [Time#strftime(string)](http://www.ruby-doc.org/core/Time.html#method-i-strftime). The input is firstly converted to `Date` object via [new Date()][newDate].
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: default title: default
--- ---
{% since %}v1.9.1{% endsince %}
Allows you to specify a fallback in case a value doesn't exist. `default` will show its value if the left side is [falsy][falsy] or empty (`string` or `Array`). Allows you to specify a fallback in case a value doesn't exist. `default` will show its value if the left side is [falsy][falsy] or empty (`string` or `Array`).
In this example, `product_price` is not defined, so the default value is used. In this example, `product_price` is not defined, so the default value is used.
+2
View File
@@ -2,6 +2,8 @@
title: divided_by title: divided_by
--- ---
{% since %}v1.9.1{% endsince %}
Divides a number by another number. The result is the string obtained by JavaScript `.toString()` of the result number. Divides a number by another number. The result is the string obtained by JavaScript `.toString()` of the result number.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: downcase title: downcase
--- ---
{% since %}v1.9.1{% endsince %}
Makes each character in a string lowercase. It has no effect on strings which are already all lowercase. Makes each character in a string lowercase. It has no effect on strings which are already all lowercase.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: escape title: escape
--- ---
{% since %}v1.9.1{% endsince %}
Escapes a string by replacing HTML special characters with escape sequences. It doesn't change strings that don't have anything to escape. Escapes a string by replacing HTML special characters with escape sequences. It doesn't change strings that don't have anything to escape.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: escape_once title: escape_once
--- ---
{% since %}v1.9.1{% endsince %}
Escapes a string without changing existing escaped entities. It doesn't change strings that don't have anything to escape. Escapes a string without changing existing escaped entities. It doesn't change strings that don't have anything to escape.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: first title: first
--- ---
{% since %}v1.9.1{% endsince %}
Returns the first item of an array. Returns the first item of an array.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: floor title: floor
--- ---
{% since %}v1.9.1{% endsince %}
Rounds the input down to the nearest whole number. LiquidJS tries to convert the input to a number before the filter is applied. Rounds the input down to the nearest whole number. LiquidJS tries to convert the input to a number before the filter is applied.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: join title: join
--- ---
{% since %}v1.9.1{% endsince %}
Combines the items in an array into a single string using the argument as a separator. Combines the items in an array into a single string using the argument as a separator.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: json title: json
--- ---
{% since %}v9.10.0{% endsince %}
Convert values to string via `JSON.stringify()`, for debug purpose. Convert values to string via `JSON.stringify()`, for debug purpose.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: last title: last
--- ---
{% since %}v1.9.1{% endsince %}
Returns the last item of an array. Returns the last item of an array.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: lstrip title: lstrip
--- ---
{% since %}v1.9.1{% endsince %}
Removes all whitespace (tabs, spaces, and newlines) from the left side of a string. It does not affect spaces between words. Removes all whitespace (tabs, spaces, and newlines) from the left side of a string. It does not affect spaces between words.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: map title: map
--- ---
{% since %}v1.9.1{% endsince %}
Creates an array of values by extracting the values of a named property from another object. Creates an array of values by extracting the values of a named property from another object.
In this example, assume the object `site.pages` contains all the metadata for a website. Using `assign` with the `map` filter creates a variable that contains only the values of the `category` properties of everything in the `site.pages` object. In this example, assume the object `site.pages` contains all the metadata for a website. Using `assign` with the `map` filter creates a variable that contains only the values of the `category` properties of everything in the `site.pages` object.
+2
View File
@@ -2,6 +2,8 @@
title: minus title: minus
--- ---
{% since %}v1.9.1{% endsince %}
Subtracts a number from another number. Subtracts a number from another number.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: modulo title: modulo
--- ---
{% since %}v1.9.1{% endsince %}
Returns the remainder of a division operation. Returns the remainder of a division operation.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: newline_to_br title: newline_to_br
--- ---
{% since %}v1.9.1{% endsince %}
Replaces every newline (`\n`) in a string with an HTML line break (`<br />`). Replaces every newline (`\n`) in a string with an HTML line break (`<br />`).
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: plus title: plus
--- ---
{% since %}v1.9.1{% endsince %}
Adds a number to another number. Adds a number to another number.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: prepend title: prepend
--- ---
{% since %}v1.9.1{% endsince %}
Adds the specified string to the beginning of another string. Adds the specified string to the beginning of another string.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: remove title: remove
--- ---
{% since %}v1.9.1{% endsince %}
Removes every occurrence of the specified substring from a string. Removes every occurrence of the specified substring from a string.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: remove_first title: remove_first
--- ---
{% since %}v1.9.1{% endsince %}
Removes only the first occurrence of the specified substring from a string. Removes only the first occurrence of the specified substring from a string.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: replace title: replace
--- ---
{% since %}v1.9.1{% endsince %}
Replaces every occurrence of the first argument in a string with the second argument. Replaces every occurrence of the first argument in a string with the second argument.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: replace_first title: replace_first
--- ---
{% since %}v1.9.1{% endsince %}
Replaces only the first occurrence of the first argument in a string with the second argument. Replaces only the first occurrence of the first argument in a string with the second argument.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: reverse title: reverse
--- ---
{% since %}v1.9.1{% endsince %}
Reverses the order of the items in an array. `reverse` cannot reverse a string. Reverses the order of the items in an array. `reverse` cannot reverse a string.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: round title: round
--- ---
{% since %}v1.9.1{% endsince %}
Rounds a number to the nearest integer or, if a number is passed as an argument, to that number of decimal places. Rounds a number to the nearest integer or, if a number is passed as an argument, to that number of decimal places.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: rstrip title: rstrip
--- ---
{% since %}v1.9.1{% endsince %}
Removes all whitespace (tabs, spaces, and newlines) from the right side of a string. It does not affect spaces between words. Removes all whitespace (tabs, spaces, and newlines) from the right side of a string. It does not affect spaces between words.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: size title: size
--- ---
{% since %}v1.9.1{% endsince %}
Returns the number of characters in a string or the number of items in an array. Returns the number of characters in a string or the number of items in an array.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: slice title: slice
--- ---
{% since %}v1.9.1{% endsince %}
Returns a substring of 1 character beginning at the index specified by the first argument. An optional second argument specifies the length of the substring to be returned. Returns a substring of 1 character beginning at the index specified by the first argument. An optional second argument specifies the length of the substring to be returned.
String indices are numbered starting from 0. String indices are numbered starting from 0.
+2
View File
@@ -2,6 +2,8 @@
title: sort title: sort
--- ---
{% since %}v1.9.1{% endsince %}
Sorts items in an array in case-sensitive order. Sorts items in an array in case-sensitive order.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: sort_natural title: sort_natural
--- ---
{% since %}v8.4.0{% endsince %}
Sorts items in an array in case-insensitive order. Sorts items in an array in case-insensitive order.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: split title: split
--- ---
{% since %}v1.9.1{% endsince %}
Divides a string into an array using the argument as a separator. `split` is commonly used to convert comma-separated items from a string to an array. Divides a string into an array using the argument as a separator. `split` is commonly used to convert comma-separated items from a string to an array.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: strip title: strip
--- ---
{% since %}v1.9.1{% endsince %}
Removes all whitespace (tabs, spaces, and newlines) from both the left and right sides of a string. It does not affect spaces between words. Removes all whitespace (tabs, spaces, and newlines) from both the left and right sides of a string. It does not affect spaces between words.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: strip_html title: strip_html
--- ---
{% since %}v1.9.1{% endsince %}
Removes any HTML tags from a string. Removes any HTML tags from a string.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: strip_newlines title: strip_newlines
--- ---
{% since %}v1.9.1{% endsince %}
Removes any newline characters (line breaks) from a string. Removes any newline characters (line breaks) from a string.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: times title: times
--- ---
{% since %}v1.9.1{% endsince %}
Multiplies a number by another number. Multiplies a number by another number.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: truncate title: truncate
--- ---
{% since %}v1.9.1{% endsince %}
Shortens a string down to the number of characters passed as an argument. If the specified number of characters is less than the length of the string, an ellipsis (...) is appended to the string and is included in the character count. Shortens a string down to the number of characters passed as an argument. If the specified number of characters is less than the length of the string, an ellipsis (...) is appended to the string and is included in the character count.
## Basic Usage ## Basic Usage
+2
View File
@@ -2,6 +2,8 @@
title: truncatewords title: truncatewords
--- ---
{% since %}v1.9.1{% endsince %}
Shortens a string down to the number of words passed as an argument. If the specified number of words is less than the number of words in the string, an ellipsis (...) is appended to the string. Shortens a string down to the number of words passed as an argument. If the specified number of words is less than the number of words in the string, an ellipsis (...) is appended to the string.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: uniq title: uniq
--- ---
{% since %}v1.9.1{% endsince %}
Removes any duplicate elements in an array. Removes any duplicate elements in an array.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: upcase title: upcase
--- ---
{% since %}v1.9.1{% endsince %}
Makes each character in a string uppercase. It has no effect on strings which are already all uppercase. Makes each character in a string uppercase. It has no effect on strings which are already all uppercase.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: url_decode title: url_decode
--- ---
{% since %}v6.1.0{% endsince %}
Decodes a string that has been encoded as a URL. Decodes a string that has been encoded as a URL.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: url_encode title: url_encode
--- ---
{% since %}v1.9.1{% endsince %}
Converts any URL-unsafe characters in a string into percent-encoded characters. Converts any URL-unsafe characters in a string into percent-encoded characters.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: where title: where
--- ---
{% since %}v8.1.0{% endsince %}
Creates an array including only the objects with a given property value, or any [truthy][truthy] value by default. Creates an array including only the objects with a given property value, or any [truthy][truthy] value by default.
In this example, assume you have a list of products and you want to show your kitchen products separately. Using `where`, you can create an array containing only the products that have a `"type"` of `"kitchen"`. In this example, assume you have a list of products and you want to show your kitchen products separately. Using `where`, you can create an array containing only the products that have a `"type"` of `"kitchen"`.
+2
View File
@@ -2,6 +2,8 @@
title: Assign title: Assign
--- ---
{% since %}v1.9.1{% endsince %}
Creates a new variable. Creates a new variable.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: capture title: capture
--- ---
{% since %}v1.9.1{% endsince %}
Captures the string inside of the opening and closing tags and assigns it to a variable. Variables created through `capture` are strings. Captures the string inside of the opening and closing tags and assigns it to a variable. Variables created through `capture` are strings.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: case title: case
--- ---
{% since %}v1.9.1{% endsince %}
Creates a switch statement to compare a variable with different values. `case` initializes the switch statement, and `when` compares its values. Creates a switch statement to compare a variable with different values. `case` initializes the switch statement, and `when` compares its values.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: Comment title: Comment
--- ---
{% since %}v1.9.1{% endsince %}
Allows you to leave un-rendered code inside a Liquid template. Any text within the opening and closing `comment` blocks will not be printed, and any Liquid code within will not be executed. Allows you to leave un-rendered code inside a Liquid template. Any text within the opening and closing `comment` blocks will not be printed, and any Liquid code within will not be executed.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: cycle title: cycle
--- ---
{% since %}v1.9.1{% endsince %}
Loops through a group of strings and prints them in the order that they were passed as arguments. Each time `cycle` is called, the next string argument is printed. Loops through a group of strings and prints them in the order that they were passed as arguments. Each time `cycle` is called, the next string argument is printed.
## Basic Usage ## Basic Usage
+2
View File
@@ -2,6 +2,8 @@
title: Decrement title: Decrement
--- ---
{% since %}v1.9.1{% endsince %}
Creates a new number variable, and decreases its value by one every time it is called. The first value is `-1`. Creates a new number variable, and decreases its value by one every time it is called. The first value is `-1`.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: For title: For
--- ---
{% since %}v1.9.1{% endsince %}
Iteration tags run blocks of code repeatedly. Iteration tags run blocks of code repeatedly.
## Basic Usage ## Basic Usage
+2
View File
@@ -2,6 +2,8 @@
title: If title: If
--- ---
{% since %}v1.9.1{% endsince %}
Executes a block of code only if a certain condition is `true`. Executes a block of code only if a certain condition is `true`.
## if ## if
+2
View File
@@ -2,6 +2,8 @@
title: Include title: Include
--- ---
{% since %}v1.9.1{% endsince %}
{% note warn Deprecated %} {% note warn Deprecated %}
This tag is deprecated, use <a href="./render.html">render</a> tag instead for better encapsulation. This tag is deprecated, use <a href="./render.html">render</a> tag instead for better encapsulation.
{% endnote %} {% endnote %}
+2
View File
@@ -2,6 +2,8 @@
title: Increment title: Increment
--- ---
{% since %}v1.9.1{% endsince %}
Creates a new number variable, and increases its value by one every time it is called. The first value is `0`. Creates a new number variable, and increases its value by one every time it is called. The first value is `0`.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: Layout title: Layout
--- ---
{% since %}v1.9.1{% endsince %}
## Using a Layout Template ## Using a Layout Template
Renders current template inside a layout template from the template [roots][root]. Renders current template inside a layout template from the template [roots][root].
+2
View File
@@ -2,6 +2,8 @@
title: Raw title: Raw
--- ---
{% since %}v1.9.1{% endsince %}
Raw temporarily disables tag processing. This is useful for generating content Raw temporarily disables tag processing. This is useful for generating content
(eg, Mustache, Handlebars) which uses conflicting syntax. (eg, Mustache, Handlebars) which uses conflicting syntax.
+2
View File
@@ -2,6 +2,8 @@
title: Render title: Render
--- ---
{% since %}v9.2.0{% endsince %}
## Basic Usage ## Basic Usage
### Render a Template ### Render a Template
+2
View File
@@ -2,6 +2,8 @@
title: Table Row title: Table Row
--- ---
{% since %}v1.9.1{% endsince %}
Generates an HTML table. Must be wrapped in opening `<table>` and closing `</table>` HTML tags. Generates an HTML table. Must be wrapped in opening `<table>` and closing `</table>` HTML tags.
## Basic Usage ## Basic Usage
+2
View File
@@ -2,6 +2,8 @@
title: Unless title: Unless
--- ---
{% since %}v1.9.1{% endsince %}
The opposite of `if` – executes a block of code only if a certain condition is **not** met. The opposite of `if` – executes a block of code only if a certain condition is **not** met.
Input Input
+2
View File
@@ -2,6 +2,8 @@
title: abs title: abs
--- ---
{% since %}v1.9.1{% endsince %}
返回数字的绝对值。 返回数字的绝对值。
输入 输入
+2
View File
@@ -2,6 +2,8 @@
title: append title: append
--- ---
{% since %}v1.9.1{% endsince %}
连接两个字符串并返回结果。 连接两个字符串并返回结果。
输入 输入
+2
View File
@@ -2,6 +2,8 @@
title: at_least title: at_least
--- ---
{% since %}v8.4.0{% endsince %}
限制数字到某个最小值。 限制数字到某个最小值。
输入 输入
+2
View File
@@ -2,6 +2,8 @@
title: at_most title: at_most
--- ---
{% since %}v8.4.0{% endsince %}
限制数字到某个最大值。 限制数字到某个最大值。
输入 输入
+2
View File
@@ -2,6 +2,8 @@
title: capitalize title: capitalize
--- ---
{% since %}v1.9.1{% endsince %}
把字符串首字母改为大写。 把字符串首字母改为大写。
输入 输入
+2
View File
@@ -2,6 +2,8 @@
title: ceil title: ceil
--- ---
{% since %}v1.9.1{% endsince %}
向上取整,取整前 LiquidJS 会首先把输入转换为数字。 向上取整,取整前 LiquidJS 会首先把输入转换为数字。
输入 输入
+2
View File
@@ -2,6 +2,8 @@
title: compact title: compact
--- ---
{% since %}v9.22.0{% endsince %}
从数组里移除任何 `null` 和 `undefined` 值。 从数组里移除任何 `null` 和 `undefined` 值。
假设 `site.pages` 是网页列表,有些网页包含 `category` 属性用来标明类别。如果把它们 `map` 到数组里,那么对于没有 `category` 属性的元素就会是 `undefined`。 假设 `site.pages` 是网页列表,有些网页包含 `category` 属性用来标明类别。如果把它们 `map` 到数组里,那么对于没有 `category` 属性的元素就会是 `undefined`。
+2
View File
@@ -2,6 +2,8 @@
title: date title: date
--- ---
{% since %}v1.9.1{% endsince %}
把时间戳转换为字符串。LiquidJS 尝试跟 Shopify/Liquid 保持一致,它用的是 Ruby 核心的 [Time#strftime(string)](http://www.ruby-doc.org/core/Time.html#method-i-strftime)。此外 LiquidJS 会先通过 [new Date()][newDate] 尝试把输入转换为 Date 对象。 把时间戳转换为字符串。LiquidJS 尝试跟 Shopify/Liquid 保持一致,它用的是 Ruby 核心的 [Time#strftime(string)](http://www.ruby-doc.org/core/Time.html#method-i-strftime)。此外 LiquidJS 会先通过 [new Date()][newDate] 尝试把输入转换为 Date 对象。
输入 输入
+2
View File
@@ -2,6 +2,8 @@
title: default title: default
--- ---
{% since %}v1.9.1{% endsince %}
在值不存在时给一个默认值,如果左侧是 [falsy][falsy] 或空(`string` 或 `Array`)就会使用这个默认值。下面的例子中 `product_price` 没有定义,因此使用了默认值。 在值不存在时给一个默认值,如果左侧是 [falsy][falsy] 或空(`string` 或 `Array`)就会使用这个默认值。下面的例子中 `product_price` 没有定义,因此使用了默认值。
输入 输入
+2
View File
@@ -2,6 +2,8 @@
title: divided_by title: divided_by
--- ---
{% since %}v1.9.1{% endsince %}
两数相除返回商,返回结果数字在 JavaScript 中 `.toString()` 得到的字符串。 两数相除返回商,返回结果数字在 JavaScript 中 `.toString()` 得到的字符串。
输入 输入
+2
View File
@@ -2,6 +2,8 @@
title: downcase title: downcase
--- ---
{% since %}v1.9.1{% endsince %}
字符串中每个字符都转为小写,对已经是小写的字符没有影响。 字符串中每个字符都转为小写,对已经是小写的字符没有影响。
输入 输入
+2
View File
@@ -2,6 +2,8 @@
title: escape title: escape
--- ---
{% since %}v1.9.1{% endsince %}
把字符串中的 HTML 特殊字符转义,对不需要转义的字符串不会产生影响。 把字符串中的 HTML 特殊字符转义,对不需要转义的字符串不会产生影响。
输入 输入
+2
View File
@@ -2,6 +2,8 @@
title: escape_once title: escape_once
--- ---
{% since %}v1.9.1{% endsince %}
把字符串中的特殊字符转义得到可用在 URL 里的字符串,对已经转义过的字符串和不需要转义的字符串不会产生影响。 把字符串中的特殊字符转义得到可用在 URL 里的字符串,对已经转义过的字符串和不需要转义的字符串不会产生影响。
输入 输入
+2
View File
@@ -2,6 +2,8 @@
title: first title: first
--- ---
{% since %}v1.9.1{% endsince %}
返回数组的第一个元素。 返回数组的第一个元素。
输入 输入
+2
View File
@@ -2,6 +2,8 @@
title: floor title: floor
--- ---
{% since %}v1.9.1{% endsince %}
数字下取整,LiquidJS 会尝试把输入转换为数字再做下取整操作。 数字下取整,LiquidJS 会尝试把输入转换为数字再做下取整操作。
输入 输入
+2
View File
@@ -2,6 +2,8 @@
title: join title: join
--- ---
{% since %}v1.9.1{% endsince %}
把数组中的元素连接成为一个字符串,以传入的参数作为分隔符。 把数组中的元素连接成为一个字符串,以传入的参数作为分隔符。
输入 输入
+2
View File
@@ -2,6 +2,8 @@
title: json title: json
--- ---
{% since %}v9.10.0{% endsince %}
通过 `JSON.stringify()` 把值转换为字符串,多用于调试用途。 通过 `JSON.stringify()` 把值转换为字符串,多用于调试用途。
输入 输入
+2
View File
@@ -2,6 +2,8 @@
title: last title: last
--- ---
{% since %}v1.9.1{% endsince %}
返回数组的最后一个元素。 返回数组的最后一个元素。
输入 输入
+2
View File
@@ -2,6 +2,8 @@
title: lstrip title: lstrip
--- ---
{% since %}v1.9.1{% endsince %}
移除字符串左侧的空白字符(制表符、空格、换行),不影响词之间的空格。 移除字符串左侧的空白字符(制表符、空格、换行),不影响词之间的空格。
输入 输入
+2
View File
@@ -2,6 +2,8 @@
title: map title: map
--- ---
{% since %}v1.9.1{% endsince %}
按照属性名提取对象的属性形成另一个数组并返回。 按照属性名提取对象的属性形成另一个数组并返回。
下面的例子中假设 `site.pages` 包含了站点的所有网页元信息。使用 `assign` 加 `map` 过滤器创建了一个 `site.pages` 中所有对象的 `category` 属性的值构成的数组。 下面的例子中假设 `site.pages` 包含了站点的所有网页元信息。使用 `assign` 加 `map` 过滤器创建了一个 `site.pages` 中所有对象的 `category` 属性的值构成的数组。
+2
View File
@@ -2,6 +2,8 @@
title: minus title: minus
--- ---
{% since %}v1.9.1{% endsince %}
两数相减。 两数相减。
输入 输入
+2
View File
@@ -2,6 +2,8 @@
title: modulo title: modulo
--- ---
{% since %}v1.9.1{% endsince %}
返回两数相除的余数。 返回两数相除的余数。
输入 输入
@@ -2,6 +2,8 @@
title: newline_to_br title: newline_to_br
--- ---
{% since %}v1.9.1{% endsince %}
把字符串里的所有换行符(`\n`)替换为 HTML 换行(`<br />`)。 把字符串里的所有换行符(`\n`)替换为 HTML 换行(`<br />`)。
输入 输入
+2
View File
@@ -2,6 +2,8 @@
title: plus title: plus
--- ---
{% since %}v1.9.1{% endsince %}
两数相加。 两数相加。
输入 输入
+2
View File
@@ -2,6 +2,8 @@
title: prepend title: prepend
--- ---
{% since %}v1.9.1{% endsince %}
在字符串开头添加另一个字符串。 在字符串开头添加另一个字符串。
输入 输入
+2
View File
@@ -2,6 +2,8 @@
title: remove title: remove
--- ---
{% since %}v1.9.1{% endsince %}
移除字符串中出现的所有指定子字符串。 移除字符串中出现的所有指定子字符串。
输入 输入
@@ -2,6 +2,8 @@
title: remove_first title: remove_first
--- ---
{% since %}v1.9.1{% endsince %}
移除字符串中出现的第一个指定子字符串。 移除字符串中出现的第一个指定子字符串。
输入 输入
+2
View File
@@ -2,6 +2,8 @@
title: replace title: replace
--- ---
{% since %}v1.9.1{% endsince %}
把字符串中出现的每一个指定子字符串替换为另一个字符串。 把字符串中出现的每一个指定子字符串替换为另一个字符串。
输入 输入
@@ -2,6 +2,8 @@
title: replace_first title: replace_first
--- ---
{% since %}v1.9.1{% endsince %}
把字符串中出现的第一个指定子字符串替换为另一个字符串。 把字符串中出现的第一个指定子字符串替换为另一个字符串。
输入 输入
+2
View File
@@ -2,6 +2,8 @@
title: reverse title: reverse
--- ---
{% since %}v1.9.1{% endsince %}
反转数组的所有元素,不可用于字符串。 反转数组的所有元素,不可用于字符串。
输入 输入
+2
View File
@@ -2,6 +2,8 @@
title: round title: round
--- ---
{% since %}v1.9.1{% endsince %}
数字四舍五入取整,如果传入小数位数作为参数。 数字四舍五入取整,如果传入小数位数作为参数。
输入 输入
+2
View File
@@ -2,6 +2,8 @@
title: rstrip title: rstrip
--- ---
{% since %}v1.9.1{% endsince %}
移除字符串右侧的空白字符(制表符、空格、换行),不影响词之间的空格。 移除字符串右侧的空白字符(制表符、空格、换行),不影响词之间的空格。
输入 输入
+2
View File
@@ -2,6 +2,8 @@
title: size title: size
--- ---
{% since %}v1.9.1{% endsince %}
返回字符串的字符个数或者数组的元素个数。 返回字符串的字符个数或者数组的元素个数。
输入 输入
+2
View File
@@ -2,6 +2,8 @@
title: slice title: slice
--- ---
{% since %}v1.9.1{% endsince %}
返回第一个参数为下标位置的一个字符,如果指定了第二个参数会被解释为子字符串的长度。字符串下标从零开始。 返回第一个参数为下标位置的一个字符,如果指定了第二个参数会被解释为子字符串的长度。字符串下标从零开始。
输入 输入
+2
View File
@@ -2,6 +2,8 @@
title: sort title: sort
--- ---
{% since %}v1.9.1{% endsince %}
对数组中的元素排序,排序方式为 JavaScript `Array.prototype.sort()`。 对数组中的元素排序,排序方式为 JavaScript `Array.prototype.sort()`。
输入 输入
@@ -2,6 +2,8 @@
title: sort_natural title: sort_natural
--- ---
{% since %}v8.4.0{% endsince %}
大小写不敏感地对数组元素排序。 大小写不敏感地对数组元素排序。
输入 输入

Some files were not shown because too many files have changed in this diff Show More