tags: use scope.opts insteadof scope.get('liquid')

This commit is contained in:
harttle
2017-11-04 10:46:15 +08:00
parent 329aea6bd6
commit 4e132ca1c5
8 changed files with 79 additions and 73 deletions
+7 -9
View File
@@ -11,6 +11,9 @@ var Scope = {
return ctx
},
get: function (str) {
if (str === 'liquid') {
throw new Error('NO LONGER SUPPORTED: use scope.opts instread of scope.get("liquid")')
}
try {
return this.getPropertyByPath(this.scopes, str)
} catch (e) {
@@ -168,19 +171,14 @@ function matchRightBracket (str, begin) {
}
exports.factory = function (ctx, opts) {
opts = _.assign({
var defaultOptions = {
strict_variables: false,
strict_filters: false,
blocks: {},
root: []
}, opts)
ctx = _.assign(ctx, {
liquid: opts
})
}
var scope = Object.create(Scope)
scope.opts = opts
scope.scopes = [ctx]
scope.opts = _.assign(defaultOptions, opts)
scope.scopes = [ctx || {}]
return scope
}