mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-08-11 08:14:14 +00:00
Bug fix
This commit is contained in:
parent
7640135a7e
commit
938e72dc34
@ -18,6 +18,10 @@ Export our filter prefix function
|
|||||||
exports.let = function(operationSubFunction,options) {
|
exports.let = function(operationSubFunction,options) {
|
||||||
// Return the filter run prefix function
|
// Return the filter run prefix function
|
||||||
return function(results,source,widget) {
|
return function(results,source,widget) {
|
||||||
|
// Save the result list
|
||||||
|
var resultList = results.toArray();
|
||||||
|
// Clear the results
|
||||||
|
results.clear();
|
||||||
// Evaluate the subfunction to get the variable name
|
// Evaluate the subfunction to get the variable name
|
||||||
var subFunctionResults = operationSubFunction(source,widget);
|
var subFunctionResults = operationSubFunction(source,widget);
|
||||||
if(subFunctionResults.length === 0) {
|
if(subFunctionResults.length === 0) {
|
||||||
@ -29,9 +33,7 @@ exports.let = function(operationSubFunction,options) {
|
|||||||
}
|
}
|
||||||
// Assign the result of the subfunction to the variable
|
// Assign the result of the subfunction to the variable
|
||||||
var variables = {};
|
var variables = {};
|
||||||
variables[name] = results.toArray()
|
variables[name] = resultList;
|
||||||
// Clear the results
|
|
||||||
results.clear();
|
|
||||||
// Return the variables
|
// Return the variables
|
||||||
return {
|
return {
|
||||||
variables: variables
|
variables: variables
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
title: LetFilterRunPrefix/ResultListUnnamedVariable
|
||||||
|
description: Using the "let" filter run prefix to store result lists, not just single values
|
||||||
|
type: text/vnd.tiddlywiki-multiple
|
||||||
|
tags: [[$:/tags/wiki-test-spec]]
|
||||||
|
|
||||||
|
title: Output
|
||||||
|
|
||||||
|
<$text text={{{ [all[tiddlers]] :let[all[]tag[nothing]] [varlist[varname]sort[]join[,]] }}}/>
|
||||||
|
+
|
||||||
|
title: ExpectedResult
|
||||||
|
|
||||||
|
<p></p>
|
@ -0,0 +1,12 @@
|
|||||||
|
title: MultiValuedVariables/MissingVariable
|
||||||
|
description: Using varlist with a missing variable
|
||||||
|
type: text/vnd.tiddlywiki-multiple
|
||||||
|
tags: [[$:/tags/wiki-test-spec]]
|
||||||
|
|
||||||
|
title: Output
|
||||||
|
|
||||||
|
<$text text={{{ [varlist[varname]] }}}/>
|
||||||
|
+
|
||||||
|
title: ExpectedResult
|
||||||
|
|
||||||
|
<p></p>
|
Loading…
x
Reference in New Issue
Block a user