diff --git a/core/modules/filterrunprefixes/let.js b/core/modules/filterrunprefixes/let.js index e8218bab4..c590c6ec2 100644 --- a/core/modules/filterrunprefixes/let.js +++ b/core/modules/filterrunprefixes/let.js @@ -16,22 +16,29 @@ Assign a value to a variable Export our filter prefix function */ exports.let = function(operationSubFunction,options) { - // Save the variable name - var name = options.suffixes[0][0]; - // Return the filter run prefix function - return function(results,source,widget) { - // Set the input source to the incoming results - var inputSource = widget.wiki.makeTiddlerIterator(results.toArray()); - // Assign the result of the subfunction to the variable - var variables = {}; - variables[name] = operationSubFunction(inputSource,widget)[0] || ""; - // Clear the results - results.clear(); - // Return the variables - return { - variables: variables + if(options.suffixes[0] && options.suffixes[0][0]) { + // Save the variable name + var name = options.suffixes[0][0]; + // Return the filter run prefix function + return function(results,source,widget) { + // Set the input source to the incoming results + var inputSource = widget.wiki.makeTiddlerIterator(results.toArray()); + // Assign the result of the subfunction to the variable + var variables = {}; + variables[name] = operationSubFunction(inputSource,widget)[0] || ""; + // Clear the results + results.clear(); + // Return the variables + return { + variables: variables + }; }; - }; + } else { + // Return nothing if there is no variable name + return function(results,source,widget) { + }; + + } }; })(); diff --git a/editions/test/tiddlers/tests/data/let-filter-prefix/UseInput.tid b/editions/test/tiddlers/tests/data/let-filter-prefix/UseInput.tid index 24fd566fd..c20e16442 100644 --- a/editions/test/tiddlers/tests/data/let-filter-prefix/UseInput.tid +++ b/editions/test/tiddlers/tests/data/let-filter-prefix/UseInput.tid @@ -5,7 +5,7 @@ tags: [[$:/tags/wiki-test-spec]] title: Output -<$text text={{{ [[colossus]] :let:another[addprefix[something]] [] +[join[-]] }}}/> +<$text text={{{ [[colossus]] :let:another[all[]] [] +[join[-]] }}}/> + title: ExpectedResult