diff --git a/core/modules/filterrunprefixes/cascade.js b/core/modules/filterrunprefixes/cascade.js index f016d4346..b42119d7b 100644 --- a/core/modules/filterrunprefixes/cascade.js +++ b/core/modules/filterrunprefixes/cascade.js @@ -15,13 +15,17 @@ Export our filter prefix function exports.cascade = function(operationSubFunction,options) { return function(results,source,widget) { if(results.length !== 0) { - var filterList = operationSubFunction(source,widget); + var filterList = operationSubFunction(source,widget), + filterFnList = []; var inputResults = results.toArray(); results.clear(); $tw.utils.each(inputResults,function(title) { var result = ""; // If no filter matches, we return an empty string - $tw.utils.each(filterList,function(filter) { - var output = options.wiki.filterTiddlers(filter,{ + $tw.utils.each(filterList,function(filter,index) { + if(!filterFnList[index]) { + filterFnList[index] = options.wiki.compileFilter(filter); + } + var output = filterFnList[index](options.wiki.makeTiddlerIterator([title]),{ getVariable: function(name) { switch(name) { case "currentTiddler": @@ -32,7 +36,7 @@ exports.cascade = function(operationSubFunction,options) { return widget.getVariable(name); } } - },options.wiki.makeTiddlerIterator([title])); + }); if(output.length !== 0) { result = output[0]; return false;