1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-16 02:19:55 +00:00

Render command: fix bug with multiple variable usage

This commit is contained in:
jeremy@jermolene.com 2021-03-19 18:35:10 +00:00
parent a38dc17300
commit 8aad7b00ab

View File

@ -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,