Skip to content

Commit

Permalink
Fix access to scope in Liquid arguments #2678
Browse files Browse the repository at this point in the history
  • Loading branch information
zachleat committed Dec 8, 2022
1 parent 295fee1 commit f4cc4bc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/Engines/Liquid.js
Expand Up @@ -148,8 +148,9 @@ class Liquid extends TemplateEngine {
render: function* (ctx, emitter) {
let rawArgs = Liquid.parseArguments(_t.argLexer, this.args);
let argArray = [];
let contextScope = ctx.getAll();
for (let arg of rawArgs) {
let b = yield liquidEngine.evalValue(arg, ctx.environments);
let b = yield liquidEngine.evalValue(arg, contextScope);
argArray.push(b);
}

Expand Down Expand Up @@ -186,8 +187,9 @@ class Liquid extends TemplateEngine {
render: function* (ctx, emitter) {
let rawArgs = Liquid.parseArguments(_t.argLexer, this.args);
let argArray = [];
let contextScope = ctx.getAll();
for (let arg of rawArgs) {
let b = yield liquidEngine.evalValue(arg, ctx.environments);
let b = yield liquidEngine.evalValue(arg, contextScope);
argArray.push(b);
}

Expand Down
5 changes: 3 additions & 2 deletions src/Plugins/RenderPlugin.js
Expand Up @@ -155,7 +155,7 @@ function EleventyPlugin(eleventyConfig, options = {}) {
let normalizedContext = {};
if (ctx) {
if (opts.accessGlobalData) {
// parent template data cascade
// parent template data cascade, should this be `ctx.getAll()` (per below?)
normalizedContext.data = ctx.environments;
}

Expand All @@ -165,8 +165,9 @@ function EleventyPlugin(eleventyConfig, options = {}) {

let rawArgs = Liquid.parseArguments(null, this.args);
let argArray = [];
let contextScope = ctx.getAll();
for (let arg of rawArgs) {
let b = yield liquidEngine.evalValue(arg, ctx.environments);
let b = yield liquidEngine.evalValue(arg, contextScope);
argArray.push(b);
}

Expand Down

0 comments on commit f4cc4bc

Please sign in to comment.