From 1acef48a10ea4097a2c901ee379050be97e99b7d Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Sat, 8 Mar 2025 08:56:12 +0000 Subject: [PATCH] Get rid of the special behaviour for all[] Not needed because the input to the filter run is available --- core/modules/filterrunprefixes/let.js | 4 +--- .../tiddlers/tests/data/let-filter-prefix/All.tid | 12 ------------ .../tests/data/let-filter-prefix/UseInput.tid | 12 ++++++++++++ .../filters/syntax/Let Filter Run Prefix.tid | 2 +- 4 files changed, 14 insertions(+), 16 deletions(-) delete mode 100644 editions/test/tiddlers/tests/data/let-filter-prefix/All.tid create mode 100644 editions/test/tiddlers/tests/data/let-filter-prefix/UseInput.tid diff --git a/core/modules/filterrunprefixes/let.js b/core/modules/filterrunprefixes/let.js index e8218bab4..0cb9a7ae9 100644 --- a/core/modules/filterrunprefixes/let.js +++ b/core/modules/filterrunprefixes/let.js @@ -20,11 +20,9 @@ exports.let = function(operationSubFunction,options) { 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] || ""; + variables[name] = operationSubFunction(source,widget)[0] || ""; // Clear the results results.clear(); // Return the variables diff --git a/editions/test/tiddlers/tests/data/let-filter-prefix/All.tid b/editions/test/tiddlers/tests/data/let-filter-prefix/All.tid deleted file mode 100644 index 9167ec712..000000000 --- a/editions/test/tiddlers/tests/data/let-filter-prefix/All.tid +++ /dev/null @@ -1,12 +0,0 @@ -title: LetFilterRunPrefix/All -description: Usage of "all[]" operator within "let" filter run prefix -type: text/vnd.tiddlywiki-multiple -tags: [[$:/tags/wiki-test-spec]] - -title: Output - -<$text text={{{ [[colossus]] :let:another[all[]] [] +[join[-]] }}}/> -+ -title: ExpectedResult - -

colossus

\ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/let-filter-prefix/UseInput.tid b/editions/test/tiddlers/tests/data/let-filter-prefix/UseInput.tid new file mode 100644 index 000000000..24fd566fd --- /dev/null +++ b/editions/test/tiddlers/tests/data/let-filter-prefix/UseInput.tid @@ -0,0 +1,12 @@ +title: LetFilterRunPrefix/UseInput +description: Using the input of "let" filter run prefix +type: text/vnd.tiddlywiki-multiple +tags: [[$:/tags/wiki-test-spec]] + +title: Output + +<$text text={{{ [[colossus]] :let:another[addprefix[something]] [] +[join[-]] }}}/> ++ +title: ExpectedResult + +

colossus

\ No newline at end of file diff --git a/editions/tw5.com/tiddlers/filters/syntax/Let Filter Run Prefix.tid b/editions/tw5.com/tiddlers/filters/syntax/Let Filter Run Prefix.tid index 88ec3f6ac..fc8480190 100644 --- a/editions/tw5.com/tiddlers/filters/syntax/Let Filter Run Prefix.tid +++ b/editions/tw5.com/tiddlers/filters/syntax/Let Filter Run Prefix.tid @@ -20,4 +20,4 @@ type: text/vnd.tiddlywiki The `:let` filter run prefix assigns the first result of a filter run to a variable that is made available to the remaining [[filter runs|Filter Run]] in the [[filter expression|Filter Expression]]. If the filter run does not return any results then the variable is set to an empty string. -Within the filter run the [[all Operator]] with an empty parameter retrieves all the titles from the previous filter runs, instead of the usual behaviour of retieving all the titles that were passed to the filter expression. +The output of the `:let` filter run prefix is an empty title list.