refactor: merge render register into scope

This commit is contained in:
harttle
2016-11-06 15:22:29 +08:00
parent 258f4a2073
commit d7b7b1724f
8 changed files with 21 additions and 30 deletions
+6 -3
View File
@@ -26,7 +26,7 @@ var Scope = {
},
get: function(str) {
var val = this.safeGet(str);
if (val === undefined && this.opts.strict) {
if (val === undefined && this.opts.strict_variables) {
throw new Error(`[strict_variables] undefined variable: ${str}`);
}
return val;
@@ -149,9 +149,12 @@ function matchRightBracket(str, begin) {
exports.factory = function(ctx, opts) {
opts = _.assign({
strict: false,
blocks: {}
strict_variables: false,
strict_filters: false,
blocks: {},
root: []
}, opts);
ctx = _.assign(ctx, {
liquid: opts
});