1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-04-08 03:36:38 +00:00

Fix tests

This commit is contained in:
Jeremy Ruston 2025-03-08 09:05:59 +00:00
parent db1ed0e66b
commit 8e9b30fec8
2 changed files with 23 additions and 16 deletions

View File

@ -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) {
};
}
};
})();

View File

@ -5,7 +5,7 @@ tags: [[$:/tags/wiki-test-spec]]
title: Output
<$text text={{{ [[colossus]] :let:another[addprefix[something]] [<another>] +[join[-]] }}}/>
<$text text={{{ [[colossus]] :let:another[all[]] [<another>] +[join[-]] }}}/>
+
title: ExpectedResult