Compare commits

...
150 Commits
Author SHA1 Message Date
semantic-release-bot b7c782b10a chore(release): 9.31.0 [skip ci]
# [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))
2021-12-19 14:35:13 +00:00
HarttleandHarttle 49d3f64873 docs: echo & liquid tags 2021-12-19 22:31:02 +08:00
HarttleandHarttle be3463c5f9 docs: add jg-rp as contributor 2021-12-19 21:42:46 +08:00
James PriorandJun Yang fde9924ee6 feat: implement liquid and echo tags, see #428 2021-12-19 21:09:26 +08:00
semantic-release-bot 5b2ea63b14 chore(release): 9.30.0 [skip ci]
# [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))
2021-12-18 07:31:17 +00:00
HarttleandHarttle 23279a816a feat: support jekyll-like include, see #433 2021-12-18 15:26:15 +08:00
HarttleandHarttle 2c14a9541d chore: update node to 14 for check pipeline 2021-12-12 20:10:15 +08:00
HarttleandHarttle c474649748 chore: update node to 14 on pipeline 2021-12-12 11:11:03 +08:00
HarttleandHarttle fad17cfbb3 docs: fix apidoc generation for typescript@4 2021-12-11 21:30:19 +08:00
semantic-release-bot 6322acb88c chore(release): 9.29.0 [skip ci]
# [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))
2021-12-11 12:32:58 +00:00
HarttleandHarttle 95fc705b5d chore: upgrade typescript 2021-12-11 20:23:09 +08:00
HarttleandHarttle 6801552fe6 feat: customize globals & strictVariables when calling render, see #432 2021-12-11 20:22:58 +08:00
HarttleandHarttle 6023d9ba10 docs: path traversal vulnerabilities when customizing FS 2021-12-11 12:31:08 +08:00
semantic-release-bot cc4628d804 chore(release): 9.28.6 [skip ci]
## [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))
2021-12-07 15:50:25 +00:00
HarttleandHarttle 69286c6909 test: coverage to 100% 2021-12-07 23:34:53 +08:00
HarttleandHarttle 6c114267a5 fix: size filter does not respect Objects, fixes #385 2021-12-07 23:05:46 +08:00
HarttleandHarttle e2ef236f68 fix: throws when using preserveTimezones on Node.js, fixes #431 2021-12-07 22:43:47 +08:00
semantic-release-bot 80c2280ee6 chore(release): 9.28.5 [skip ci]
## [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))
2021-11-05 19:39:58 +00:00
HarttleandHarttle 44f6b520d5 fix: always allow './' and '../' to be relative, even on windows 2021-11-06 03:36:39 +08:00
semantic-release-bot 3d71d9e35a chore(release): 9.28.4 [skip ci]
## [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))
2021-10-31 08:36:55 +00:00
AleksandrHovhannisyanandHarttle 124f4c4485 fix: allow {%render%} to reassign argument, #404 2021-10-31 16:28:33 +08:00
dependabot[bot]andJun Yang 432d1c7ccb chore(deps): bump path-parse from 1.0.6 to 1.0.7
Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/jbgutierrez/path-parse/releases)
- [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7)

---
updated-dependencies:
- dependency-name: path-parse
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
2021-10-28 00:14:13 +08:00
HarttleandHarttle 4b42e63601 docs: update liquidjs for demo/nodejs 2021-10-28 00:03:18 +08:00
semantic-release-bot f809c716eb chore(release): 9.28.3 [skip ci]
## [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))
2021-10-27 16:01:07 +00:00
HarttleandHarttle aebeae9e1b fix: relative root (by default) yields LookupError, fixes #419, #424, also related to #395 2021-10-27 23:55:39 +08:00
Harttle 564972ba74 docs: add version info in playground.html 2021-10-20 23:20:23 +08:00
semantic-release-bot d0c3cc8b47 chore(release): 9.28.2 [skip ci]
## [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))
2021-10-16 14:40:58 +00:00
Harttleandharttle b5b2a98d5e chore: fix types 2021-10-16 22:36:46 +08:00
Harttleandharttle 8894cbfe6e fix: cache ongoing parseFile() calls, fixes #416 2021-10-16 21:07:48 +08:00
semantic-release-bot c58a116513 chore(release): 9.28.1 [skip ci]
## [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))
2021-10-16 04:32:51 +00:00
Harttleandharttle d4df3a0b53 refactor: make loader.shouldLoadRelative public 2021-10-16 12:30:09 +08:00
Harttleandharttle 9cfa43b8ae fix: hardcoded '/' in normalized options.fs, fixes #412, #408
Changes including:
- will not call fs.resolve when normalizing `fs`
- removed hardcoded `/`
- mandatory `fs.dirname` for relative reference
- mandatory `fs.sep`, defaults to '/'
2021-10-16 12:10:55 +08:00
harttle df6d62fd59 docs: add @JaKXz and @dphm to contributor list, #406, #407 2021-10-15 22:57:04 +08:00
d pham (they/them)andharttle 2438f4b018 docs: typo fix an -> can 2021-10-15 22:55:22 +08:00
Jason KurianandJun Yang 8321a8e982 docs: fix async/await typos in render-file 2021-10-15 22:52:47 +08:00
Harttle 1de6adf308 test: cases for parse(<tpl>, <relative filepath>), #395 2021-10-10 20:37:26 +08:00
Harttle a525f45b46 docs: update filters order on sidebar, fixes #397 2021-10-06 19:17:33 +08:00
semantic-release-bot 529e6d769b chore(release): 9.28.0 [skip ci]
# [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))
2021-10-06 10:45:13 +00:00
Harttle 822ba0be0f fix: skip root check for renderFile() 2021-10-06 18:38:58 +08:00
Harttle a3455ebd0b feat: relativeReference for render/include/layout, #395
- `relativeReference` is enabled by default, set to `false` to disable
- Referenced files are still constrained within root/partias/layouts
- fix: relative filenames are not constrained (which allows arbitrary filesystem read)

Example Usage:

{% render "../foo/bar.html" %}

Note:

../foo/bar.html' should also be within `partials` (or `root` if `partials` not set)
2021-10-06 17:36:37 +08:00
Harttle 24a19c092a docs: add doc entry for concat filter #397 2021-10-06 16:10:09 +08:00
Harttle fd5ef474c3 fix: support timezoneOffset for date from scope, #401 2021-10-06 15:45:41 +08:00
Harttleandharttle 4f6b88c154 docs: add @bglw as contributor 2021-10-04 21:37:37 +08:00
Liam BigelowandJun Yang 6dc7fada72 feat: implement forloop.name as found in ruby shopify/liquid 2021-10-04 21:33:46 +08:00
semantic-release-bot 3b9c7d6fbe chore(release): 9.27.1 [skip ci]
## [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))
2021-10-04 04:16:07 +00:00
Harttle 92bfc65e0b fix: directory info in lookupError message, #395 2021-10-04 12:11:54 +08:00
semantic-release-bot 8348036d45 chore(release): 9.27.0 [skip ci]
# [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))
2021-10-03 14:41:57 +00:00
harttle afeef1d745 fix: renderToNodeStream() now emit 'error' event instead of throw 2021-10-03 22:32:00 +08:00
harttle 3b5eb6664f fix: remove "stream" dependency in browser bundles, #396 2021-10-03 21:21:35 +08:00
harttle 68c4cfcfb6 feat: renderFileToNodeStream(filepath, scope) 2021-10-03 21:21:25 +08:00
harttle dd325362f9 chore: perf check, will fail if regression > 3% 2021-10-03 19:07:51 +08:00
harttle b9ae479b65 feat: add layouts, partials apart from root, #395 2021-10-03 18:51:14 +08:00
harttle 0cb520d2d1 chore: perf diff against latest release 2021-10-02 22:17:03 +08:00
Harttle 1689576913 docs: add @n1ru4l and @mattvague to contributors for doc 2021-10-01 19:21:03 +08:00
Harttleandharttle aea34418de perf: make the most of streamed rendering 2021-10-01 18:36:57 +08:00
Harttleandharttle 4358c9630f test: coverage to 100% 2021-10-01 15:55:31 +08:00
Harttleandharttle 9a96b4aba3 docs: update badges 2021-10-01 12:39:02 +08:00
Harttleandharttle 70fdb7af48 chore: try fix ci 2021-10-01 00:52:51 +08:00
semantic-release-bot 5099597634 chore(release): 9.26.0 [skip ci]
# [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))
2021-09-30 15:57:39 +00:00
Harttleandharttle d742de79ba docs: update docs for website 2021-09-30 23:52:26 +08:00
Harttleandharttle f0e2e07f0b docs: add @c412216887 and @labnol for docs, see #393 #394 2021-09-30 22:33:52 +08:00
一饮一啄皆是人生andJun Yang 4e5dbe120d Update upcase.md
upcase中文描述中,应该是 对已经是大写的字符没有影响
2021-09-30 22:18:10 +08:00
Amit AgarwalandJun Yang 6a1db537d2 Typo fixed
Staring -> Starring
2021-09-30 22:17:46 +08:00
dependabot[bot]andJun Yang 9517f82caf chore(deps): bump prismjs from 1.24.0 to 1.25.0 in /docs
Bumps [prismjs](https://github.com/PrismJS/prism) from 1.24.0 to 1.25.0.
- [Release notes](https://github.com/PrismJS/prism/releases)
- [Changelog](https://github.com/PrismJS/prism/blob/master/CHANGELOG.md)
- [Commits](https://github.com/PrismJS/prism/compare/v1.24.0...v1.25.0)

---
updated-dependencies:
- dependency-name: prismjs
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
2021-09-30 22:16:34 +08:00
HarttleandJun Yang 10e8c8ff7e feat: orderedFilterParameters, closes #312 2021-09-30 22:15:09 +08:00
Steve StedmanandJun Yang fb787e8847 Fix: respect parameter order when using "for ... reversed" (#231)
* fix: spelling

* fix: respect param order for reversed

* docs: add for-reversed order details

* perf: improve performance by 4x by simplified parseFile

BREAKING CHANGES:
- previously deprecated `getTemplate()` and `getTemplateSync()` not no longer supported
- `opts` no longer support dynamic set in `parseFile()`, `renderFile()` arguments

* perf: parse filenames in parse() insteadof render()

* docs: update description of LiquidJS

Co-authored-by: harttle <[email protected]>
2021-09-30 22:15:09 +08:00
HarttleandJun Yang 9012133e07 feat: stream rendering, closed #361 fixes #360 2021-09-30 22:15:09 +08:00
harttle abaf4af465 docs: update description of LiquidJS 2021-09-30 22:15:09 +08:00
harttle 8273c17dab perf: parse filenames in parse() insteadof render() 2021-09-30 22:15:09 +08:00
harttle 24f5346084 perf: improve performance by 4x by simplified parseFile
- previously deprecated `getTemplate()` and `getTemplateSync()` not no longer supported
- `opts` no longer support dynamic set in `parseFile()`, `renderFile()` arguments
2021-09-27 23:04:41 +08:00
Harttleandharttle 6b9f872bcc feat: timezoneOffset option to specify output timezone, see #375 2021-09-27 01:54:31 +08:00
dependabot[bot]andJun Yang 91c721e650 chore(deps): bump path-parse from 1.0.6 to 1.0.7 in /docs
Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/jbgutierrez/path-parse/releases)
- [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7)

---
updated-dependencies:
- dependency-name: path-parse
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
2021-09-26 20:44:44 +08:00
dependabot[bot]andJun Yang 500d397a5a chore(deps): bump prismjs from 1.23.0 to 1.24.0 in /docs
Bumps [prismjs](https://github.com/PrismJS/prism) from 1.23.0 to 1.24.0.
- [Release notes](https://github.com/PrismJS/prism/releases)
- [Changelog](https://github.com/PrismJS/prism/blob/master/CHANGELOG.md)
- [Commits](https://github.com/PrismJS/prism/compare/v1.23.0...v1.24.0)

---
updated-dependencies:
- dependency-name: prismjs
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
2021-07-26 16:52:01 +08:00
harttle 2e004eddf6 docs: add @ilhamdev0 as contributors 2021-07-26 16:40:03 +08:00
ilhamdev0andJun Yang e3bfe86181 Update layout.md 2021-07-25 23:19:10 +08:00
ilhamdev0andJun Yang 804947ebb9 Update layout.md
Fix typo
2021-07-25 23:19:10 +08:00
Raymond CamdenandJun Yang 4fa5313acc Update options.md
Fix typo
2021-07-24 14:23:26 +08:00
harttle f7313fe563 docs: support data field in playground.html 2021-06-20 21:26:16 +08:00
semantic-release-bot 1c64ff051e chore(release): 9.25.1 [skip ci]
## [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))
2021-06-20 06:23:36 +00:00
harttle c470d1fe9b chore: migrate from Travis CI to Github Actions 2021-06-20 14:21:34 +08:00
harttle cdceb25d00 perf: add cross-engines benchmark 2021-06-20 13:25:08 +08:00
dependabot[bot]andJun Yang cc9b28307c chore(deps): bump striptags from 3.1.1 to 3.2.0 in /docs
Bumps [striptags](https://github.com/ericnorris/striptags) from 3.1.1 to 3.2.0.
- [Release notes](https://github.com/ericnorris/striptags/releases)
- [Commits](https://github.com/ericnorris/striptags/compare/v3.1.1...v3.2.0)

---
updated-dependencies:
- dependency-name: striptags
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
2021-06-19 12:10:02 +08:00
dependabot[bot]andJun Yang f2ddd6e459 chore(deps): bump glob-parent from 5.1.1 to 5.1.2 in /docs
Bumps [glob-parent](https://github.com/gulpjs/glob-parent) from 5.1.1 to 5.1.2.
- [Release notes](https://github.com/gulpjs/glob-parent/releases)
- [Changelog](https://github.com/gulpjs/glob-parent/blob/main/CHANGELOG.md)
- [Commits](https://github.com/gulpjs/glob-parent/compare/v5.1.1...v5.1.2)

---
updated-dependencies:
- dependency-name: glob-parent
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
2021-06-12 16:42:19 +08:00
dependabot[bot]andJun Yang ecc40a6012 chore(deps): bump normalize-url from 4.3.0 to 4.5.1
Bumps [normalize-url](https://github.com/sindresorhus/normalize-url) from 4.3.0 to 4.5.1.
- [Release notes](https://github.com/sindresorhus/normalize-url/releases)
- [Commits](https://github.com/sindresorhus/normalize-url/commits)

---
updated-dependencies:
- dependency-name: normalize-url
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
2021-06-12 16:42:08 +08:00
dependabot[bot]andJun Yang 659cfde8e1 chore(deps): bump ws from 6.2.1 to 6.2.2
Bumps [ws](https://github.com/websockets/ws) from 6.2.1 to 6.2.2.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/commits)

---
updated-dependencies:
- dependency-name: ws
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
2021-06-08 21:35:56 +08:00
dependabot[bot]andJun Yang 0acfb8de4d chore(deps): bump hosted-git-info from 2.7.1 to 2.8.9
Bumps [hosted-git-info](https://github.com/npm/hosted-git-info) from 2.7.1 to 2.8.9.
- [Release notes](https://github.com/npm/hosted-git-info/releases)
- [Changelog](https://github.com/npm/hosted-git-info/blob/v2.8.9/CHANGELOG.md)
- [Commits](https://github.com/npm/hosted-git-info/compare/v2.7.1...v2.8.9)

Signed-off-by: dependabot[bot] <[email protected]>
2021-05-09 20:04:52 +08:00
dependabot[bot]andJun Yang c4b2bfb29b chore(deps): bump lodash from 4.17.19 to 4.17.21 in /docs
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.19 to 4.17.21.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.19...4.17.21)

Signed-off-by: dependabot[bot] <[email protected]>
2021-05-07 22:36:25 +08:00
semantic-release-bot 0d41f7467e chore(release): 9.25.0 [skip ci]
# [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))
2021-05-07 06:03:44 +00:00
dependabot[bot]andJun Yang 1d35e3fcfb chore(deps): bump handlebars from 4.5.3 to 4.7.7
Bumps [handlebars](https://github.com/wycats/handlebars.js) from 4.5.3 to 4.7.7.
- [Release notes](https://github.com/wycats/handlebars.js/releases)
- [Changelog](https://github.com/handlebars-lang/handlebars.js/blob/master/release-notes.md)
- [Commits](https://github.com/wycats/handlebars.js/compare/v4.5.3...v4.7.7)

Signed-off-by: dependabot[bot] <[email protected]>
2021-05-07 14:00:30 +08:00
dependabot[bot]andJun Yang 04c874b174 chore(deps): bump underscore from 1.9.1 to 1.13.1
Bumps [underscore](https://github.com/jashkenas/underscore) from 1.9.1 to 1.13.1.
- [Release notes](https://github.com/jashkenas/underscore/releases)
- [Commits](https://github.com/jashkenas/underscore/compare/1.9.1...1.13.1)

Signed-off-by: dependabot[bot] <[email protected]>
2021-05-07 14:00:01 +08:00
allcontributors[bot]andJun Yang 29f42847a5 docs: update .all-contributorsrc [skip ci] 2021-05-06 22:53:24 +08:00
allcontributors[bot]andJun Yang 426863a9b4 docs: update README.md [skip ci] 2021-05-06 22:53:24 +08:00
Memmie LengletandJun Yang 8f9639f1d6 feat: when tag with multiple values 2021-05-06 22:52:22 +08:00
semantic-release-bot 3e130e01a7 chore(release): 9.24.2 [skip ci]
## [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))
2021-05-04 10:16:44 +00:00
Jun Yang 3e3d84a5ed fix: operator boundary not correctly recognized, fixes #342 2021-05-04 18:13:02 +08:00
dependabot[bot]andJun Yang 69f1a394b1 chore(deps): bump ssri from 6.0.1 to 6.0.2
Bumps [ssri](https://github.com/npm/ssri) from 6.0.1 to 6.0.2.
- [Release notes](https://github.com/npm/ssri/releases)
- [Changelog](https://github.com/npm/ssri/blob/v6.0.2/CHANGELOG.md)
- [Commits](https://github.com/npm/ssri/compare/v6.0.1...v6.0.2)

Signed-off-by: dependabot[bot] <[email protected]>
2021-05-02 15:28:15 +08:00
semantic-release-bot ae8636d95d chore(release): 9.24.1 [skip ci]
## [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))
2021-05-01 12:03:18 +00:00
Laurin QuastandJun Yang 1fd76acf28 fix: make LiquidError context property public 2021-05-01 20:00:02 +08:00
semantic-release-bot 62f8f707e9 chore(release): 9.24.0 [skip ci]
# [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))
2021-05-01 11:11:01 +00:00
Laurin QuastandJun Yang 9c7cb5752b feat: add context as a property on the LiquidError error 2021-05-01 19:07:40 +08:00
Laurin QuastandJun Yang 4e394b9072 feat: export errors for better error handling in user-land 2021-05-01 19:06:33 +08:00
Jun Yang 251a50801c chore: dev via windows+vscode 2021-04-17 11:43:03 +08:00
semantic-release-bot aa5d63fdf7 chore(release): 9.23.4 [skip ci]
## [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))
2021-04-17 02:41:31 +00:00
Jun Yang 65487654c4 fix: capitalize filter not lower case trailing string, fixes #326 2021-04-17 10:30:57 +08:00
allcontributors[bot]andJun Yang 8bab7957da docs: update .all-contributorsrc [skip ci] 2021-04-17 10:21:19 +08:00
allcontributors[bot]andJun Yang 666df5a8e6 docs: update README.md [skip ci] 2021-04-17 10:21:19 +08:00
congandJun Yang a4aa9ba0d6 FIX: remove unnecessary code 2021-04-17 10:19:22 +08:00
congandJun Yang f5f54c82bf modified title using passed in variable 2021-04-17 10:19:22 +08:00
congandJun Yang 28f154554b added tsconfig.json 2021-04-17 10:19:22 +08:00
congandJun Yang 2bc03d6a01 added typescript and @types/node packages 2021-04-17 10:19:22 +08:00
ZCandJun Yang 354a971b9e Revert change to line 17
The original is fine, emitter is not needed.
2021-04-17 10:18:39 +08:00
ZCandJun Yang b41be92dfd Update register-filters-tags.md 2021-04-17 10:18:39 +08:00
ZCandJun Yang bad12ea936 Register tags documentation example updated 2021-04-17 10:18:39 +08:00
dependabot[bot]andJun Yang b5a22fa091 chore(deps): bump y18n from 4.0.0 to 4.0.1 in /docs
Bumps [y18n](https://github.com/yargs/y18n) from 4.0.0 to 4.0.1.
- [Release notes](https://github.com/yargs/y18n/releases)
- [Changelog](https://github.com/yargs/y18n/blob/master/CHANGELOG.md)
- [Commits](https://github.com/yargs/y18n/commits)

Signed-off-by: dependabot[bot] <[email protected]>
2021-04-03 00:01:54 +08:00
dependabot[bot]andJun Yang 7d92f25cbb chore(deps): bump y18n from 3.2.1 to 3.2.2
Bumps [y18n](https://github.com/yargs/y18n) from 3.2.1 to 3.2.2.
- [Release notes](https://github.com/yargs/y18n/releases)
- [Changelog](https://github.com/yargs/y18n/blob/master/CHANGELOG.md)
- [Commits](https://github.com/yargs/y18n/commits)

Signed-off-by: dependabot[bot] <[email protected]>
2021-04-03 00:01:01 +08:00
harttle 4584867b65 docs: clarification on how to disable tags/filters, see #324 2021-03-21 22:30:53 +08:00
harttle 695e3c18bc docs: add versions to tags/filters, see #305 2021-03-21 22:17:17 +08:00
semantic-release-bot 2133ed20d7 chore(release): 9.23.3 [skip ci]
## [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))
2021-03-21 11:32:39 +00:00
Matt Vagueandharttle dbc23e8b04 fix: expose TokenKind 2021-03-21 19:29:00 +08:00
semantic-release-bot 1acace5a16 chore(release): 9.23.2 [skip ci]
## [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))
2021-03-13 09:17:50 +00:00
Jun Yang 9a9b792c63 fix: newline_to_br filter should output <br /> instead of <br/>, fixes #320 2021-03-13 17:14:10 +08:00
Jun Yang 99d14e76d7 fix: comparison for empty/nil, fixes #321 2021-03-13 17:14:08 +08:00
dependabot[bot]andJun Yang aff9976042 chore(deps): bump pug-code-gen from 2.0.2 to 2.0.3 in /docs
Bumps [pug-code-gen](https://github.com/pugjs/pug) from 2.0.2 to 2.0.3.
- [Release notes](https://github.com/pugjs/pug/releases)
- [Commits](https://github.com/pugjs/pug/compare/[email protected]@2.0.3)

Signed-off-by: dependabot[bot] <[email protected]>
2021-03-09 22:47:42 +08:00
dependabot[bot]andJun Yang cd8cb39329 chore(deps): bump prismjs from 1.21.0 to 1.23.0 in /docs
Bumps [prismjs](https://github.com/PrismJS/prism) from 1.21.0 to 1.23.0.
- [Release notes](https://github.com/PrismJS/prism/releases)
- [Changelog](https://github.com/PrismJS/prism/blob/master/CHANGELOG.md)
- [Commits](https://github.com/PrismJS/prism/compare/v1.21.0...v1.23.0)

Signed-off-by: dependabot[bot] <[email protected]>
2021-03-09 22:47:32 +08:00
dependabot[bot]andJun Yang 9ed3b98db3 chore(deps): bump elliptic from 6.5.3 to 6.5.4
Bumps [elliptic](https://github.com/indutny/elliptic) from 6.5.3 to 6.5.4.
- [Release notes](https://github.com/indutny/elliptic/releases)
- [Commits](https://github.com/indutny/elliptic/compare/v6.5.3...v6.5.4)

Signed-off-by: dependabot[bot] <[email protected]>
2021-03-09 22:47:23 +08:00
semantic-release-bot 151ff4cbf3 chore(release): 9.23.1 [skip ci]
## [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))
2021-02-19 15:29:27 +00:00
harttle 2e66e8b02e fix: lenientIf not working for the umd bundle, closes #313 2021-02-19 23:10:15 +08:00
semantic-release-bot 24306722ec chore(release): 9.23.0 [skip ci]
# [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))
2021-02-12 14:28:02 +00:00
harttle 2f059f6a25 feat: support filters in if/unless/case, see #287 2021-02-12 22:22:41 +08:00
harttle 4e82da689e fix: respect fs in parser options, for #233 2021-02-12 15:17:21 +08:00
harttle e37824fd8a feat: support function calls, closes #222 2021-02-12 13:47:30 +08:00
harttle 81e11bb9c4 feat: support layout none, closes #299 2021-02-12 01:57:30 +08:00
semantic-release-bot 71d5d24813 chore(release): 9.22.1 [skip ci]
## [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))
2021-02-05 16:00:50 +00:00
Jason EtcovitchandJun Yang 20f559e545 fix: default to precedence 1 for custom operators 2021-02-05 23:57:36 +08:00
harttle dce75a1a22 docs: fix get started code block 2021-02-05 09:48:28 +08:00
semantic-release-bot 93ec151374 chore(release): 9.22.0 [skip ci]
# [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))
2021-02-04 14:52:00 +00:00
Peter deHaanandJun Yang 29db1bb0e2 Update sidebar.yml
Add `compact` filter to sidebar nav.
2021-02-04 22:48:02 +08:00
harttle f42c217fc0 feat: compact filter 2021-02-04 22:47:34 +08:00
semantic-release-bot ec4a711e00 chore(release): 9.21.0 [skip ci]
# [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))
2021-02-04 13:51:46 +00:00
Peter deHaanandJun Yang 03893d585e Typo: 'where' filter on filters/overview.md 2021-02-04 21:48:28 +08:00
allcontributors[bot]andJun Yang 3b97c38ee5 docs: update .all-contributorsrc [skip ci] 2021-02-04 09:12:26 +08:00
allcontributors[bot]andJun Yang 48a876db49 docs: update README.md [skip ci] 2021-02-04 09:12:26 +08:00
Jason EtcovitchandJun Yang befc33c4eb feat: create trie programmatically in options 2021-02-04 09:11:28 +08:00
Jason EtcovitchandJun Yang 8734e2e6ce feat: rename to defaultOperators and Operators 2021-02-04 09:11:28 +08:00
Jason EtcovitchandJun Yang 18055c8855 test: add LiquidOptions#operators test 2021-02-04 09:11:28 +08:00
Jason EtcovitchandJun Yang 6a7c280f04 feat: export Operators from operator.ts 2021-02-04 09:11:28 +08:00
Jason EtcovitchandJun Yang bc87e19e3e feat: export OperatorMap type 2021-02-04 09:11:28 +08:00
Jason EtcovitchandJun Yang 75591cdbfc feat: add operators option for custom operators 2021-02-04 09:11:28 +08:00
semantic-release-bot 5901611af5 chore(release): 9.20.1 [skip ci]
## [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))
2021-01-24 04:52:24 +00:00
harttle 9c40da7369 fix: allow string literals contain delimiters, fixes #288 2021-01-24 12:49:19 +08:00
322 changed files with 16785 additions and 8066 deletions
+117
View File
@@ -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,
+30
View File
@@ -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
+37
View File
@@ -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
+4
View File
@@ -0,0 +1,4 @@
module.exports = {
require: "ts-node/register/transpile-only",
reporter: "spec"
}
+4
View File
@@ -0,0 +1,4 @@
{
"exclude": ["dist", "test"],
"reporter": ["html", "lcov"]
}
-28
View File
@@ -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
View File
@@ -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)
+60 -50
View File
@@ -1,18 +1,12 @@
# liquidjs
[![npm version](https://img.shields.io/npm/v/liquidjs.svg)](https://www.npmjs.org/package/liquidjs)
[![npm downloads](https://img.shields.io/npm/dm/liquidjs.svg)](https://www.npmjs.org/package/liquidjs)
[![coveralls coverage](https://img.shields.io/coveralls/harttle/liquidjs.svg)](https://coveralls.io/github/harttle/liquidjs?branch=master)
[![travis Build Status](https://travis-ci.org/harttle/liquidjs.svg?branch=master)](https://travis-ci.org/harttle/liquidjs)
[![GitHub issues](https://img.shields.io/github/issues-closed/harttle/liquidjs.svg)](https://github.com/harttle/liquidjs/issues)
[![GitHub contributors](https://img.shields.io/github/contributors/harttle/liquidjs.svg)](https://github.com/harttle/liquidjs/graphs/contributors)
[![Open Collective contributors](https://img.shields.io/opencollective/all/liquidjs)](https://opencollective.com/liquidjs)
[![David dependencies](https://img.shields.io/david/harttle/liquidjs.svg)](https://david-dm.org/harttle/liquidjs)
[![David devDependencies](https://img.shields.io/david/dev/harttle/liquidjs.svg)](https://david-dm.org/harttle/liquidjs?type=dev)
[![DUB license](https://img.shields.io/dub/l/vibe-d.svg)](https://github.com/harttle/liquidjs/blob/master/LICENSE)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#commits)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/harttle/liquidjs)
[![npm version](https://img.shields.io/npm/v/liquidjs.svg?logo=npm&style=flat-square)](https://www.npmjs.org/package/liquidjs)
[![npm downloads](https://img.shields.io/npm/dm/liquidjs.svg?style=flat-square)](https://www.npmjs.org/package/liquidjs)
[![Coverage](https://img.shields.io/coveralls/harttle/liquidjs.svg?style=flat-square)](https://coveralls.io/github/harttle/liquidjs?branch=master)
[![Build Status](https://img.shields.io/github/workflow/status/harttle/liquidjs/Check/master.svg?style=flat-square)](https://github.com/harttle/liquidjs/actions/workflows/check.yml?query=branch%3Amaster)
[![DUB license](https://img.shields.io/dub/l/vibe-d.svg?style=flat-square)](https://github.com/harttle/liquidjs/blob/master/LICENSE)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)](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/
+31
View File
@@ -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 }
+28
View File
@@ -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
View File
@@ -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)
+50
View File
@@ -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)
+17
View File
@@ -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 }
+33
View File
@@ -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)
}
+3
View File
@@ -0,0 +1,3 @@
const { createEngine } = require('./create-liquid')
module.exports = createEngine(require('../../dist/liquid.node.cjs'))
+20
View File
@@ -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))
}
}
+30
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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}}'))
+3380
View File
File diff suppressed because it is too large Load Diff
+23
View File
@@ -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
View File
@@ -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 %}'))
+1
View File
@@ -0,0 +1 @@
<img title="risus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices" src="http://images.example.com/{{id}}.png">
+1
View File
@@ -0,0 +1 @@
<img title="risus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices" src="http://images.example.com/{{id}}.png">
+1
View File
@@ -0,0 +1 @@
<img title="risus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices" src="http://images.example.com/{{todo.id}}.png">
+44
View File
@@ -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>
+57
View File
@@ -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>
}
+5 -10
View File
@@ -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>
+44
View File
@@ -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
View File
@@ -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
+15
View File
@@ -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/"/\&quot;/g' \
-e '1 s/</\&lt;/g' \
-e '1 s/>/\&gt;/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
View File
@@ -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/"/\&quot;/g' \
-e '1 s/</\&lt;/g' \
-e '1 s/>/\&gt;/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
+16
View File
@@ -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
View File
@@ -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()
+1 -1
View File
@@ -7,6 +7,6 @@
"start": "node index.js"
},
"dependencies": {
"liquidjs": "*"
"liquidjs": "^9.28.3"
}
}
+1
View File
@@ -0,0 +1 @@
<li>{{index}} - {{todo}}</li>
+1 -1
View File
@@ -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>
+6 -2
View File
@@ -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 -1
View File
@@ -1,4 +1,4 @@
{%header content: "welcome to liquid" | capitalize%}
{%header content: title | capitalize%}
<ul>
{% for todo in todos %}
+7
View File
@@ -0,0 +1,7 @@
{
"compilerOptions": {
"types": [
"node"
]
}
}
View File
+1 -1
View File
@@ -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
+5668 -566
View File
File diff suppressed because it is too large Load Diff
+6 -5
View File
@@ -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"
+6 -1
View File
@@ -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, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#39;')
return content
})
+6 -2
View File
@@ -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)
+6 -6
View File
@@ -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.'
+5 -1
View File
@@ -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
View File
@@ -2,6 +2,8 @@
title: abs
---
{% since %}v1.9.1{% endsince %}
Liquid filter that returns the absolute value of a number.
Input
+2
View File
@@ -2,6 +2,8 @@
title: append
---
{% since %}v1.9.1{% endsince %}
Concatenates two strings and returns the concatenated value.
Input
+2
View File
@@ -2,6 +2,8 @@
title: at_least
---
{% since %}v8.4.0{% endsince %}
Limits a number to a minimum value.
Input
+2
View File
@@ -2,6 +2,8 @@
title: at_most
---
{% since %}v8.4.0{% endsince %}
Limits a number to a maximum value.
Input
+2
View File
@@ -2,6 +2,8 @@
title: capitalize
---
{% since %}v1.9.1{% endsince %}
Makes the first character of a string capitalized.
Input
+2
View File
@@ -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
View File
@@ -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
View File
@@ -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
+10
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -2,6 +2,8 @@
title: first
---
{% since %}v1.9.1{% endsince %}
Returns the first item of an array.
Input
+2
View File
@@ -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
View File
@@ -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
View File
@@ -2,6 +2,8 @@
title: json
---
{% since %}v9.10.0{% endsince %}
Convert values to string via `JSON.stringify()`, for debug purpose.
Input
+2
View File
@@ -2,6 +2,8 @@
title: last
---
{% since %}v1.9.1{% endsince %}
Returns the last item of an array.
Input
+2
View File
@@ -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
View File
@@ -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
View File
@@ -2,6 +2,8 @@
title: minus
---
{% since %}v1.9.1{% endsince %}
Subtracts a number from another number.
Input
+2
View File
@@ -2,6 +2,8 @@
title: modulo
---
{% since %}v1.9.1{% endsince %}
Returns the remainder of a division operation.
Input
+2
View File
@@ -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
+1 -1
View File
@@ -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
View File
@@ -2,6 +2,8 @@
title: plus
---
{% since %}v1.9.1{% endsince %}
Adds a number to another number.
Input
+2
View File
@@ -2,6 +2,8 @@
title: prepend
---
{% since %}v1.9.1{% endsince %}
Adds the specified string to the beginning of another string.
Input
+2
View File
@@ -2,6 +2,8 @@
title: remove
---
{% since %}v1.9.1{% endsince %}
Removes every occurrence of the specified substring from a string.
Input
+2
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -2,6 +2,8 @@
title: sort
---
{% since %}v1.9.1{% endsince %}
Sorts items in an array in case-sensitive order.
Input
+2
View File
@@ -2,6 +2,8 @@
title: sort_natural
---
{% since %}v8.4.0{% endsince %}
Sorts items in an array in case-insensitive order.
Input
+2
View File
@@ -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
View File
@@ -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
View File
@@ -2,6 +2,8 @@
title: strip_html
---
{% since %}v1.9.1{% endsince %}
Removes any HTML tags from a string.
Input
+2
View File
@@ -2,6 +2,8 @@
title: strip_newlines
---
{% since %}v1.9.1{% endsince %}
Removes any newline characters (line breaks) from a string.
Input
+2
View File
@@ -2,6 +2,8 @@
title: times
---
{% since %}v1.9.1{% endsince %}
Multiplies a number by another number.
Input
+2
View File
@@ -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
View File
@@ -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
View File
@@ -2,6 +2,8 @@
title: uniq
---
{% since %}v1.9.1{% endsince %}
Removes any duplicate elements in an array.
Input
+2
View File
@@ -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
View File
@@ -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