docs: fix links

harttle
2019-10-14 14:56:34 +08:00
parent 09375beae8
commit 05058e022d
4 changed files with 62 additions and 10 deletions
+5 -4
@@ -35,7 +35,7 @@ echo '{{"hello" | capitalize}}' | npx liquidjs
There's [a live demo][jsfiddle] on JSFiddle, and a list of demo projects in [the demo/ directory][demo-dir]
* [JSFiddle][jsfiddle]
* [Demo for Node.js](/harttle/liquidjs/blob/master/demo/node/)
* [Demo for Node.js](/harttle/liquidjs/blob/master/demo/nodejs/)
* [Demo in TypeScript](/harttle/liquidjs/blob/master/demo/typescript/)
* [Demo for Browser Usage](/harttle/liquidjs/blob/master/demo/browser/)
* [Demo for Express.js Usage](/harttle/liquidjs/blob/master/demo/express/)
@@ -43,7 +43,7 @@ There's [a live demo][jsfiddle] on JSFiddle, and a list of demo projects in [the
## Documentation
The tutorials contains a list of articles for advanced use cases, performance optimization and extending liquidjs.
The tutorial contains a list of articles for advanced use cases, performance optimization and extending liquidjs.
* [Render a Template File](/harttle/liquidjs/wiki/Render-a-File)
* [Caching](/harttle/liquidjs/wiki/Caching)
@@ -52,7 +52,6 @@ The tutorials contains a list of articles for advanced use cases, performance op
* [Whitespace Control](/harttle/liquidjs/wiki/Whitespace-Control)
* [Register Filters/Tags](/harttle/liquidjs/wiki/Register-Filters-Tags)
* [Plugins](/harttle/liquidjs/wiki/Plugins)
* [Migrate to 9.0.0](/harttle/liquidjs/wiki/Migrate-to-9)
The [API Reference](https://harttle.github.io/liquidjs/classes/_liquid_.liquid.html) provides detailed descriptions for classes, methods and properties.
@@ -63,4 +62,6 @@ The [API Reference](https://harttle.github.io/liquidjs/classes/_liquid_.liquid.h
* [Truthy and Falsy](/harttle/liquidjs/wiki/Truthy-and-Falsy)
[jsfiddle]: https://jsfiddle.net/x43eb0z6/
[demo-dir]: https://github.com/harttle/liquidjs/tree/master/demo
[demo-dir]: https://github.com/harttle/liquidjs/tree/master/demo
[pp]: https://github.com/taylorhakes/promise-polyfill
[caniuse-promises]: http://caniuse.com/#feat=promises
+17 -2
@@ -1,3 +1,18 @@
Please refer to [the operators document](https://shopify.github.io/liquid/basics/operators/) from Shopify. Operators supported by LiquidJS are:
## Operators
`==`, `!=`, `>`, `<`, `>=`, `<=`, `or`, `and`, `contains`.
Liquid operators are very simple and different. According to the [operators document](https://shopify.github.io/liquid/basics/operators/) from Shopify, there're 2 types of operators supported:
* Comparison operators: `==`, `!=`, `>`, `<`, `>=`, `<=`
* Logic operators: `or`, `and`, `contains`
Thus numerical operators are not supported and you cannot even plus two numbers `{{a + b}}`. Actually `+` is a valid variable name.
## Precedence
The comparison operators have higher precedence than logic operators.
## Associativity
Logic operators are evaluated from right to left, see [shopify docs][operator-order].
[operator-order]: https://help.shopify.com/en/themes/liquid/basics/operators#order-of-operations
+7 -4
@@ -3,7 +3,9 @@ This article provides information about how to create and use a plugin
## Write a Plugin
We'll make a plugin to upper case every letter of the input,
A liquidjs plugin is simple function which takes the [Liquid class][liquid] as the first parameter and the Liquid instance for `this`. We can call liquidjs APIs on `this` to make certain changes, especially [register filters and tags][register].
Now we'll make a plugin to upper case every letter of the input,
save the following snippet to `upup.js`:
```javascript
@@ -32,11 +34,12 @@ engine
## Plugin List
See <https://github.com/harttle/liquidjs#differences-and-limitations>.
Since this library excludes certain features that are available on the Shopify platform but not on the [Shopify/liquid](https://github.com/Shopify/liquid/) repo, see <https://github.com/harttle/liquidjs#differences-and-limitations>.
Since this library excludes certain features that are available on the Shopify platform but not on the [Shopify/liquid](https://github.com/Shopify/liquid/) repo, see the following plugins that backfill those features:
Here's a list of plugins that backfill those features. Feel free to add yours, this file is publicly editable.
* Sections Tags (WIP): https://github.com/harttle/liquidjs-section-tags
* Color Filters: https://github.com/harttle/liquidjs-color-filters
> Feel free to add yours, this file is publicly editable.
[liquid]: https://harttle.land/liquidjs/classes/_liquid_.liquid.html
[register]: /harttle/liquidjs/wiki/Register-Filters-Tags
+33
@@ -46,6 +46,39 @@ var engine = new Liquid({
});
```
## Abstract File System
LiquidJS defines an abstract file system interface in [src/fs/ifs.ts][ifs] and the default implementation is [src/fs/node.ts][fs-node] for Node.js and [src/fs/browser.ts][fs-browser] for the browser bundle.
The `Liquid` constructor provides a [fs][fs] option to specify the file system implementation. It's supposed to be used to define customized template fetching logic, i.e. fetch template from a database table, like:
```javascript
var engine = new Liquid({
fs: {
readFileSync (file) {
return db.model('Template').findByIdSync(file).text
},
await readFile (file) {
const template = await db.model('Template').findById(file)
return template.text
},
existsSync () {
return true
},
await exists () {
return true
},
resolve(root, file, ext) {
return file
}
}
});
```
[fs]: https://harttle.land/liquidjs/interfaces/_liquid_options_.liquidoptions.html#fs
[ifs]: https://github.com/harttle/liquidjs/blob/master/src/fs/ifs.ts
[fs-node]: https://github.com/harttle/liquidjs/blob/master/src/fs/node.ts
[fs-browser]: https://github.com/harttle/liquidjs/blob/master/src/fs/browser.ts
[layout]: https://help.shopify.com/en/themes/liquid/tags/theme-tags#layout
[include]: https://help.shopify.com/themes/liquid/tags/theme-tags#include
[renderFile]: https://harttle.land/liquidjs/classes/_liquid_.liquid.html#renderfile