refactor: switch Context <-> Scope concepts

This commit is contained in:
harttle
2019-03-25 10:36:23 +08:00
parent 76345a64c3
commit 45e3c2bb8e
34 changed files with 272 additions and 272 deletions
+3 -3
View File
@@ -1,7 +1,7 @@
import * as Benchmark from 'benchmark'
import Liquid from '../src/liquid'
import TagToken from '../src/parser/tag-token'
import Scope from '../src/scope/scope'
import Context from '../src/context/context'
const engine = new Liquid({
root: __dirname,
@@ -13,8 +13,8 @@ engine.registerTag('header', {
const [key, val] = token.args.split(':')
this[key] = val
},
render: function (scope: Scope) {
const title = this.liquid.evalValue(this.content, scope)
render: function (ctx: Context) {
const title = this.liquid.evalValue(this.content, ctx)
return `<h1>${title}</h1>`
}
})