1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-11-01 16:13:00 +00:00

Extend render command to allow multiple variables to be passed

This commit is contained in:
jeremy@jermolene.com
2021-03-19 17:09:53 +00:00
parent 9af68297cd
commit a38dc17300
2 changed files with 8 additions and 7 deletions

View File

@@ -37,14 +37,14 @@ Command.prototype.execute = function() {
filenameFilter = this.params[1] || "[is[tiddler]addsuffix[.html]]",
type = this.params[2] || "text/html",
template = this.params[3],
varName = this.params[4],
varValue = this.params[5],
variableList = this.params.slice(4),
tiddlers = wiki.filterTiddlers(tiddlerFilter);
$tw.utils.each(tiddlers,function(title) {
var parser = wiki.parseTiddler(template || title),
variables = {currentTiddler: title};
if(varName) {
variables[varName] = varValue || "";
while(variableList.length >= 2) {
variables[variableList[0]] = variableList[1];
variableList = variableList.slice(2);
}
var widgetNode = wiki.makeWidget(parser,{variables: variables}),
container = $tw.fakeDocument.createElement("div");