From 8aad7b00abba61d67a01a13db51c3fedf6bede75 Mon Sep 17 00:00:00 2001 From: "jeremy@jermolene.com" Date: Fri, 19 Mar 2021 18:35:10 +0000 Subject: [PATCH] Render command: fix bug with multiple variable usage --- core/modules/commands/render.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/core/modules/commands/render.js b/core/modules/commands/render.js index ece2b838f..b10d0f5d5 100644 --- a/core/modules/commands/render.js +++ b/core/modules/commands/render.js @@ -38,15 +38,15 @@ Command.prototype.execute = function() { type = this.params[2] || "text/html", template = this.params[3], variableList = this.params.slice(4), - tiddlers = wiki.filterTiddlers(tiddlerFilter); - $tw.utils.each(tiddlers,function(title) { - var parser = wiki.parseTiddler(template || title), - variables = {currentTiddler: title}; + tiddlers = wiki.filterTiddlers(tiddlerFilter), + variables = Object.create(null); while(variableList.length >= 2) { variables[variableList[0]] = variableList[1]; variableList = variableList.slice(2); } - var widgetNode = wiki.makeWidget(parser,{variables: variables}), + $tw.utils.each(tiddlers,function(title) { + var parser = wiki.parseTiddler(template || title); + var widgetNode = wiki.makeWidget(parser,{variables: $tw.utils.extend({},variables,{currentTiddler: title})}), container = $tw.fakeDocument.createElement("div"); widgetNode.render(container,null); var text = type === "text/html" ? container.innerHTML : container.textContent,