diff --git a/.gitignore b/.gitignore index fdc96229e..a47f15151 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ node_modules/ # tmp docs/public/js/liquid.browser.min.js +docs/themes/navy/layout/partial/all-contributors.swig dist/ demo/*/yarn.json diff --git a/docs/source/_data/sidebar.yml b/docs/source/_data/sidebar.yml index 46cc138c4..97708c68c 100644 --- a/docs/source/_data/sidebar.yml +++ b/docs/source/_data/sidebar.yml @@ -51,6 +51,7 @@ filters: modulo: modulo.html newline_to_br: newline_to_br.html plus: plus.html + push: push.html prepend: prepend.html raw: raw.html remove: remove.html diff --git a/docs/source/filters/overview.md b/docs/source/filters/overview.md index 51178b399..e0503f379 100644 --- a/docs/source/filters/overview.md +++ b/docs/source/filters/overview.md @@ -12,7 +12,7 @@ Categories | Filters Math | plus, minus, modulo, times, floor, ceil, round, divided_by, abs, at_least, at_most String | append, prepend, capitalize, upcase, downcase, strip, lstrip, rstrip, strip_newlines, split, replace, replace_first, replace_last,remove, remove_first, remove_last, truncate, truncatewords HTML/URI | escape, escape_once, url_encode, url_decode, strip_html, newline_to_br -Array | slice, map, sort, sort_natural, uniq, where, first, last, join, reverse, concat, compact, size +Array | slice, map, sort, sort_natural, uniq, where, first, last, join, reverse, concat, compact, size, push Date | date Misc | default, json, raw diff --git a/docs/source/filters/push.md b/docs/source/filters/push.md new file mode 100644 index 000000000..1844708b8 --- /dev/null +++ b/docs/source/filters/push.md @@ -0,0 +1,25 @@ +--- +title: push +--- + +{% since %}v10.8.0{% endsince %} + +Push an element into array. It's NON-DESTRUCTIVE, i.e. it does not mutate the array, but rather make a copy and mutate that. + +Input +```liquid +{% assign fruits = "apples, oranges" | split: ", " %} + +{% assign everything = fruits | push: "peaches" %} + +{% for item in everything %} +- {{ item }} +{% endfor %} +``` + +Output +```text +- apples +- oranges +- peaches +``` diff --git a/docs/source/zh-cn/filters/overview.md b/docs/source/zh-cn/filters/overview.md index 0be713afd..3a27e43a6 100644 --- a/docs/source/zh-cn/filters/overview.md +++ b/docs/source/zh-cn/filters/overview.md @@ -12,7 +12,7 @@ LiquidJS 共支持 40+ 个过滤器,可以分为如下几类: 数学 | plus, minus, modulo, times, floor, ceil, round, divided_by, abs, at_least, at_most 字符串 | append, prepend, capitalize, upcase, downcase, strip, lstrip, rstrip, strip_newlines, split, replace, replace_first, replace_last, remove, remove_first, remove_last, truncate, truncatewords HTML/URI | escape, escape_once, url_encode, url_decode, strip_html, newline_to_br -数组 | slice, map, sort, sort_natural, uniq, wheres, first, last, join, reverse, concat, compact, size +数组 | slice, map, sort, sort_natural, uniq, wheres, first, last, join, reverse, concat, compact, size, push 日期 | date 其他 | default, json diff --git a/docs/source/zh-cn/filters/push.md b/docs/source/zh-cn/filters/push.md new file mode 100644 index 000000000..ea24324d9 --- /dev/null +++ b/docs/source/zh-cn/filters/push.md @@ -0,0 +1,25 @@ +--- +title: push +--- + +{% since %}v10.8.0{% endsince %} + +在数组中添加一个元素。注意该操作不会改变原数组,而是在一份拷贝上操作。 + +输入 +```liquid +{% assign fruits = "apples, oranges" | split: ", " %} + +{% assign everything = fruits | push: "peaches" %} + +{% for item in everything %} +- {{ item }} +{% endfor %} +``` + +输出 +```text +- apples +- oranges +- peaches +``` diff --git a/docs/themes/navy/layout/partial/all-contributors.swig b/docs/themes/navy/layout/partial/all-contributors.swig deleted file mode 100644 index 1e183f1d0..000000000 --- a/docs/themes/navy/layout/partial/all-contributors.swig +++ /dev/null @@ -1,85 +0,0 @@ - - - - -