fix include scope.blocks bleeding

This commit is contained in:
harttle
2016-11-06 14:57:48 +08:00
parent c100a2e25e
commit 258f4a2073
9 changed files with 95 additions and 52 deletions
+1
View File
@@ -3,6 +3,7 @@ const Promise = require('any-promise');
const mapSeries = require('./util/promise.js').mapSeries;
const RenderBreak = require('./util/error.js').RenderBreak;
const assert = require('./util/assert.js');
const _ = require('./util/underscore.js');
var render = {
+7 -3
View File
@@ -147,13 +147,17 @@ function matchRightBracket(str, begin) {
return -1;
}
exports.factory = function(_ctx, opts) {
exports.factory = function(ctx, opts) {
opts = _.assign({
strict: false
strict: false,
blocks: {}
}, opts);
ctx = _.assign(ctx, {
liquid: opts
});
var scope = Object.create(Scope);
scope.opts = opts;
scope.scopes = [_ctx || {}];
scope.scopes = [ctx];
return scope;
};
+8
View File
@@ -37,7 +37,15 @@ function isArray(value) {
return value instanceof Array;
}
function echo(prefix){
return v => {
console.log('[' + prefix + ']', v);
return v;
};
}
exports.isString = isString;
exports.isArray = isArray;
exports.forOwn = forOwn;
exports.assign = assign;
exports.echo = echo;