mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-04-08 03:36:38 +00:00
Fix tests
This commit is contained in:
parent
db1ed0e66b
commit
8e9b30fec8
@ -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) {
|
||||
};
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
})();
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user