mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-15 12:20:40 -07:00
render undefined to ''
This commit is contained in:
@@ -102,9 +102,7 @@ Footer
|
||||
* It's possible to define multiple blocks.
|
||||
* block name is optional when there's only one block.
|
||||
|
||||
## Extension
|
||||
|
||||
Register Filters:
|
||||
## Register Filters
|
||||
|
||||
```javascript
|
||||
// Usage: {{ name | uppper }}
|
||||
@@ -115,7 +113,7 @@ engine.registerFilter('upper', function(v){
|
||||
|
||||
> See existing filter implementations: <https://github.com/harttle/shopify-liquid/blob/master/filters.js>
|
||||
|
||||
Register Tags:
|
||||
## Register Tags
|
||||
|
||||
```javascript
|
||||
// Usage: {% upper name%}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "shopify-liquid",
|
||||
"version": "1.1.7",
|
||||
"version": "1.1.8",
|
||||
"description": "A Shopify Liquid Implementation in Node.js",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ var render = {
|
||||
break;
|
||||
case 'output':
|
||||
var val = this.evalOutput(template, scope);
|
||||
html += stringify(val);
|
||||
html += val === undefined ? '' : stringify(val);
|
||||
}
|
||||
});
|
||||
return html;
|
||||
|
||||
@@ -32,6 +32,9 @@ describe('liquid', function() {
|
||||
it('should output array', function() {
|
||||
engine.parseAndRender('{{arr}}', ctx).should.equal('[-2,"a"]');
|
||||
});
|
||||
it('should output undefined to empty', function() {
|
||||
engine.parseAndRender('foo{{zzz}}bar', ctx).should.equal('foobar');
|
||||
});
|
||||
it('should parse html', function() {
|
||||
(function() {
|
||||
engine.parse('{{obj}}');
|
||||
|
||||
Reference in New Issue
Block a user