UNPKG

liquid-node

Version:

Node.js port of Tobias Lütke's Liquid template engine.

196 lines (132 loc) 5.84 kB
# LiquidNode Change History ## 3.0.0 - Migrated from native-or-bluebird to any-promise (thanks @swashcap). - Upgraded developer dependencies (thanks @RobLoach). ## 2.6.0 - Migrated to `native-or-bluebird` so that native Promises are used (thanks @dotnil). ## 2.5.0 - Added `include` with a file-system layer (very big thanks to @imjoshholloway). ## 2.4.0 - For-Loops now can iterate over objects (like Ruby's Hashes). ## 2.3.0 - Added `default` filter (thanks to @sebastianseilund). ## 2.2.0 - Make `assign` support filters. ## 2.1.4 - Performance optimizations. - Make `bluebird` a `peerDependency`. ## 2.1.3 - Fixed undefined properties causing exceptions (thanks to @vmira). ## 2.1.2 - Fixed `undefined variable Liquid` in join-helper. ## 2.1.1 - Removed a stray `console.log` in the library. ## 2.1.0 - Added support for `case` tag. ## 2.0.0 LiquidNode always had the `Drop` class but it never worked and it was never tested. This has changed with 2.0.0. In 1.x the template "{{ user.save }}" with the variable configuration ```javascript variables = user: save: -> # code return "ok" ``` would have called `save()` automatically and thus have rendered `ok`. This is now prevented. If you want to allow calling of functions you have to use a `Drop` now. ``` class Droplet extends Liquid.Drop save: -> "ok" ``` ## 1.2.0 - API: Some standard filters might now return `Promise`s. - ADDED: Ranges `(0..5)`/`(0..foo)` are now supported. - FIX: `{% if foo is blank/empty %}` didn't work. - FIX: `context.hasKey` didn't work. - FIX: Tokenizer now removes all empty tokens. - CHANGE: `comment` now inherits from `raw` so that inner tags are ignored. - FIX: `isnt` wasn't the opposite of `is`. - FIX: `FilterNotFound` was never raised. - FIX: Unterminated variables `{{ foo` would raise a useless error. - FIX: `truncate` filter had an off-by-1 error. - FIX: `raw` tag didn't work. ## 1.1.0 - COMPAT: Update `bluebird` dependency. ## 1.0.0 - COMPAT: Require Node.js `>=0.10`. - COMPAT: Stricter dependencies (i.e. bluebird, strftime) with `~` instead of `^`. ## 0.3.4 - ADDED: Added a `date` filter. ## 0.3.3 - ADDED: Added various standard filters (by **@dotnil**). - FIXED: `toString` helper used by filters didn't return a String in all cases. - FIXED: `undefined | my_filter:123` would output the string `my_filter:123`. - IMPROVEMENT: append and prepend filters don't use Array.join anymore. ## 0.3.2 - FIX: `capture` tag captured output as an arrays and not as a string. ## 0.3.1 - ADDED: New `engine.parseAndRender(input, args...)` that simplifies `engine.parse(input).then (t) -> t.render(args...)`. - REFACTORING: Extracted `engine.parseToken` from `engine.parse`. (API does not break) ## 0.3.0 - API: Tag constructor doesn't get `tokens` anymore. It will be passed to `parse` instead. - API: Added `beforeParse` and `afterParse` hooks to allow better sharing of code. - API: Tags can now return arrays in `render()` that will be concatenated to a string. - API: `template.parse()` and `engine.parse()` will return a Promise now. - API: `template.parse()` is now async-aware. Any Tag can do async parsing now. - API: `template.render(assigns [, options])` won't accept filters as second argument anymore. - API: Switched to `bluebird` as implementation for promises - might cause API break. - API: Tokens passed to `parse()` are now objects instead of strings with `col`, `line` and `value`. - API: `parse()` doesn't accept objects with a `source` property anymore. - API: `engine.registerFilter` is now `engine.registerFilters`. - API: `context.addFilters` is now `context.registerFilters` and now takes variadic arguments. - API: Removed `Strainer` class. - IMPROVEMENT: `Strainer`s aren't shared between `Engine`s anymore. - IMPROVEMENT: `Liquid.SyntaxError`s now include a location of the error. - IMPROVEMENT: `assign`-Tag doesn't wait on fulfillment of promise. - IMPROVEMENT: Throws errors on missing filters. - MISC: CoffeeScript is now compiled to JavaScript when a new version of LiquidNode is published. - INTERNAL: Switched to `mocha` for testing. - INTERNAL: Rewrote testing suites. - INTERNAL: Dropped dependency on `underscore`. ## 0.2.0 ### NEW: Engine In Liquid (Ruby) you register tags and additional filters at the Template class. So your project only has a single possible configuration. ```diff + var engine = new Liquid.Engine; - Liquid.Template.registerTag(...); + engine.registerTag(...); - var output = Liquid.Template.parse(templateString).renderOrRaise({ foo: 42 }); + var output = engine.parse(templateString).render({ foo: 42 }); ``` Also note that `renderOrRaise` has been removed, since `render` has been returning a promise for some time. ### CHANGE: Tag Constructors The signature of Tag-constructors changed to match `render()` signature where the "context" is passed first. ```diff - function(tagName, markup, tokens, template) { ... } + function(template, tagName, markup, tokens) { ... } ``` ### 0.1.5 Restores compatibility with 0.1.2 after 0.1.4 introduced the engine which was supposted to be release in a major (or at least minor) release. - FIXED: `blank` and `empty` had odd behaviour on non-arrays - FIXED: `[false, true] includes false` returned false - FIXED: LiquidErrors had odd behaviour when used in `instanceof` (thanks @dotnil) - IMPROVEMENT: Replaced `q.catch` and `q.fail` calls (they are deprecated). - IMPROVEMENT: context.variable() is now wrapped in `Q.fcall` - IMPROVEMENT: throw exception when somebody tries to use ranges (not implemented yet) - IMPROVEMENT: Conditions `a < b` where a and b are async are now parallelized - ADDITION: New operators `is` and `isnt` ### 0.1.4 (deprecated) ### 0.1.3 (deprecated) ### 0.1.2 Pseudo Public Release ### 0.1.1 and earlier (internal development)