mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-15 04:10:40 -07:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b7c782b10a | ||
|
|
49d3f64873 | ||
|
|
be3463c5f9 | ||
|
|
fde9924ee6 | ||
|
|
5b2ea63b14 | ||
|
|
23279a816a | ||
|
|
2c14a9541d | ||
|
|
c474649748 | ||
|
|
fad17cfbb3 | ||
|
|
6322acb88c | ||
|
|
95fc705b5d | ||
|
|
6801552fe6 | ||
|
|
6023d9ba10 | ||
|
|
cc4628d804 | ||
|
|
69286c6909 | ||
|
|
6c114267a5 | ||
|
|
e2ef236f68 | ||
|
|
80c2280ee6 | ||
|
|
44f6b520d5 | ||
|
|
3d71d9e35a | ||
|
|
124f4c4485 | ||
|
|
432d1c7ccb | ||
|
|
4b42e63601 | ||
|
|
f809c716eb | ||
|
|
aebeae9e1b | ||
|
|
564972ba74 | ||
|
|
d0c3cc8b47 | ||
|
|
b5b2a98d5e | ||
|
|
8894cbfe6e | ||
|
|
c58a116513 | ||
|
|
d4df3a0b53 | ||
|
|
9cfa43b8ae | ||
|
|
df6d62fd59 | ||
|
|
2438f4b018 | ||
|
|
8321a8e982 | ||
|
|
1de6adf308 | ||
|
|
a525f45b46 | ||
|
|
529e6d769b | ||
|
|
822ba0be0f | ||
|
|
a3455ebd0b | ||
|
|
24a19c092a | ||
|
|
fd5ef474c3 | ||
|
|
4f6b88c154 | ||
|
|
6dc7fada72 | ||
|
|
3b9c7d6fbe | ||
|
|
92bfc65e0b | ||
|
|
8348036d45 | ||
|
|
afeef1d745 | ||
|
|
3b5eb6664f | ||
|
|
68c4cfcfb6 | ||
|
|
dd325362f9 | ||
|
|
b9ae479b65 | ||
|
|
0cb520d2d1 | ||
|
|
1689576913 | ||
|
|
aea34418de | ||
|
|
4358c9630f | ||
|
|
9a96b4aba3 | ||
|
|
70fdb7af48 | ||
|
|
5099597634 | ||
|
|
d742de79ba | ||
|
|
f0e2e07f0b | ||
|
|
4e5dbe120d | ||
|
|
6a1db537d2 | ||
|
|
9517f82caf | ||
|
|
10e8c8ff7e | ||
|
|
fb787e8847 | ||
|
|
9012133e07 | ||
|
|
abaf4af465 | ||
|
|
8273c17dab | ||
|
|
24f5346084 | ||
|
|
6b9f872bcc | ||
|
|
91c721e650 | ||
|
|
500d397a5a | ||
|
|
2e004eddf6 | ||
|
|
e3bfe86181 | ||
|
|
804947ebb9 | ||
|
|
4fa5313acc | ||
|
|
f7313fe563 | ||
|
|
1c64ff051e | ||
|
|
c470d1fe9b | ||
|
|
cdceb25d00 | ||
|
|
cc9b28307c | ||
|
|
f2ddd6e459 | ||
|
|
ecc40a6012 | ||
|
|
659cfde8e1 | ||
|
|
0acfb8de4d | ||
|
|
c4b2bfb29b | ||
|
|
0d41f7467e | ||
|
|
1d35e3fcfb | ||
|
|
04c874b174 | ||
|
|
29f42847a5 | ||
|
|
426863a9b4 | ||
|
|
8f9639f1d6 | ||
|
|
3e130e01a7 | ||
|
|
3e3d84a5ed | ||
|
|
69f1a394b1 | ||
|
|
ae8636d95d | ||
|
|
1fd76acf28 | ||
|
|
62f8f707e9 | ||
|
|
9c7cb5752b | ||
|
|
4e394b9072 | ||
|
|
251a50801c | ||
|
|
aa5d63fdf7 | ||
|
|
65487654c4 | ||
|
|
8bab7957da | ||
|
|
666df5a8e6 | ||
|
|
a4aa9ba0d6 | ||
|
|
f5f54c82bf | ||
|
|
28f154554b | ||
|
|
2bc03d6a01 | ||
|
|
354a971b9e | ||
|
|
b41be92dfd | ||
|
|
bad12ea936 | ||
|
|
b5a22fa091 | ||
|
|
7d92f25cbb | ||
|
|
4584867b65 | ||
|
|
695e3c18bc | ||
|
|
2133ed20d7 | ||
|
|
dbc23e8b04 | ||
|
|
1acace5a16 | ||
|
|
9a9b792c63 | ||
|
|
99d14e76d7 | ||
|
|
aff9976042 | ||
|
|
cd8cb39329 | ||
|
|
9ed3b98db3 | ||
|
|
151ff4cbf3 | ||
|
|
2e66e8b02e | ||
|
|
24306722ec | ||
|
|
2f059f6a25 | ||
|
|
4e82da689e | ||
|
|
e37824fd8a | ||
|
|
81e11bb9c4 | ||
|
|
71d5d24813 | ||
|
|
20f559e545 | ||
|
|
dce75a1a22 | ||
|
|
93ec151374 | ||
|
|
29db1bb0e2 | ||
|
|
f42c217fc0 | ||
|
|
ec4a711e00 | ||
|
|
03893d585e | ||
|
|
3b97c38ee5 | ||
|
|
48a876db49 | ||
|
|
befc33c4eb | ||
|
|
8734e2e6ce | ||
|
|
18055c8855 | ||
|
|
6a7c280f04 | ||
|
|
bc87e19e3e | ||
|
|
75591cdbfc | ||
|
|
5901611af5 | ||
|
|
9c40da7369 |
@@ -342,6 +342,123 @@
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "JasonEtco",
|
||||
"name": "Jason Etcovitch",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/10660468?v=4",
|
||||
"profile": "https://jasonet.co",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "kayuapi",
|
||||
"name": "ZC",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/10304328?v=4",
|
||||
"profile": "https://github.com/kayuapi",
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "mems",
|
||||
"name": "Memmie Lenglet",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/729275?v=4",
|
||||
"profile": "https://memmie.lenglet.name",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "ilhamdev0",
|
||||
"name": "ilhamdev0",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/57636145?v=4",
|
||||
"profile": "https://github.com/ilhamdev0",
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "c412216887",
|
||||
"name": "一饮一啄皆是人生",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/29691650?v=4",
|
||||
"profile": "https://github.com/c412216887",
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "labnol",
|
||||
"name": "Amit Agarwal",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/1344071?v=4",
|
||||
"profile": "https://digitalinspiration.com/",
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "n1ru4l",
|
||||
"name": "Laurin Quast",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/14338007?v=4",
|
||||
"profile": "https://n1ru4l.cloud/",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "mattvague",
|
||||
"name": "Matt Vague",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/64985?v=4",
|
||||
"profile": "https://github.com/mattvague",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "bglw",
|
||||
"name": "Liam Bigelow",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/40188355?v=4",
|
||||
"profile": "https://github.com/bglw",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "JaKXz",
|
||||
"name": "Jason Kurian",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/2642545?v=4",
|
||||
"profile": "https://about.me/jasonkurian",
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "dphm",
|
||||
"name": "d pham (they/them)",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/1707217?v=4",
|
||||
"profile": "https://github.com/dphm",
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "AleksandrHovhannisyan",
|
||||
"name": "Aleksandr Hovhannisyan",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/19352442?v=4",
|
||||
"profile": "https://www.aleksandrhovhannisyan.com/",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "jg-rp",
|
||||
"name": "jg-rp",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/72664870?v=4",
|
||||
"profile": "https://github.com/jg-rp",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
}
|
||||
],
|
||||
"contributorsPerLine": 7,
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
name: Check
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
release:
|
||||
name: Check
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14'
|
||||
- name: Build
|
||||
run: |
|
||||
npm ci
|
||||
npm run build
|
||||
- name: Test
|
||||
run: |
|
||||
npm run lint
|
||||
npm run test
|
||||
- name: Coverage
|
||||
uses: coverallsapp/[email protected]
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Performance
|
||||
run: |
|
||||
npm run perf:diff
|
||||
@@ -0,0 +1,37 @@
|
||||
name: Release
|
||||
on: workflow_dispatch
|
||||
jobs:
|
||||
release:
|
||||
name: Release
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14'
|
||||
- name: Build
|
||||
run: |
|
||||
npm ci
|
||||
npm run build
|
||||
- name: Test
|
||||
run: |
|
||||
npm run lint
|
||||
npm run test
|
||||
- name: Coverage
|
||||
uses: coverallsapp/[email protected]
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
run: npx semantic-release
|
||||
- name: Publish Docs
|
||||
uses: JamesIves/[email protected]
|
||||
with:
|
||||
branch: gh-pages
|
||||
folder: docs/public
|
||||
@@ -0,0 +1,4 @@
|
||||
module.exports = {
|
||||
require: "ts-node/register/transpile-only",
|
||||
reporter: "spec"
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"exclude": ["dist", "test"],
|
||||
"reporter": ["html", "lcov"]
|
||||
}
|
||||
-28
@@ -1,28 +0,0 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "10"
|
||||
- "8"
|
||||
jobs:
|
||||
include:
|
||||
- stage: test
|
||||
name: 'Linting'
|
||||
script:
|
||||
- npm run lint
|
||||
- name: 'Coverage'
|
||||
script: npm run coverage-coveralls
|
||||
- stage: release
|
||||
name: 'Publish'
|
||||
if: branch = master
|
||||
script: npm run build
|
||||
deploy:
|
||||
provider: script
|
||||
skip_cleanup: true
|
||||
script: npx semantic-release
|
||||
- name: 'Document'
|
||||
if: branch = master
|
||||
script: npm run build-docs
|
||||
deploy:
|
||||
skip_cleanup: true
|
||||
provider: pages
|
||||
github_token: $GH_TOKEN
|
||||
local_dir: docs/public
|
||||
+230
@@ -1,3 +1,233 @@
|
||||
# [9.31.0](https://github.com/harttle/liquidjs/compare/v9.30.0...v9.31.0) (2021-12-19)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* implement `liquid` and `echo` tags, see [#428](https://github.com/harttle/liquidjs/issues/428) ([fde9924](https://github.com/harttle/liquidjs/commit/fde9924ee622efae4c013d2aa01c6d705c8d5f46))
|
||||
|
||||
# [9.30.0](https://github.com/harttle/liquidjs/compare/v9.29.0...v9.30.0) (2021-12-18)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* support jekyll-like include, see [#433](https://github.com/harttle/liquidjs/issues/433) ([23279a8](https://github.com/harttle/liquidjs/commit/23279a816a0582ade7f3b15c1c65c74bc147d134))
|
||||
|
||||
# [9.29.0](https://github.com/harttle/liquidjs/compare/v9.28.6...v9.29.0) (2021-12-11)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* customize globals & strictVariables when calling render, see [#432](https://github.com/harttle/liquidjs/issues/432) ([6801552](https://github.com/harttle/liquidjs/commit/6801552fe6829770cbbfdda051731c8b466ed9ec))
|
||||
|
||||
## [9.28.6](https://github.com/harttle/liquidjs/compare/v9.28.5...v9.28.6) (2021-12-07)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* size filter does not respect Objects, fixes [#385](https://github.com/harttle/liquidjs/issues/385) ([6c11426](https://github.com/harttle/liquidjs/commit/6c114267a526ef764dfd9bd94de199d2932ad91a))
|
||||
* throws when using `preserveTimezones` on Node.js, fixes [#431](https://github.com/harttle/liquidjs/issues/431) ([e2ef236](https://github.com/harttle/liquidjs/commit/e2ef236f68273b72a0b1293b0d13728cdb9aa4b8))
|
||||
|
||||
## [9.28.5](https://github.com/harttle/liquidjs/compare/v9.28.4...v9.28.5) (2021-11-05)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* always allow './' and '../' to be relative, even on windows ([44f6b52](https://github.com/harttle/liquidjs/commit/44f6b520d53ba984ecb5fc430d70f698837d1802))
|
||||
|
||||
## [9.28.4](https://github.com/harttle/liquidjs/compare/v9.28.3...v9.28.4) (2021-10-31)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* allow `{%render%}` to reassign argument, [#404](https://github.com/harttle/liquidjs/issues/404) ([124f4c4](https://github.com/harttle/liquidjs/commit/124f4c4485270a5fdfca610808a56ecd98d98417))
|
||||
|
||||
## [9.28.3](https://github.com/harttle/liquidjs/compare/v9.28.2...v9.28.3) (2021-10-27)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* relative root (by default) yields LookupError, fixes [#419](https://github.com/harttle/liquidjs/issues/419), [#424](https://github.com/harttle/liquidjs/issues/424), also related to [#395](https://github.com/harttle/liquidjs/issues/395) ([aebeae9](https://github.com/harttle/liquidjs/commit/aebeae9e1bbb8472af7788dfd09a08cb6de58e1c))
|
||||
|
||||
## [9.28.2](https://github.com/harttle/liquidjs/compare/v9.28.1...v9.28.2) (2021-10-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* cache ongoing parseFile() calls, fixes [#416](https://github.com/harttle/liquidjs/issues/416) ([8894cbf](https://github.com/harttle/liquidjs/commit/8894cbfe6e0dbad4c07439adcefb6b3e2056be11))
|
||||
|
||||
## [9.28.1](https://github.com/harttle/liquidjs/compare/v9.28.0...v9.28.1) (2021-10-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* hardcoded '/' in normalized `options.fs`, fixes [#412](https://github.com/harttle/liquidjs/issues/412), [#408](https://github.com/harttle/liquidjs/issues/408) ([9cfa43b](https://github.com/harttle/liquidjs/commit/9cfa43b8aee6a980f39d99f1cdb2be730ca21731))
|
||||
|
||||
# [9.28.0](https://github.com/harttle/liquidjs/compare/v9.27.1...v9.28.0) (2021-10-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* skip root check for renderFile() ([822ba0b](https://github.com/harttle/liquidjs/commit/822ba0be0f1cfbedd50376aff8ac49eee71bd48c))
|
||||
* support timezoneOffset for date from scope, [#401](https://github.com/harttle/liquidjs/issues/401) ([fd5ef47](https://github.com/harttle/liquidjs/commit/fd5ef474c36212e6a2446012dcd26bca93f84c7b))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* `relativeReference` for render/include/layout, [#395](https://github.com/harttle/liquidjs/issues/395) ([a3455eb](https://github.com/harttle/liquidjs/commit/a3455ebd0b207141c34630c0af44d917db2ca1dd))
|
||||
* implement `forloop.name` as found in ruby shopify/liquid ([6dc7fad](https://github.com/harttle/liquidjs/commit/6dc7fada72467418806c1ee4bd7eaf3003690fe6))
|
||||
|
||||
## [9.27.1](https://github.com/harttle/liquidjs/compare/v9.27.0...v9.27.1) (2021-10-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* directory info in lookupError message, [#395](https://github.com/harttle/liquidjs/issues/395) ([92bfc65](https://github.com/harttle/liquidjs/commit/92bfc65e0b1d937c00a8368b272223c702132d23))
|
||||
|
||||
# [9.27.0](https://github.com/harttle/liquidjs/compare/v9.26.0...v9.27.0) (2021-10-03)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* remove "stream" dependency in browser bundles, [#396](https://github.com/harttle/liquidjs/issues/396) ([3b5eb66](https://github.com/harttle/liquidjs/commit/3b5eb6664f673c29d74cb7645e01dcbdf43c8343))
|
||||
* renderToNodeStream() now emit 'error' event instead of throw ([afeef1d](https://github.com/harttle/liquidjs/commit/afeef1d7450b2799b3441b0241d2466b892a27ff))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add `layouts`, `partials` apart from `root`, [#395](https://github.com/harttle/liquidjs/issues/395) ([b9ae479](https://github.com/harttle/liquidjs/commit/b9ae479b653a34fadb98c324c4683dd1fdd31af1))
|
||||
* renderFileToNodeStream(filepath, scope) ([68c4cfc](https://github.com/harttle/liquidjs/commit/68c4cfcfb647c22225dd6edede53ad7a5d7c4485))
|
||||
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* make the most of streamed rendering ([aea3441](https://github.com/harttle/liquidjs/commit/aea34418de24cb85ea1acddf68c3683ce7fc9fa8))
|
||||
|
||||
# [9.26.0](https://github.com/harttle/liquidjs/compare/v9.25.1...v9.26.0) (2021-09-30)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* orderedFilterParameters, closes [#312](https://github.com/harttle/liquidjs/issues/312) ([10e8c8f](https://github.com/harttle/liquidjs/commit/10e8c8ff7e1cca6df43087953cd8daf4bd618563))
|
||||
* stream rendering, closed [#361](https://github.com/harttle/liquidjs/issues/361) fixes [#360](https://github.com/harttle/liquidjs/issues/360) ([9012133](https://github.com/harttle/liquidjs/commit/9012133e0717b1813c6a74a6a282f43ba14d0ada))
|
||||
* timezoneOffset option to specify output timezone, see [#375](https://github.com/harttle/liquidjs/issues/375) ([6b9f872](https://github.com/harttle/liquidjs/commit/6b9f872bccb4b0c636dc7be2088cafa9bc6c900a))
|
||||
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* improve performance by 4x by simplified parseFile ([24f5346](https://github.com/harttle/liquidjs/commit/24f534608489fccc155f30bbaf37397c46278da6))
|
||||
* parse filenames in parse() insteadof render() ([8273c17](https://github.com/harttle/liquidjs/commit/8273c17dab3dc09858330ce45e3617a650e7fcaa))
|
||||
|
||||
## [9.25.1](https://github.com/harttle/liquidjs/compare/v9.25.0...v9.25.1) (2021-06-20)
|
||||
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* add cross-engines benchmark ([cdceb25](https://github.com/harttle/liquidjs/commit/cdceb25d007b3d30a85e51ac538e12297c73bfcf))
|
||||
|
||||
# [9.25.0](https://github.com/harttle/liquidjs/compare/v9.24.2...v9.25.0) (2021-05-07)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* when tag with multiple values ([8f9639f](https://github.com/harttle/liquidjs/commit/8f9639f))
|
||||
|
||||
## [9.24.2](https://github.com/harttle/liquidjs/compare/v9.24.1...v9.24.2) (2021-05-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* operator boundary not correctly recognized, fixes [#342](https://github.com/harttle/liquidjs/issues/342) ([3e3d84a](https://github.com/harttle/liquidjs/commit/3e3d84a))
|
||||
|
||||
## [9.24.1](https://github.com/harttle/liquidjs/compare/v9.24.0...v9.24.1) (2021-05-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* make LiquidError context property public ([1fd76ac](https://github.com/harttle/liquidjs/commit/1fd76ac))
|
||||
|
||||
# [9.24.0](https://github.com/harttle/liquidjs/compare/v9.23.4...v9.24.0) (2021-05-01)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add context as a property on the LiquidError error ([9c7cb57](https://github.com/harttle/liquidjs/commit/9c7cb57))
|
||||
* export errors for better error handling in user-land ([4e394b9](https://github.com/harttle/liquidjs/commit/4e394b9))
|
||||
|
||||
## [9.23.4](https://github.com/harttle/liquidjs/compare/v9.23.3...v9.23.4) (2021-04-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* capitalize filter not lower case trailing string, fixes [#326](https://github.com/harttle/liquidjs/issues/326) ([6548765](https://github.com/harttle/liquidjs/commit/6548765))
|
||||
|
||||
## [9.23.3](https://github.com/harttle/liquidjs/compare/v9.23.2...v9.23.3) (2021-03-21)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* expose TokenKind ([dbc23e8](https://github.com/harttle/liquidjs/commit/dbc23e8))
|
||||
|
||||
## [9.23.2](https://github.com/harttle/liquidjs/compare/v9.23.1...v9.23.2) (2021-03-13)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* comparison for empty/nil, fixes [#321](https://github.com/harttle/liquidjs/issues/321) ([99d14e7](https://github.com/harttle/liquidjs/commit/99d14e7))
|
||||
* newline_to_br filter should output <br /> instead of <br/>, fixes [#320](https://github.com/harttle/liquidjs/issues/320) ([9a9b792](https://github.com/harttle/liquidjs/commit/9a9b792))
|
||||
|
||||
## [9.23.1](https://github.com/harttle/liquidjs/compare/v9.23.0...v9.23.1) (2021-02-19)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* lenientIf not working for the umd bundle, closes [#313](https://github.com/harttle/liquidjs/issues/313) ([2e66e8b](https://github.com/harttle/liquidjs/commit/2e66e8b))
|
||||
|
||||
# [9.23.0](https://github.com/harttle/liquidjs/compare/v9.22.1...v9.23.0) (2021-02-12)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* respect `fs` in parser options, for [#233](https://github.com/harttle/liquidjs/issues/233) ([4e82da6](https://github.com/harttle/liquidjs/commit/4e82da6))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* support filters in if/unless/case, see [#287](https://github.com/harttle/liquidjs/issues/287) ([2f059f6](https://github.com/harttle/liquidjs/commit/2f059f6))
|
||||
* support function calls, closes [#222](https://github.com/harttle/liquidjs/issues/222) ([e37824f](https://github.com/harttle/liquidjs/commit/e37824f))
|
||||
* support layout none, closes [#299](https://github.com/harttle/liquidjs/issues/299) ([81e11bb](https://github.com/harttle/liquidjs/commit/81e11bb))
|
||||
|
||||
## [9.22.1](https://github.com/harttle/liquidjs/compare/v9.22.0...v9.22.1) (2021-02-05)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* default to precedence 1 for custom operators ([20f559e](https://github.com/harttle/liquidjs/commit/20f559e))
|
||||
|
||||
# [9.22.0](https://github.com/harttle/liquidjs/compare/v9.21.0...v9.22.0) (2021-02-04)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* compact filter ([f42c217](https://github.com/harttle/liquidjs/commit/f42c217))
|
||||
|
||||
# [9.21.0](https://github.com/harttle/liquidjs/compare/v9.20.1...v9.21.0) (2021-02-04)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add `operators` option for custom operators ([75591cd](https://github.com/harttle/liquidjs/commit/75591cd))
|
||||
* create trie programmatically in options ([befc33c](https://github.com/harttle/liquidjs/commit/befc33c))
|
||||
* export OperatorMap type ([bc87e19](https://github.com/harttle/liquidjs/commit/bc87e19))
|
||||
* export Operators from operator.ts ([6a7c280](https://github.com/harttle/liquidjs/commit/6a7c280))
|
||||
* rename to defaultOperators and Operators ([8734e2e](https://github.com/harttle/liquidjs/commit/8734e2e))
|
||||
|
||||
## [9.20.1](https://github.com/harttle/liquidjs/compare/v9.20.0...v9.20.1) (2021-01-24)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* allow string literals contain delimiters, fixes [#288](https://github.com/harttle/liquidjs/issues/288) ([9c40da7](https://github.com/harttle/liquidjs/commit/9c40da7))
|
||||
|
||||
# [9.20.0](https://github.com/harttle/liquidjs/compare/v9.19.0...v9.20.0) (2021-01-23)
|
||||
|
||||
|
||||
|
||||
@@ -1,18 +1,12 @@
|
||||
# liquidjs
|
||||
[](https://www.npmjs.org/package/liquidjs)
|
||||
[](https://www.npmjs.org/package/liquidjs)
|
||||
[](https://coveralls.io/github/harttle/liquidjs?branch=master)
|
||||
[](https://travis-ci.org/harttle/liquidjs)
|
||||
[](https://github.com/harttle/liquidjs/issues)
|
||||
[](https://github.com/harttle/liquidjs/graphs/contributors)
|
||||
[](https://opencollective.com/liquidjs)
|
||||
[](https://david-dm.org/harttle/liquidjs)
|
||||
[](https://david-dm.org/harttle/liquidjs?type=dev)
|
||||
[](https://github.com/harttle/liquidjs/blob/master/LICENSE)
|
||||
[](https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#commits)
|
||||
[](https://github.com/harttle/liquidjs)
|
||||
[](https://www.npmjs.org/package/liquidjs)
|
||||
[](https://www.npmjs.org/package/liquidjs)
|
||||
[](https://coveralls.io/github/harttle/liquidjs?branch=master)
|
||||
[](https://github.com/harttle/liquidjs/actions/workflows/check.yml?query=branch%3Amaster)
|
||||
[](https://github.com/harttle/liquidjs/blob/master/LICENSE)
|
||||
[](https://github.com/harttle/liquidjs)
|
||||
|
||||
A simple, expressive, safe and [Shopify][shopify/liquid] compatible template engine in pure JavaScript.
|
||||
A simple, expressive and safe [Shopify][shopify/liquid] / Github Pages compatible template engine in pure JavaScript.
|
||||
**The purpose of this repo** is to provide a standard Liquid implementation for the JavaScript community so that [Jekyll sites](https://jekyllrb.com), [Github Pages](https://pages.github.com/) and [Shopify templates](https://themes.shopify.com/) can be ported to Node.js without pain.
|
||||
|
||||
* [Documentation][doc]
|
||||
@@ -59,57 +53,73 @@ Want to contribute? see [Contribution Guidelines][contribution]. Thanks goes to
|
||||
<!-- markdownlint-disable -->
|
||||
<table>
|
||||
<tr>
|
||||
<td align="center"><a href="https://harttle.land"><img src="https://avatars3.githubusercontent.com/u/4427974?v=4" width="100px;" alt=""/><br /><sub><b>Jun Yang</b></sub></a><br /><a href="#maintenance-harttle" title="Maintenance">🚧</a> <a href="https://github.com/harttle/liquidjs/commits?author=harttle" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/chenos"><img src="https://avatars0.githubusercontent.com/u/2993310?v=4" width="100px;" alt=""/><br /><sub><b>chenos</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=chenos" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://zachleat.com/"><img src="https://avatars2.githubusercontent.com/u/39355?v=4" width="100px;" alt=""/><br /><sub><b>Zach Leatherman</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/issues?q=author%3Azachleat" title="Bug reports">🐛</a></td>
|
||||
<td align="center"><a href="https://github.com/thardy"><img src="https://avatars3.githubusercontent.com/u/120636?v=4" width="100px;" alt=""/><br /><sub><b>Tim Hardy</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=thardy" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://paulrobertlloyd.com/"><img src="https://avatars3.githubusercontent.com/u/813383?v=4" width="100px;" alt=""/><br /><sub><b>Paul Robert Lloyd</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=paulrobertlloyd" title="Code">💻</a> <a href="https://github.com/harttle/liquidjs/issues?q=author%3Apaulrobertlloyd" title="Bug reports">🐛</a></td>
|
||||
<td align="center"><a href="https://twitter.com/alecdotbiz"><img src="https://avatars2.githubusercontent.com/u/1925840?v=4" width="100px;" alt=""/><br /><sub><b>Alec Larson</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=aleclarson" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/pmalouin"><img src="https://avatars1.githubusercontent.com/u/1411117?v=4" width="100px;" alt=""/><br /><sub><b>Patrick Malouin</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=pmalouin" title="Code">💻</a> <a href="https://github.com/harttle/liquidjs/commits?author=pmalouin" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="https://harttle.land"><img src="https://avatars3.githubusercontent.com/u/4427974?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jun Yang</b></sub></a><br /><a href="#maintenance-harttle" title="Maintenance">🚧</a> <a href="https://github.com/harttle/liquidjs/commits?author=harttle" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/chenos"><img src="https://avatars0.githubusercontent.com/u/2993310?v=4?s=100" width="100px;" alt=""/><br /><sub><b>chenos</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=chenos" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://zachleat.com/"><img src="https://avatars2.githubusercontent.com/u/39355?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Zach Leatherman</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/issues?q=author%3Azachleat" title="Bug reports">🐛</a></td>
|
||||
<td align="center"><a href="https://github.com/thardy"><img src="https://avatars3.githubusercontent.com/u/120636?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Tim Hardy</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=thardy" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://paulrobertlloyd.com/"><img src="https://avatars3.githubusercontent.com/u/813383?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Paul Robert Lloyd</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=paulrobertlloyd" title="Code">💻</a> <a href="https://github.com/harttle/liquidjs/issues?q=author%3Apaulrobertlloyd" title="Bug reports">🐛</a></td>
|
||||
<td align="center"><a href="https://twitter.com/alecdotbiz"><img src="https://avatars2.githubusercontent.com/u/1925840?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Alec Larson</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=aleclarson" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/pmalouin"><img src="https://avatars1.githubusercontent.com/u/1411117?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Patrick Malouin</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=pmalouin" title="Code">💻</a> <a href="https://github.com/harttle/liquidjs/commits?author=pmalouin" title="Documentation">📖</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><a href="https://jaswrks.com"><img src="https://avatars3.githubusercontent.com/u/1563559?v=4" width="100px;" alt=""/><br /><sub><b>jaswrks</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=jaswrks" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://oott123.com"><img src="https://avatars2.githubusercontent.com/u/905663?v=4" width="100px;" alt=""/><br /><sub><b>三三</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=oott123" title="Code">💻</a> <a href="#ideas-oott123" title="Ideas, Planning, & Feedback">🤔</a></td>
|
||||
<td align="center"><a href="https://github.com/ssendev"><img src="https://avatars0.githubusercontent.com/u/450793?v=4" width="100px;" alt=""/><br /><sub><b>ssendev</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=ssendev" title="Code">💻</a> <a href="https://github.com/harttle/liquidjs/commits?author=ssendev" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="https://github.com/wojtask9"><img src="https://avatars3.githubusercontent.com/u/6099236?v=4" width="100px;" alt=""/><br /><sub><b>wojtask9</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=wojtask9" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/thelornenelson"><img src="https://avatars3.githubusercontent.com/u/24596583?v=4" width="100px;" alt=""/><br /><sub><b>Andrew Barclay</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=thelornenelson" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://www.stam.pr/"><img src="https://avatars2.githubusercontent.com/u/142338?v=4" width="100px;" alt=""/><br /><sub><b>Cory Mawhorter</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=cmawhorter" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/thehappybug"><img src="https://avatars0.githubusercontent.com/u/3393530?v=4" width="100px;" alt=""/><br /><sub><b>Mehdi Jaffery</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=thehappybug" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://jaswrks.com"><img src="https://avatars3.githubusercontent.com/u/1563559?v=4?s=100" width="100px;" alt=""/><br /><sub><b>jaswrks</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=jaswrks" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://oott123.com"><img src="https://avatars2.githubusercontent.com/u/905663?v=4?s=100" width="100px;" alt=""/><br /><sub><b>三三</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=oott123" title="Code">💻</a> <a href="#ideas-oott123" title="Ideas, Planning, & Feedback">🤔</a></td>
|
||||
<td align="center"><a href="https://github.com/ssendev"><img src="https://avatars0.githubusercontent.com/u/450793?v=4?s=100" width="100px;" alt=""/><br /><sub><b>ssendev</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=ssendev" title="Code">💻</a> <a href="https://github.com/harttle/liquidjs/commits?author=ssendev" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="https://github.com/wojtask9"><img src="https://avatars3.githubusercontent.com/u/6099236?v=4?s=100" width="100px;" alt=""/><br /><sub><b>wojtask9</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=wojtask9" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/thelornenelson"><img src="https://avatars3.githubusercontent.com/u/24596583?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Andrew Barclay</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=thelornenelson" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://www.stam.pr/"><img src="https://avatars2.githubusercontent.com/u/142338?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Cory Mawhorter</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=cmawhorter" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/thehappybug"><img src="https://avatars0.githubusercontent.com/u/3393530?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Mehdi Jaffery</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=thehappybug" title="Code">💻</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><a href="https://github.com/robinbijlani"><img src="https://avatars0.githubusercontent.com/u/2503108?v=4" width="100px;" alt=""/><br /><sub><b>Robin Bijlani</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=robinbijlani" title="Code">💻</a> <a href="https://github.com/harttle/liquidjs/issues?q=author%3Arobinbijlani" title="Bug reports">🐛</a></td>
|
||||
<td align="center"><a href="https://www.rmkennedy.com"><img src="https://avatars3.githubusercontent.com/u/8356669?v=4" width="100px;" alt=""/><br /><sub><b>Ryan Kennedy</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=ryaninvents" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/strax"><img src="https://avatars2.githubusercontent.com/u/587213?v=4" width="100px;" alt=""/><br /><sub><b>Sami Kukkonen</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=strax" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://ScottFreeCode.github.io/"><img src="https://avatars3.githubusercontent.com/u/16506071?v=4" width="100px;" alt=""/><br /><sub><b>Scott Santucci</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=ScottFreeCode" title="Code">💻</a></td>
|
||||
<td align="center"><a href="http://stevenrescigno.com"><img src="https://avatars3.githubusercontent.com/u/8505293?v=4" width="100px;" alt=""/><br /><sub><b>Steven </b></sub></a><br /><a href="#example-stevenanthonyrevo" title="Examples">💡</a> <a href="https://github.com/harttle/liquidjs/commits?author=stevenanthonyrevo" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://efcl.info/"><img src="https://avatars1.githubusercontent.com/u/19714?v=4" width="100px;" alt=""/><br /><sub><b>azu</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=azu" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="https://github.com/wyozi"><img src="https://avatars3.githubusercontent.com/u/4894573?v=4" width="100px;" alt=""/><br /><sub><b>Joonas</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=wyozi" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/robinbijlani"><img src="https://avatars0.githubusercontent.com/u/2503108?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Robin Bijlani</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=robinbijlani" title="Code">💻</a> <a href="https://github.com/harttle/liquidjs/issues?q=author%3Arobinbijlani" title="Bug reports">🐛</a></td>
|
||||
<td align="center"><a href="https://www.rmkennedy.com"><img src="https://avatars3.githubusercontent.com/u/8356669?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ryan Kennedy</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=ryaninvents" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/strax"><img src="https://avatars2.githubusercontent.com/u/587213?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Sami Kukkonen</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=strax" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://ScottFreeCode.github.io/"><img src="https://avatars3.githubusercontent.com/u/16506071?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Scott Santucci</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=ScottFreeCode" title="Code">💻</a></td>
|
||||
<td align="center"><a href="http://stevenrescigno.com"><img src="https://avatars3.githubusercontent.com/u/8505293?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Steven </b></sub></a><br /><a href="#example-stevenanthonyrevo" title="Examples">💡</a> <a href="https://github.com/harttle/liquidjs/commits?author=stevenanthonyrevo" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://efcl.info/"><img src="https://avatars1.githubusercontent.com/u/19714?v=4?s=100" width="100px;" alt=""/><br /><sub><b>azu</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=azu" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="https://github.com/wyozi"><img src="https://avatars3.githubusercontent.com/u/4894573?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Joonas</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=wyozi" title="Code">💻</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><a href="https://github.com/jamelait"><img src="https://avatars1.githubusercontent.com/u/14369255?v=4" width="100px;" alt=""/><br /><sub><b>Jamel A.</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=jamelait" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://brandonpittman.net"><img src="https://avatars0.githubusercontent.com/u/967145?v=4" width="100px;" alt=""/><br /><sub><b>Brandon Pittman</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=brandonpittman" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/tgrandgent"><img src="https://avatars3.githubusercontent.com/u/17069042?v=4" width="100px;" alt=""/><br /><sub><b>tgrandgent</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=tgrandgent" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/mastodon0"><img src="https://avatars1.githubusercontent.com/u/7924332?v=4" width="100px;" alt=""/><br /><sub><b>Martin Schuster</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=mastodon0" title="Code">💻</a></td>
|
||||
<td align="center"><a href="http://js.chenlei.me"><img src="https://avatars0.githubusercontent.com/u/6339390?v=4" width="100px;" alt=""/><br /><sub><b>Ray</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=richardo2016" title="Tests">⚠️</a> <a href="https://github.com/harttle/liquidjs/commits?author=richardo2016" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/CriGoT"><img src="https://avatars0.githubusercontent.com/u/1936786?v=4" width="100px;" alt=""/><br /><sub><b>Cristofer Gonzales</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=CriGoT" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://www.raymondcamden.com"><img src="https://avatars3.githubusercontent.com/u/393660?v=4" width="100px;" alt=""/><br /><sub><b>Raymond Camden</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=cfjedimaster" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="https://github.com/jamelait"><img src="https://avatars1.githubusercontent.com/u/14369255?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jamel A.</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=jamelait" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://brandonpittman.net"><img src="https://avatars0.githubusercontent.com/u/967145?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Brandon Pittman</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=brandonpittman" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/tgrandgent"><img src="https://avatars3.githubusercontent.com/u/17069042?v=4?s=100" width="100px;" alt=""/><br /><sub><b>tgrandgent</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=tgrandgent" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/mastodon0"><img src="https://avatars1.githubusercontent.com/u/7924332?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Martin Schuster</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=mastodon0" title="Code">💻</a></td>
|
||||
<td align="center"><a href="http://js.chenlei.me"><img src="https://avatars0.githubusercontent.com/u/6339390?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ray</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=richardo2016" title="Tests">⚠️</a> <a href="https://github.com/harttle/liquidjs/commits?author=richardo2016" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/CriGoT"><img src="https://avatars0.githubusercontent.com/u/1936786?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Cristofer Gonzales</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=CriGoT" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://www.raymondcamden.com"><img src="https://avatars3.githubusercontent.com/u/393660?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Raymond Camden</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=cfjedimaster" title="Documentation">📖</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><a href="https://stedman.dev"><img src="https://avatars1.githubusercontent.com/u/183122?v=4" width="100px;" alt=""/><br /><sub><b>Steve Stedman</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=stedman" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="https://ciccarello.me"><img src="https://avatars0.githubusercontent.com/u/11273838?v=4" width="100px;" alt=""/><br /><sub><b>Anthony Ciccarello</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=aciccarello" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="https://twitter.com/IAmTrySound"><img src="https://avatars0.githubusercontent.com/u/5635476?v=4" width="100px;" alt=""/><br /><sub><b>Bogdan Chadkin</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=TrySound" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://hightouch.io"><img src="https://avatars0.githubusercontent.com/u/5959235?v=4" width="100px;" alt=""/><br /><sub><b>Tejas Manohar</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=tejasmanohar" title="Code">💻</a></td>
|
||||
<td align="center"><a href="http://about.me/peterdehaan"><img src="https://avatars2.githubusercontent.com/u/557895?v=4" width="100px;" alt=""/><br /><sub><b>Peter deHaan</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=pdehaan" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="https://github.com/amit777"><img src="https://avatars0.githubusercontent.com/u/2703309?v=4" width="100px;" alt=""/><br /><sub><b>amit777</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=amit777" title="Code">💻</a> <a href="#financial-amit777" title="Financial">💵</a></td>
|
||||
<td align="center"><a href="http://www.ifi.uzh.ch/en/ce/people/schuldenzucker.html"><img src="https://avatars3.githubusercontent.com/u/1100776?v=4" width="100px;" alt=""/><br /><sub><b>Steffen Schuldenzucker</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=sschuldenzucker" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://stedman.dev"><img src="https://avatars1.githubusercontent.com/u/183122?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Steve Stedman</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=stedman" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="https://ciccarello.me"><img src="https://avatars0.githubusercontent.com/u/11273838?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Anthony Ciccarello</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=aciccarello" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="https://twitter.com/IAmTrySound"><img src="https://avatars0.githubusercontent.com/u/5635476?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Bogdan Chadkin</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=TrySound" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://hightouch.io"><img src="https://avatars0.githubusercontent.com/u/5959235?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Tejas Manohar</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=tejasmanohar" title="Code">💻</a></td>
|
||||
<td align="center"><a href="http://about.me/peterdehaan"><img src="https://avatars2.githubusercontent.com/u/557895?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Peter deHaan</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=pdehaan" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="https://github.com/amit777"><img src="https://avatars0.githubusercontent.com/u/2703309?v=4?s=100" width="100px;" alt=""/><br /><sub><b>amit777</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=amit777" title="Code">💻</a> <a href="#financial-amit777" title="Financial">💵</a></td>
|
||||
<td align="center"><a href="http://www.ifi.uzh.ch/en/ce/people/schuldenzucker.html"><img src="https://avatars3.githubusercontent.com/u/1100776?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Steffen Schuldenzucker</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=sschuldenzucker" title="Code">💻</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><a href="https://github.com/Pixcell"><img src="https://avatars0.githubusercontent.com/u/4005291?v=4" width="100px;" alt=""/><br /><sub><b>Pixcell</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=Pixcell" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/Pixcell"><img src="https://avatars0.githubusercontent.com/u/4005291?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Pixcell</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=Pixcell" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://jasonet.co"><img src="https://avatars.githubusercontent.com/u/10660468?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jason Etcovitch</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=JasonEtco" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/kayuapi"><img src="https://avatars.githubusercontent.com/u/10304328?v=4?s=100" width="100px;" alt=""/><br /><sub><b>ZC</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=kayuapi" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="https://memmie.lenglet.name"><img src="https://avatars.githubusercontent.com/u/729275?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Memmie Lenglet</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=mems" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/ilhamdev0"><img src="https://avatars.githubusercontent.com/u/57636145?v=4?s=100" width="100px;" alt=""/><br /><sub><b>ilhamdev0</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=ilhamdev0" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="https://github.com/c412216887"><img src="https://avatars.githubusercontent.com/u/29691650?v=4?s=100" width="100px;" alt=""/><br /><sub><b>一饮一啄皆是人生</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=c412216887" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="https://digitalinspiration.com/"><img src="https://avatars.githubusercontent.com/u/1344071?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Amit Agarwal</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=labnol" title="Documentation">📖</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><a href="https://n1ru4l.cloud/"><img src="https://avatars.githubusercontent.com/u/14338007?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Laurin Quast</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=n1ru4l" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/mattvague"><img src="https://avatars.githubusercontent.com/u/64985?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Matt Vague</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=mattvague" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/bglw"><img src="https://avatars.githubusercontent.com/u/40188355?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Liam Bigelow</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=bglw" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://about.me/jasonkurian"><img src="https://avatars.githubusercontent.com/u/2642545?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jason Kurian</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=JaKXz" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="https://github.com/dphm"><img src="https://avatars.githubusercontent.com/u/1707217?v=4?s=100" width="100px;" alt=""/><br /><sub><b>d pham (they/them)</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=dphm" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="https://www.aleksandrhovhannisyan.com/"><img src="https://avatars.githubusercontent.com/u/19352442?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Aleksandr Hovhannisyan</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=AleksandrHovhannisyan" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/jg-rp"><img src="https://avatars.githubusercontent.com/u/72664870?v=4?s=100" width="100px;" alt=""/><br /><sub><b>jg-rp</b></sub></a><br /><a href="https://github.com/harttle/liquidjs/commits?author=jg-rp" title="Code">💻</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- markdownlint-enable -->
|
||||
<!-- markdownlint-restore -->
|
||||
<!-- prettier-ignore-end -->
|
||||
|
||||
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
||||
|
||||
[shopify/liquid]: https://shopify.github.io/liquid/
|
||||
|
||||
Executable
+31
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const Benchmark = require('benchmark')
|
||||
const data = require('./data/todolist.json')
|
||||
const path = require('path')
|
||||
|
||||
const engines = {
|
||||
handlebars: require('./engines/handlebars'),
|
||||
liquid: require('./engines/liquid'),
|
||||
react: require('./engines/react'),
|
||||
swig: require('./engines/swig')
|
||||
}
|
||||
|
||||
function crossEngines () {
|
||||
console.log(' cross engines')
|
||||
console.log('------------------------')
|
||||
return new Promise(resolve => {
|
||||
const suit = new Benchmark.Suite('cross engines')
|
||||
|
||||
for (const [name, { load, render }] of Object.entries(engines)) {
|
||||
const tpl = load(path.resolve(__dirname, `templates/todolist`))
|
||||
suit.add(name, () => render(tpl, data))
|
||||
}
|
||||
|
||||
suit.on('cycle', event => console.log(String(event.target)))
|
||||
suit.on('complete', resolve)
|
||||
suit.run({ async: true })
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = { crossEngines }
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"categories": [{
|
||||
"color": "red",
|
||||
"id": "CAT1",
|
||||
"title": "work"
|
||||
}, {
|
||||
"color": "red",
|
||||
"id": "CAT2",
|
||||
"title": "emergency"
|
||||
}, {
|
||||
"color": "green",
|
||||
"id": "CAT3",
|
||||
"title": "sport"
|
||||
}],
|
||||
"todos": [{
|
||||
"title": "fork and clone",
|
||||
"id": "TODO1",
|
||||
"category": "work"
|
||||
}, {
|
||||
"title": "make it better",
|
||||
"id": "TODO2",
|
||||
"category": "sport"
|
||||
}, {
|
||||
"title": "make a pull request",
|
||||
"id": "TODO3",
|
||||
"category": "work"
|
||||
}]
|
||||
}
|
||||
Regular → Executable
+6
-18
@@ -1,8 +1,10 @@
|
||||
const Benchmark = require('benchmark')
|
||||
const { Liquid } = require('..')
|
||||
const ctx = require('./data/todolist.json')
|
||||
const { resolve } = require('path')
|
||||
|
||||
const engine = new Liquid({
|
||||
root: __dirname,
|
||||
root: resolve(__dirname, 'templates'),
|
||||
extname: '.liquid'
|
||||
})
|
||||
|
||||
@@ -17,28 +19,14 @@ engine.registerTag('header', {
|
||||
}
|
||||
})
|
||||
|
||||
const ctx = {
|
||||
todos: ['fork and clone', 'make it better', 'make a pull request'],
|
||||
title: 'Welcome to liquidjs!'
|
||||
}
|
||||
|
||||
const template = `
|
||||
{%header content: "welcome to liquid" | capitalize%}
|
||||
|
||||
<ul>
|
||||
{% for todo in todos %}
|
||||
<li>{{forloop.index}} - {{todo}}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
`
|
||||
|
||||
function demo () {
|
||||
console.log('--- demo ---')
|
||||
console.log(' demo')
|
||||
console.log('------------------------')
|
||||
return new Promise(resolve => {
|
||||
new Benchmark.Suite('demo')
|
||||
.add('demo', {
|
||||
defer: true,
|
||||
fn: d => engine.parseAndRender(template, ctx).then(x => d.resolve(x))
|
||||
fn: d => engine.renderFile('todolist', ctx).then(x => d.resolve(x))
|
||||
})
|
||||
.on('cycle', event => console.log(String(event.target)))
|
||||
.on('complete', resolve)
|
||||
|
||||
Executable
+50
@@ -0,0 +1,50 @@
|
||||
#!/usr/bin/env node
|
||||
const { performance } = require('perf_hooks')
|
||||
const path = require('path')
|
||||
|
||||
const FILE_LOCAL = process.argv[2]
|
||||
const FILE_LATEST = process.argv[3]
|
||||
console.log(`Local: ${FILE_LOCAL}`)
|
||||
console.log(`Latest: ${FILE_LATEST}`)
|
||||
|
||||
const { createEngine } = require('./engines/create-liquid')
|
||||
const local = createEngine(require(path.resolve(__dirname, '..', FILE_LOCAL)))
|
||||
const latest = createEngine(require(path.resolve(__dirname, '..', FILE_LOCAL)))
|
||||
const data = require('./data/todolist.json')
|
||||
const tpl = path.resolve(__dirname, `templates/todolist`)
|
||||
|
||||
const begin = performance.now()
|
||||
const tplLocal = local.load(tpl)
|
||||
const tplLatest = latest.load(tpl)
|
||||
const tasks = [
|
||||
{
|
||||
cycles: 0,
|
||||
time: 0,
|
||||
fn: () => latest.render(tplLatest, data)
|
||||
},
|
||||
{
|
||||
cycles: 0,
|
||||
time: 0,
|
||||
fn: () => local.render(tplLocal, data)
|
||||
}
|
||||
]
|
||||
while (performance.now() - begin < 20e3) {
|
||||
const task = tasks[Math.floor(Math.random() * 2)]
|
||||
task.time -= performance.now()
|
||||
task.fn()
|
||||
task.time += performance.now()
|
||||
task.cycles++
|
||||
}
|
||||
|
||||
const [ latestResult, localResult ] = tasks.map(task => {
|
||||
task.perf = task.cycles * 1000 / task.time
|
||||
return task
|
||||
})
|
||||
const diff = (localResult.perf - latestResult.perf) / latestResult.perf
|
||||
|
||||
console.log(`Local: ${localResult.perf.toFixed(3)} ops/s (${localResult.cycles} cycles)`)
|
||||
console.log(`Latest: ${latestResult.perf.toFixed(3)} ops/s (${latestResult.cycles} cycles)`)
|
||||
console.log(`Diff: ${(diff * 100).toFixed(3)}%`)
|
||||
|
||||
const THRESHOLD_PERCENT = -3
|
||||
process.exit(diff * 100 < THRESHOLD_PERCENT ? 1 : 0)
|
||||
@@ -0,0 +1,17 @@
|
||||
const { readFileSync } = require('fs')
|
||||
const { join } = require('path')
|
||||
|
||||
function createEngine (pkg) {
|
||||
const liquid = new pkg.Liquid({
|
||||
root: join(__dirname, '../templates'),
|
||||
cache: true,
|
||||
extname: '.liquid'
|
||||
})
|
||||
liquid.registerFilter('url', path => `http://example.com${path}`)
|
||||
return {
|
||||
load: path => liquid.parse(readFileSync(path + '.liquid', 'utf8')),
|
||||
render: (tpl, data) => liquid.renderSync(tpl, data)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { createEngine }
|
||||
@@ -0,0 +1,33 @@
|
||||
const handlebars = require('handlebars')
|
||||
const { readFileSync } = require('fs')
|
||||
const { join } = require('path')
|
||||
|
||||
handlebars.registerPartial(
|
||||
'todo-icon',
|
||||
readFileSync(join(__dirname, '../templates/todo-icon.hbs'), 'utf8')
|
||||
)
|
||||
|
||||
handlebars.registerHelper('concat', function (...args) {
|
||||
return args.filter(x => typeof x === 'string').join('')
|
||||
})
|
||||
|
||||
handlebars.registerHelper('url', function (path) {
|
||||
return `http://example.com${path}`
|
||||
})
|
||||
|
||||
handlebars.registerHelper('inc', function (num) {
|
||||
return Number(num) + 1
|
||||
})
|
||||
|
||||
handlebars.registerHelper('capitalize', function (str) {
|
||||
return str[0].toUpperCase() + str.slice(1).toLowerCase()
|
||||
})
|
||||
|
||||
handlebars.registerHelper('upcase', function (str) {
|
||||
return str.toUpperCase()
|
||||
})
|
||||
|
||||
module.exports = {
|
||||
load: path => handlebars.compile(readFileSync(path + '.hbs', 'utf8')),
|
||||
render: (tpl, data) => tpl(data)
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
const { createEngine } = require('./create-liquid')
|
||||
|
||||
module.exports = createEngine(require('../../dist/liquid.node.cjs'))
|
||||
Vendored
+20
@@ -0,0 +1,20 @@
|
||||
const { readFileSync } = require('fs')
|
||||
const React = require('react')
|
||||
const ReactDOMServer = require('react-dom/server')
|
||||
const babel = require('@babel/core')
|
||||
const requireFromString = require('require-from-string')
|
||||
|
||||
const babelConfig = {
|
||||
presets: ['@babel/preset-react', '@babel/preset-env']
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
load: path => {
|
||||
const src = readFileSync(path + '.jsx', 'utf8')
|
||||
const transformed = babel.transform(src, babelConfig)
|
||||
return requireFromString(transformed.code)
|
||||
},
|
||||
render: (Component, data) => {
|
||||
return ReactDOMServer.renderToString(React.createElement(Component, data))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
const swig = require('swig')
|
||||
|
||||
swig.setFilter('url', function (path) {
|
||||
return `http://example.com${path}`
|
||||
})
|
||||
|
||||
swig.setFilter('prepend', function (input, arg) {
|
||||
return arg + input
|
||||
})
|
||||
|
||||
swig.setFilter('append', function (input, arg) {
|
||||
return input + arg
|
||||
})
|
||||
|
||||
swig.setFilter('inc', function (num) {
|
||||
return Number(num) + 1
|
||||
})
|
||||
|
||||
swig.setFilter('capitalize', function (str) {
|
||||
return str[0].toUpperCase() + str.slice(1).toLowerCase()
|
||||
})
|
||||
|
||||
swig.setFilter('upcase', function (str) {
|
||||
return str.toUpperCase()
|
||||
})
|
||||
|
||||
module.exports = {
|
||||
load: path => swig.compileFile(path + '.swig'),
|
||||
render: (tpl, data) => tpl(data)
|
||||
}
|
||||
Regular → Executable
+2
@@ -3,6 +3,7 @@ const { tag } = require('./tag')
|
||||
const { demo } = require('./demo')
|
||||
const { layout } = require('./layout')
|
||||
const { memory } = require('./memory')
|
||||
const { crossEngines } = require('./cross-engines')
|
||||
|
||||
async function main () {
|
||||
await output()
|
||||
@@ -10,6 +11,7 @@ async function main () {
|
||||
await demo()
|
||||
await layout()
|
||||
await memory()
|
||||
await crossEngines()
|
||||
}
|
||||
|
||||
main()
|
||||
|
||||
Regular → Executable
+2
-1
@@ -18,7 +18,8 @@ const template = `
|
||||
`
|
||||
|
||||
function layout () {
|
||||
console.log('--- layout ---')
|
||||
console.log(' layout')
|
||||
console.log('------------------------')
|
||||
return new Promise(resolve => {
|
||||
new Benchmark.Suite('layout')
|
||||
.add('cache=false', {
|
||||
|
||||
Regular → Executable
+7
-6
@@ -13,7 +13,8 @@ const engine = new Liquid(engineOptions)
|
||||
const SAMPLE_COUNT = 1024
|
||||
|
||||
function memory () {
|
||||
console.log('--- memory ---')
|
||||
console.log(' memory')
|
||||
console.log('------------------------')
|
||||
html()
|
||||
todolist()
|
||||
}
|
||||
@@ -29,11 +30,11 @@ function html () {
|
||||
templates.push(engine.parse(str))
|
||||
}
|
||||
const diff1 = (getHeapStatistics().used_heap_size - base) / SAMPLE_COUNT
|
||||
console.log(`${h(str.length)} lorem-html before GC x ${h(diff1)}/tpl (${SAMPLE_COUNT} instances sampled)`)
|
||||
console.log(`[lorem-html ${h(str.length)}][before GC] ${h(diff1)}/tpl (${SAMPLE_COUNT} runs sampled)`)
|
||||
|
||||
global.gc()
|
||||
const diff2 = (getHeapStatistics().used_heap_size - base) / SAMPLE_COUNT
|
||||
console.log(`${h(str.length)} lorem-html after GC x ${h(diff2)}/tpl (${SAMPLE_COUNT} instances sampled)`)
|
||||
console.log(`[lorem-html ${h(str.length)}][after GC] ${h(diff2)}/tpl (${SAMPLE_COUNT} runs sampled)`)
|
||||
}
|
||||
|
||||
function todolist () {
|
||||
@@ -47,15 +48,15 @@ function todolist () {
|
||||
templates.push(engine.parse(str))
|
||||
}
|
||||
const diff1 = (getHeapStatistics().used_heap_size - base) / SAMPLE_COUNT
|
||||
console.log(`${h(str.length)} todolist before GC x ${h(diff1)}/tpl (${SAMPLE_COUNT} instances sampled)`)
|
||||
console.log(`[todolist ${h(str.length)}][before GC] ${h(diff1)}/tpl (${SAMPLE_COUNT} runs sampled)`)
|
||||
|
||||
global.gc()
|
||||
const diff2 = (getHeapStatistics().used_heap_size - base) / SAMPLE_COUNT
|
||||
console.log(`${h(str.length)} todolist after GC x ${h(diff2)}/tpl (${SAMPLE_COUNT} instances sampled)`)
|
||||
console.log(`[todolist ${h(str.length)}][after GC] ${h(diff2)}/tpl (${SAMPLE_COUNT} runs sampled)`)
|
||||
}
|
||||
|
||||
function h (size) {
|
||||
return (size / 1024).toFixed(3) + ' kB'
|
||||
return (size / 1024).toFixed(3) + ' KB'
|
||||
}
|
||||
|
||||
module.exports = { memory }
|
||||
|
||||
Regular → Executable
+2
-1
@@ -4,7 +4,8 @@ const { Liquid } = require('..')
|
||||
const liquid = new Liquid()
|
||||
|
||||
function output () {
|
||||
console.log('--- output ---')
|
||||
console.log(' output')
|
||||
console.log('------------------------')
|
||||
return new Promise(resolve => {
|
||||
new Benchmark.Suite('output')
|
||||
.add('literal', test('{{false}}{{"foo"}}{{32.322}}'))
|
||||
|
||||
Generated
+3380
File diff suppressed because it is too large
Load Diff
Executable
+23
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "benchmark",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "node --expose-gc index",
|
||||
"engines": "node -e 'require(\"./cross-engines\").crossEngines()'"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.13.14",
|
||||
"@babel/preset-env": "^7.13.12",
|
||||
"@babel/preset-react": "^7.13.13",
|
||||
"handlebars": "^4.7.7",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2",
|
||||
"require-from-string": "^2.0.2",
|
||||
"swig": "^1.4.2"
|
||||
}
|
||||
}
|
||||
Regular → Executable
+2
-1
@@ -4,7 +4,8 @@ const { Liquid } = require('..')
|
||||
const liquid = new Liquid()
|
||||
|
||||
function tag () {
|
||||
console.log('--- tag ---')
|
||||
console.log(' tag')
|
||||
console.log('------------------------')
|
||||
return new Promise(resolve => {
|
||||
new Benchmark.Suite('tag')
|
||||
.add('if', test('{% if "foobar" %}foo{% endif %}'))
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<img title="risus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices" src="http://images.example.com/{{id}}.png">
|
||||
@@ -0,0 +1 @@
|
||||
<img title="risus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices" src="http://images.example.com/{{id}}.png">
|
||||
@@ -0,0 +1 @@
|
||||
<img title="risus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices" src="http://images.example.com/{{todo.id}}.png">
|
||||
@@ -0,0 +1,44 @@
|
||||
<section class="todo-list">
|
||||
<h1>
|
||||
posuere cubilia Curae; Vestibulum hendrerit malesuada odio. Fusce ut elit
|
||||
ut augue sollicitudin blandit. Phasellus volutpat lorem. Duis non pede et
|
||||
neque luctus tincidunt. Duis interdum tempus elit.
|
||||
<small>Aenean metus. Vestibulum ac lacus. Vivamus porttitor, massa ut.</small>
|
||||
</h1>
|
||||
<a href={{url "/add"}} class="todo-add"><i class="fa fa-plus-square"></i>Add Todo</a>
|
||||
<ul class="filter-category">
|
||||
{{#each categories }}
|
||||
<li style="background: {{ color }}">
|
||||
<a href="/todos/category/{{ id }}">{{ title }}</a>
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
{{#each todos }}
|
||||
<div>
|
||||
<h2>
|
||||
Todo {{inc @index}}:
|
||||
<span class="todo-item content" data-todo-index="{{@index}}">
|
||||
{{ upcase (concat 'TODO: ' title) }}
|
||||
</span>
|
||||
</h2>
|
||||
{{> todo-icon id=id }}
|
||||
|
||||
<p class="description">
|
||||
Purus eu mi. Proin commodo, massa commodo dapibus elementum,
|
||||
libero lacus pulvinar eros, ut tincidunt nisl elit ut velit. Cras rutrum
|
||||
porta purus. Vivamus lorem. Sed turpis enim, faucibus quis, pharetra in,
|
||||
sagittis sed, magna. Curabitur ultricies felis ut libero. Nullam tincidunt
|
||||
enim eu nibh. Nunc eget ipsum in sem facilisis convallis. Proin fermentum
|
||||
</p>
|
||||
|
||||
<div class="todo-meta">
|
||||
{{# if category }}
|
||||
<span>{{ capitalize category }}</span>
|
||||
{{/if}}
|
||||
</div>
|
||||
<a class="btn btn-primary" href={{ url (concat "/edit/" id) }}><i class="fa fa-pencil"></i> Edit</a>
|
||||
<a class="btn btn-default"><i class="fa fa-check"></i> Check</a>
|
||||
<a class="btn ben-danger" href={{ url (concat "/delete/" id) }}><i class="fa fa-trash-o"</i> Trash</a>
|
||||
</div>
|
||||
{{/each}}
|
||||
</section>
|
||||
@@ -0,0 +1,57 @@
|
||||
// eslint-disable-next-line
|
||||
const React = require('react')
|
||||
|
||||
function capitalize (str) {
|
||||
return str[0].toUpperCase() + str.slice(1).toLowerCase()
|
||||
}
|
||||
function url (path) {
|
||||
return `http://example.com${path}`
|
||||
}
|
||||
function renderTodoIcon (id) {
|
||||
return <img title="risus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices" src="http://images.example.com/{id}.png"/>
|
||||
}
|
||||
|
||||
module.exports = ({ categories, todos }) => {
|
||||
return <section className="todo-list">
|
||||
<h1>
|
||||
posuere cubilia Curae; Vestibulum hendrerit malesuada odio. Fusce ut elit
|
||||
ut augue sollicitudin blandit. Phasellus volutpat lorem. Duis non pede et
|
||||
neque luctus tincidunt. Duis interdum tempus elit.
|
||||
<small>Aenean metus. Vestibulum ac lacus. Vivamus porttitor, massa ut.</small>
|
||||
</h1>
|
||||
<a href={url('/add')} className="todo-add"><i className="fa fa-plus-square"></i>Add Todo</a>
|
||||
<ul className="filter-category">
|
||||
{categories.map((item, i) => {
|
||||
return <li key={i} style={{ background: item.color }}>
|
||||
<a href={'/todos/category/' + item.id }>{ item.title }</a>
|
||||
</li>
|
||||
})}
|
||||
</ul>
|
||||
{todos.map((todo, index0) => {
|
||||
return <div key={index0}>
|
||||
<h2>
|
||||
Todo { index0 + 1 }:
|
||||
<span className="todo-item content" data-todo-index="{{ forloop.index0 }}">
|
||||
{ ('TODO: ' + todo.title).toUpperCase() }
|
||||
</span>
|
||||
</h2>
|
||||
{ renderTodoIcon(todo.id) }
|
||||
|
||||
<p className="description">
|
||||
Purus eu mi. Proin commodo, massa commodo dapibus elementum,
|
||||
libero lacus pulvinar eros, ut tincidunt nisl elit ut velit. Cras rutrum
|
||||
porta purus. Vivamus lorem. Sed turpis enim, faucibus quis, pharetra in,
|
||||
sagittis sed, magna. Curabitur ultricies felis ut libero. Nullam tincidunt
|
||||
enim eu nibh. Nunc eget ipsum in sem facilisis convallis. Proin fermentum
|
||||
</p>
|
||||
|
||||
<div className="todo-meta">
|
||||
{ todo.category ? <span>{capitalize(todo.category)}</span> : '' }
|
||||
</div>
|
||||
<a className="btn btn-primary" href={url('/edit/' + todo.id)}><i className="fa fa-pencil"></i> Edit</a>
|
||||
<a className="btn btn-default"><i className="fa fa-check"></i> Check</a>
|
||||
<a className="btn ben-danger" href={url('/delete/' + todo.id)}><i className="fa fa-trash-o"></i> Trash</a>
|
||||
</div>
|
||||
})}
|
||||
</section>
|
||||
}
|
||||
@@ -7,8 +7,7 @@
|
||||
</h1>
|
||||
<a href={{"/add" | url}} class="todo-add"><i class="fa fa-plus-square"></i>Add Todo</a>
|
||||
<ul class="filter-category">
|
||||
{% for i in (0..categories.length) %}
|
||||
{% assign item=categories[i] %}
|
||||
{% for item in categories %}
|
||||
<li style="background: {{ item.color }}">
|
||||
<a href="/todos/category/{{ item.id }}">{{ item.title }}</a>
|
||||
</li>
|
||||
@@ -22,11 +21,7 @@
|
||||
{{ todo.title | prepend: 'TODO: ' | upcase }}
|
||||
</span>
|
||||
</h2>
|
||||
|
||||
<img
|
||||
title="risus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices"
|
||||
src="{% include "todo-icon", id=todo.id }} %}"
|
||||
>
|
||||
{% render "todo-icon", id:todo.id %}
|
||||
|
||||
<p class="description">
|
||||
Purus eu mi. Proin commodo, massa commodo dapibus elementum,
|
||||
@@ -38,12 +33,12 @@
|
||||
|
||||
<div class="todo-meta">
|
||||
{% if todo.category %}
|
||||
<span>{{ todo.category.title | capitalize }}</span>
|
||||
<span>{{ todo.category | capitalize }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
<a class="btn btn-primary" href={{"/edit/" | append todo.id | url }}><i class="fa fa-pencil"></i> Edit</a>
|
||||
<a class="btn btn-primary" href={{"/edit/" | append: todo.id | url }}><i class="fa fa-pencil"></i> Edit</a>
|
||||
<a class="btn btn-default"><i class="fa fa-check"></i> Check</a>
|
||||
<a class="btn ben-danger" href={{"/delete/" | append todo.id | url }}><i class="fa fa-trash-o"</i> Trash</a>
|
||||
<a class="btn ben-danger" href={{"/delete/" | append: todo.id | url }}><i class="fa fa-trash-o"</i> Trash</a>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</section>
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
<section class="todo-list">
|
||||
<h1>
|
||||
posuere cubilia Curae; Vestibulum hendrerit malesuada odio. Fusce ut elit
|
||||
ut augue sollicitudin blandit. Phasellus volutpat lorem. Duis non pede et
|
||||
neque luctus tincidunt. Duis interdum tempus elit.
|
||||
<small>Aenean metus. Vestibulum ac lacus. Vivamus porttitor, massa ut.</small>
|
||||
</h1>
|
||||
<a href={{"/add" | url}} class="todo-add"><i class="fa fa-plus-square"></i>Add Todo</a>
|
||||
<ul class="filter-category">
|
||||
{% for item in categories %}
|
||||
<li style="background: {{ item.color }}">
|
||||
<a href="/todos/category/{{ item.id }}">{{ item.title }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% for todo in todos %}
|
||||
<div>
|
||||
<h2>
|
||||
Todo {{ loop.index }}:
|
||||
<span class="todo-item content" data-todo-index="{{ loop.index0 }}">
|
||||
{{ todo.title | prepend('TODO: ') | upcase }}
|
||||
</span>
|
||||
</h2>
|
||||
{% include "todo-icon.swig" %}
|
||||
|
||||
<p class="description">
|
||||
Purus eu mi. Proin commodo, massa commodo dapibus elementum,
|
||||
libero lacus pulvinar eros, ut tincidunt nisl elit ut velit. Cras rutrum
|
||||
porta purus. Vivamus lorem. Sed turpis enim, faucibus quis, pharetra in,
|
||||
sagittis sed, magna. Curabitur ultricies felis ut libero. Nullam tincidunt
|
||||
enim eu nibh. Nunc eget ipsum in sem facilisis convallis. Proin fermentum
|
||||
</p>
|
||||
|
||||
<div class="todo-meta">
|
||||
{% if todo.category %}
|
||||
<span>{{ todo.category | capitalize }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
<a class="btn btn-primary" href={{"/edit/" | append(todo.id) | url }}><i class="fa fa-pencil"></i> Edit</a>
|
||||
<a class="btn btn-default"><i class="fa fa-check"></i> Check</a>
|
||||
<a class="btn ben-danger" href={{"/delete/" | append(todo.id) | url }}><i class="fa fa-trash-o"</i> Trash</a>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</section>
|
||||
+3
-1
@@ -1,7 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -ex
|
||||
|
||||
rm -rf docs/source/api docs/source/zh-cn/api
|
||||
typedoc ./src --gitRevision master --out docs/source/api --plugin typedoc-plugin-markdown --theme vuepress
|
||||
typedoc ./src --gitRevision master --out docs/source/api --plugin typedoc-plugin-markdown --ignoreCompilerErrors true --theme vuepress
|
||||
rm docs/source/api/README.md
|
||||
|
||||
for file in $(find docs/source/api -name "*.md"); do
|
||||
|
||||
Executable
+15
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
cd docs
|
||||
cp ../CHANGELOG.md source/tutorials/changelog.md
|
||||
sed -i \
|
||||
-e 's/{%/{% raw %}{%{% endraw %}/g' \
|
||||
-e 's/{{/{% raw %}{{{% endraw %}/g' \
|
||||
-e '1 s/"/\"/g' \
|
||||
-e '1 s/</\</g' \
|
||||
-e '1 s/>/\>/g' \
|
||||
source/tutorials/changelog.md
|
||||
cp source/tutorials/changelog.md source/zh-cn/tutorials/changelog.md
|
||||
|
||||
sed -i '1i ---\ntitle: Changelog\nauto: true\n---\n' source/tutorials/changelog.md
|
||||
sed -i '1i ---\ntitle: 更新日志\nauto: true\n---\n' source/zh-cn/tutorials/changelog.md
|
||||
+3
-13
@@ -1,26 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -ex
|
||||
|
||||
./bin/build-contributors.sh
|
||||
./bin/build-apidoc.sh
|
||||
./bin/build-changelog.sh
|
||||
|
||||
cd docs
|
||||
npm ci
|
||||
npm run build
|
||||
cp CNAME public/
|
||||
|
||||
cp ../CHANGELOG.md source/tutorials/changelog.md
|
||||
sed -i \
|
||||
-e 's/{%/{% raw %}{%{% endraw %}/g' \
|
||||
-e 's/{{/{% raw %}{{{% endraw %}/g' \
|
||||
-e '1 s/"/\"/g' \
|
||||
-e '1 s/</\</g' \
|
||||
-e '1 s/>/\>/g' \
|
||||
source/tutorials/changelog.md
|
||||
cp source/tutorials/changelog.md source/zh-cn/tutorials/changelog.md
|
||||
|
||||
sed -i '1i ---\ntitle: Changelog\nauto: true\n---\n' source/tutorials/changelog.md
|
||||
sed -i '1i ---\ntitle: 更新日志\nauto: true\n---\n' source/zh-cn/tutorials/changelog.md
|
||||
|
||||
if [ "$HEXO_ALGOLIA_INDEXING_KEY" != "" ]; then
|
||||
npm run index
|
||||
fi
|
||||
|
||||
Executable
+16
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
VERSION_LATEST=$(cat package.json | grep '"version":' | awk -F'"' '{print $4}')
|
||||
FILE_LOCAL=dist/liquid.node.cjs.js
|
||||
FILE_LATEST=dist/liquid.node.cjs.$VERSION_LATEST.js
|
||||
URL_LATEST=https://unpkg.com/liquidjs@$VERSION_LATEST/dist/liquid.node.cjs.js
|
||||
|
||||
if [ ! -f $FILE_LATEST ]; then
|
||||
curl $URL_LATEST > $FILE_LATEST
|
||||
fi
|
||||
|
||||
# if [ ! -f $FILE_LOCAL ]; then
|
||||
BUNDLES=cjs npm run build:dist
|
||||
# fi
|
||||
|
||||
exec node benchmark/diff.js $FILE_LOCAL $FILE_LATEST
|
||||
+20
-5
@@ -1,9 +1,14 @@
|
||||
const { Liquid } = require('liquidjs')
|
||||
|
||||
const engine = new Liquid({
|
||||
root: __dirname,
|
||||
extname: '.liquid',
|
||||
globals: {title: 'LiquidJS Demo'}
|
||||
globals: { title: 'LiquidJS Demo' },
|
||||
// root files for `.render()` and `.parse()`
|
||||
root: __dirname,
|
||||
// layout files for `{% layout %}`
|
||||
layouts: './layouts',
|
||||
// partial files for `{% include %}` and `{% render %}`
|
||||
partials: './partials'
|
||||
})
|
||||
|
||||
engine.registerTag('header', {
|
||||
@@ -21,6 +26,16 @@ const ctx = {
|
||||
todos: ['fork and clone', 'make it better', 'make a pull request']
|
||||
}
|
||||
|
||||
engine.renderFile('todolist', ctx)
|
||||
.then(console.log)
|
||||
.catch(err => console.error(err.stack))
|
||||
async function main () {
|
||||
console.log('==========renderFile===========')
|
||||
const html = await engine.renderFile('todolist', ctx)
|
||||
console.log(html)
|
||||
|
||||
console.log('===========Streamed===========')
|
||||
const tpls = await engine.parseFile('todolist')
|
||||
engine.renderToNodeStream(tpls, ctx)
|
||||
.on('data', data => process.stdout.write(data))
|
||||
.on('end', () => console.log(''))
|
||||
}
|
||||
|
||||
main()
|
||||
|
||||
@@ -7,6 +7,6 @@
|
||||
"start": "node index.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"liquidjs": "*"
|
||||
"liquidjs": "^9.28.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<li>{{index}} - {{todo}}</li>
|
||||
@@ -2,6 +2,6 @@
|
||||
{%header content: title | capitalize%}
|
||||
<ul>
|
||||
{% for todo in todos %}
|
||||
<li>{{forloop.index}} - {{todo}}</li>
|
||||
{% render 'todo.liquid' with todo, index: forloop.index%}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
@@ -7,7 +7,11 @@
|
||||
"start": "ts-node index.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"ts-node": "^8.0.2",
|
||||
"liquidjs": "*"
|
||||
"liquidjs": "*",
|
||||
"ts-node": "^8.10.2",
|
||||
"typescript": "^4.2.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^14.14.37"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{%header content: "welcome to liquid" | capitalize%}
|
||||
{%header content: title | capitalize%}
|
||||
|
||||
<ul>
|
||||
{% for todo in todos %}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"types": [
|
||||
"node"
|
||||
]
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
title: LiquidJS
|
||||
subtitle: "A simple, expressive and safe template engine."
|
||||
description: "LiquidJS is a simple, expressive and safe template engine."
|
||||
description: "LiquidJS is a simple, expressive and safe Shopify / Github Pages compatible template engine in pure JavaScript."
|
||||
author: Harttle
|
||||
language: en
|
||||
timezone: UTC
|
||||
|
||||
Generated
+5668
-566
File diff suppressed because it is too large
Load Diff
+6
-5
@@ -3,7 +3,7 @@
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"hexo": {
|
||||
"version": "4.2.0"
|
||||
"version": "5.4.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "hexo generate",
|
||||
@@ -13,7 +13,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"cheerio": "^0.22.0",
|
||||
"hexo": "^4.2.0",
|
||||
"hexo": "^5.4.0",
|
||||
"hexo-algolia": "^1.3.1",
|
||||
"hexo-clean-css": "^1.0.0",
|
||||
"hexo-filter-nofollow": "^2.0.2",
|
||||
@@ -21,15 +21,16 @@
|
||||
"hexo-generator-feed": "^2.0.0",
|
||||
"hexo-generator-sitemap": "^2.0.0",
|
||||
"hexo-renderer-marked": "^2.0.0",
|
||||
"hexo-renderer-pug": "^1.0.0",
|
||||
"hexo-renderer-pug": "^2.0.0",
|
||||
"hexo-renderer-stylus": "^1.0.0",
|
||||
"hexo-renderer-swig": "^1.1.0",
|
||||
"hexo-server": "^1.0.0",
|
||||
"hexo-uglify": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"all-contributors-cli": "^6.8.1",
|
||||
"eslint": "^6.0.1",
|
||||
"eslint-config-hexo": "^4.0.0",
|
||||
"all-contributors-cli": "^6.8.1"
|
||||
"eslint-config-hexo": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.10.0"
|
||||
|
||||
@@ -37,7 +37,12 @@ hexo.extend.helper.register('page_nav', function () {
|
||||
})
|
||||
|
||||
hexo.extend.helper.register('raw', function (filepath) {
|
||||
const content = readFileSync(resolve(this.view_dir, filepath))
|
||||
const content = readFileSync(resolve(this.view_dir, filepath), 'utf8')
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, ''')
|
||||
return content
|
||||
})
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
'use strict'
|
||||
|
||||
hexo.extend.tag.register('note', (args, content) => {
|
||||
hexo.extend.tag.register('note', (args, text) => {
|
||||
const className = args.shift()
|
||||
let header = ''
|
||||
let result = ''
|
||||
@@ -12,8 +12,12 @@ hexo.extend.tag.register('note', (args, content) => {
|
||||
}
|
||||
|
||||
result += `<blockquote class="note ${className}">${header}`
|
||||
result += hexo.render.renderSync({ text: content, engine: 'markdown' })
|
||||
result += hexo.render.renderSync({ text, engine: 'markdown' })
|
||||
result += '</blockquote>'
|
||||
|
||||
return result
|
||||
}, true)
|
||||
|
||||
hexo.extend.tag.register('since', (args, text) => {
|
||||
return `<p class="since">${text.trim()}</p>`
|
||||
}, true)
|
||||
|
||||
@@ -1,9 +1,3 @@
|
||||
-
|
||||
url: https://github.com/harttle/liquidjs/pull/5
|
||||
date: '2016-09-12'
|
||||
title:
|
||||
zh-cn: '异步化:重写了解析器和渲染器,使 LiquidJS 可以提供 Promise API 并支持异步的自定义 Tag 实现。'
|
||||
en: 'Async spike: rewrite the parser and render to support Promise, which enables async tags.'
|
||||
-
|
||||
url: https://opencollective.com/liquidjs/#section-contribute
|
||||
date: '2020-02-26'
|
||||
@@ -22,3 +16,9 @@
|
||||
title:
|
||||
zh-cn: '性能提升:引入 AST 并重新设计 Token 类型系统,使渲染性能平均提升 100.3%。'
|
||||
en: 'Performance Boost: a simple AST to improve render performance by 100.3%.'
|
||||
-
|
||||
url: https://github.com/harttle/liquidjs/milestone/3?closed=1
|
||||
date: '2021-09-30'
|
||||
title:
|
||||
zh-cn: '流式渲染:4 倍渲染速度,并增加了对流式渲染的支持。'
|
||||
en: 'Streamed Rendering: now render is 4x faster and support streamed rendering.'
|
||||
|
||||
@@ -27,6 +27,8 @@ filters:
|
||||
at_most: at_most.html
|
||||
capitalize: capitalize.html
|
||||
ceil: ceil.html
|
||||
compact: compact.html
|
||||
concat: concat.html
|
||||
date: date.html
|
||||
default: default.html
|
||||
divided_by: divided_by.html
|
||||
@@ -77,11 +79,13 @@ tags:
|
||||
comment: comment.html
|
||||
cycle: cycle.html
|
||||
decrement: decrement.html
|
||||
echo: echo.html
|
||||
for: for.html
|
||||
if: if.html
|
||||
include: include.html
|
||||
increment: increment.html
|
||||
layout: layout.html
|
||||
liquid: liquid.html
|
||||
raw: raw.html
|
||||
render: render.html
|
||||
tablerow: tablerow.html
|
||||
@@ -135,4 +139,4 @@ api:
|
||||
LiquidOptions: "../interfaces/liquid_options_.liquidoptions.html"
|
||||
NormalizedFullOptions: "../interfaces/liquid_options_.normalizedfulloptions.html"
|
||||
PlainObject: "../interfaces/context_scope_.plainobject.html"
|
||||
TagImplOptions: "../interfaces/template_tag_tag_impl_options_.tagimploptions.html"
|
||||
TagImplOptions: "../interfaces/template_tag_tag_impl_options_.tagimploptions.html"
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
title: abs
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
Liquid filter that returns the absolute value of a number.
|
||||
|
||||
Input
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
title: append
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
Concatenates two strings and returns the concatenated value.
|
||||
|
||||
Input
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
title: at_least
|
||||
---
|
||||
|
||||
{% since %}v8.4.0{% endsince %}
|
||||
|
||||
Limits a number to a minimum value.
|
||||
|
||||
Input
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
title: at_most
|
||||
---
|
||||
|
||||
{% since %}v8.4.0{% endsince %}
|
||||
|
||||
Limits a number to a maximum value.
|
||||
|
||||
Input
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
title: capitalize
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
Makes the first character of a string capitalized.
|
||||
|
||||
Input
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
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.
|
||||
|
||||
Input
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
title: compact
|
||||
---
|
||||
|
||||
{% since %}v9.22.0{% endsince %}
|
||||
|
||||
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.
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
title: concat
|
||||
---
|
||||
|
||||
{% since %}v2.0.0{% endsince %}
|
||||
|
||||
Concatenates (joins together) multiple arrays. The resulting array contains all the items from the input arrays.
|
||||
|
||||
Input
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
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].
|
||||
|
||||
Input
|
||||
@@ -14,6 +16,10 @@ Output
|
||||
Fri, Jul 17, 15
|
||||
```
|
||||
|
||||
{% note info TimeZone %}
|
||||
Date will be converted to local time before output. To avoid that, you can set `timezoneOffset` LiquidJS option to `0`, its default value is your local timezone offset which can be obtained by `new Date().getTimezoneOffset()`.
|
||||
{% endnote %}
|
||||
|
||||
Input
|
||||
```liquid
|
||||
{{ article.published_at | date: "%Y" }}
|
||||
@@ -36,6 +42,10 @@ Output
|
||||
Mar 14, 16
|
||||
```
|
||||
|
||||
{% note info Timestamp Strings %}
|
||||
Note that LiquidJS is using JavaScript [Date][newDate] to parse the input string, that means [IETF-compliant RFC 2822 timestamps](https://datatracker.ietf.org/doc/html/rfc2822#page-14) and strings in [a version of ISO8601](https://www.ecma-international.org/ecma-262/11.0/#sec-date.parse) are supported.
|
||||
{% endnote %}
|
||||
|
||||
To get the current time, pass the special word `"now"` (or `"today"`) to `date`:
|
||||
|
||||
Input
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
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`).
|
||||
|
||||
In this example, `product_price` is not defined, so the default value is used.
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
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.
|
||||
|
||||
Input
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
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.
|
||||
|
||||
Input
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
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.
|
||||
|
||||
Input
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
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.
|
||||
|
||||
Input
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
title: first
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
Returns the first item of an array.
|
||||
|
||||
Input
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
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.
|
||||
|
||||
Input
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
title: join
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
Combines the items in an array into a single string using the argument as a separator.
|
||||
|
||||
Input
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
title: json
|
||||
---
|
||||
|
||||
{% since %}v9.10.0{% endsince %}
|
||||
|
||||
Convert values to string via `JSON.stringify()`, for debug purpose.
|
||||
|
||||
Input
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
title: last
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
Returns the last item of an array.
|
||||
|
||||
Input
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
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.
|
||||
|
||||
Input
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
title: map
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
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.
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
title: minus
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
Subtracts a number from another number.
|
||||
|
||||
Input
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
title: modulo
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
Returns the remainder of a division operation.
|
||||
|
||||
Input
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
title: newline_to_br
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
Replaces every newline (`\n`) in a string with an HTML line break (`<br />`).
|
||||
|
||||
Input
|
||||
|
||||
@@ -11,7 +11,7 @@ Categories | Filters
|
||||
Math | plus, minus, modulo, times, floor, ceil, round, divided_by, abs
|
||||
String | append, prepend, capitalize, upcase, downcase, strip, lstrip, rstrip, strip_newlines, split, replace, replace_first, remove, remove_first, truncate, truncatewords
|
||||
HTML/URI | escape, escape_once, url_encode, url_decode, strip_html, newline_to_br
|
||||
Array | slice, map, sort, sort_natural, uniq, wheres, first, last, join, reverse
|
||||
Array | slice, map, sort, sort_natural, uniq, where, first, last, join, reverse, concat
|
||||
Date | date
|
||||
|
||||
[shopify/liquid]: https://github.com/Shopify/liquid
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
title: plus
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
Adds a number to another number.
|
||||
|
||||
Input
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
title: prepend
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
Adds the specified string to the beginning of another string.
|
||||
|
||||
Input
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
title: remove
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
Removes every occurrence of the specified substring from a string.
|
||||
|
||||
Input
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
title: remove_first
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
Removes only the first occurrence of the specified substring from a string.
|
||||
|
||||
Input
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
title: replace
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
Replaces every occurrence of the first argument in a string with the second argument.
|
||||
|
||||
Input
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
title: replace_first
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
Replaces only the first occurrence of the first argument in a string with the second argument.
|
||||
|
||||
Input
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
title: reverse
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
Reverses the order of the items in an array. `reverse` cannot reverse a string.
|
||||
|
||||
Input
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
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.
|
||||
|
||||
Input
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
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.
|
||||
|
||||
Input
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
title: size
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
Returns the number of characters in a string or the number of items in an array.
|
||||
|
||||
Input
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
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.
|
||||
|
||||
String indices are numbered starting from 0.
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
title: sort
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
Sorts items in an array in case-sensitive order.
|
||||
|
||||
Input
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
title: sort_natural
|
||||
---
|
||||
|
||||
{% since %}v8.4.0{% endsince %}
|
||||
|
||||
Sorts items in an array in case-insensitive order.
|
||||
|
||||
Input
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
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.
|
||||
|
||||
Input
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
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.
|
||||
|
||||
Input
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
title: strip_html
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
Removes any HTML tags from a string.
|
||||
|
||||
Input
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
title: strip_newlines
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
Removes any newline characters (line breaks) from a string.
|
||||
|
||||
Input
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
title: times
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
Multiplies a number by another number.
|
||||
|
||||
Input
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
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.
|
||||
|
||||
## Basic Usage
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
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.
|
||||
|
||||
Input
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
title: uniq
|
||||
---
|
||||
|
||||
{% since %}v1.9.1{% endsince %}
|
||||
|
||||
Removes any duplicate elements in an array.
|
||||
|
||||
Input
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
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.
|
||||
|
||||
Input
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
title: url_decode
|
||||
---
|
||||
|
||||
{% since %}v6.1.0{% endsince %}
|
||||
|
||||
Decodes a string that has been encoded as a URL.
|
||||
|
||||
Input
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user