diff --git a/package.json b/package.json index eb489c0c5..3e6c184ed 100755 --- a/package.json +++ b/package.json @@ -112,7 +112,7 @@ "is-glob": "^4.0.3", "iso-639-1": "^2.1.15", "kleur": "^4.1.5", - "liquidjs": "9.41.0", + "liquidjs": "^10.2.0", "lodash": "^4.17.21", "luxon": "^3.1.0", "markdown-it": "^13.0.1", diff --git a/src/Engines/Liquid.js b/src/Engines/Liquid.js index 876d5c1fb..e20c5ce06 100644 --- a/src/Engines/Liquid.js +++ b/src/Engines/Liquid.js @@ -145,19 +145,19 @@ class Liquid extends TemplateEngine { this.name = tagToken.name; this.args = tagToken.args; }, - render: function* (ctx) { + render: function* (ctx, emitter) { let rawArgs = Liquid.parseArguments(_t.argLexer, this.args); let argArray = []; for (let arg of rawArgs) { - let b = yield liquidEngine.evalValue(arg, ctx); + let b = yield liquidEngine.evalValue(arg, ctx.environments); argArray.push(b); } - let ret = shortcodeFn.call( + let ret = yield shortcodeFn.call( Liquid._normalizeShortcodeScope(ctx), ...argArray ); - yield ret; + // emitter.write(ret); return ret; }, }; @@ -183,11 +183,11 @@ class Liquid extends TemplateEngine { stream.start(); }, - render: function* (ctx) { + render: function* (ctx, emitter) { let rawArgs = Liquid.parseArguments(_t.argLexer, this.args); let argArray = []; for (let arg of rawArgs) { - let b = yield liquidEngine.evalValue(arg, ctx); + let b = yield liquidEngine.evalValue(arg, ctx.environments); argArray.push(b); } @@ -196,12 +196,12 @@ class Liquid extends TemplateEngine { ctx ); - let ret = shortcodeFn.call( + let ret = yield shortcodeFn.call( Liquid._normalizeShortcodeScope(ctx), html, ...argArray ); - yield ret; + // emitter.write(ret); return ret; }, }; diff --git a/src/Plugins/RenderPlugin.js b/src/Plugins/RenderPlugin.js index 0e052ab51..6dd218c8e 100644 --- a/src/Plugins/RenderPlugin.js +++ b/src/Plugins/RenderPlugin.js @@ -166,7 +166,7 @@ function EleventyPlugin(eleventyConfig, options = {}) { let rawArgs = Liquid.parseArguments(null, this.args); let argArray = []; for (let arg of rawArgs) { - let b = yield liquidEngine.evalValue(arg, ctx); + let b = yield liquidEngine.evalValue(arg, ctx.environments); argArray.push(b); } diff --git a/test/TemplateRenderLiquidTest.js b/test/TemplateRenderLiquidTest.js index a45f6decc..a6f9f8e3b 100644 --- a/test/TemplateRenderLiquidTest.js +++ b/test/TemplateRenderLiquidTest.js @@ -230,8 +230,8 @@ test("Liquid Custom Tag prefixWithZach", async (t) => { parse: function (tagToken, remainTokens) { this.str = tagToken.args; // name }, - render: function (scope, hash) { - var str = liquidEngine.evalValueSync(this.str, scope); // 'alice' + render: function (ctx, hash) { + var str = liquidEngine.evalValueSync(this.str, ctx.environments); // 'alice' return Promise.resolve("Zach" + str); // 'Alice' }, }; @@ -250,8 +250,8 @@ test("Liquid Custom Tag postfixWithZach", async (t) => { parse: function (tagToken, remainTokens) { this.str = tagToken.args; }, - render: async function (scope, hash) { - var str = await liquidEngine.evalValue(this.str, scope); + render: async function (ctx, hash) { + var str = await liquidEngine.evalValue(this.str, ctx.environments); return Promise.resolve(str + "Zach"); }, }; @@ -300,8 +300,8 @@ test("Liquid addTags", async (t) => { parse: function (tagToken, remainTokens) { this.str = tagToken.args; }, - render: async function (scope, hash) { - var str = await liquidEngine.evalValue(this.str, scope); + render: async function (ctx, hash) { + var str = await liquidEngine.evalValue(this.str, ctx.environments); return Promise.resolve(str + "Zach"); }, };