mirror of
				https://github.com/Jermolene/TiddlyWiki5
				synced 2025-11-04 09:33:00 +00:00 
			
		
		
		
	fix: nested functions should resolve filter run variables (#8233)
This commit is contained in:
		@@ -316,7 +316,8 @@ Widget.prototype.getStateQualifier = function(name) {
 | 
			
		||||
Make a fake widget with specified variables, suitable for variable lookup in filters
 | 
			
		||||
*/
 | 
			
		||||
Widget.prototype.makeFakeWidgetWithVariables = function(variables) {
 | 
			
		||||
	var self = this;
 | 
			
		||||
	var self = this,
 | 
			
		||||
		variables = variables || {};
 | 
			
		||||
	return {
 | 
			
		||||
		getVariable: function(name,opts) {
 | 
			
		||||
			if($tw.utils.hop(variables,name)) {
 | 
			
		||||
@@ -334,7 +335,7 @@ Widget.prototype.makeFakeWidgetWithVariables = function(variables) {
 | 
			
		||||
				};
 | 
			
		||||
			} else {
 | 
			
		||||
				opts = opts || {};
 | 
			
		||||
				opts.variables = variables;
 | 
			
		||||
				opts.variables = $tw.utils.extend(variables,opts.variables);
 | 
			
		||||
				return self.getVariableInfo(name,opts);
 | 
			
		||||
			};
 | 
			
		||||
		},
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,21 @@
 | 
			
		||||
title: Functions/FunctionFilterrunVariables3
 | 
			
		||||
description: Nested functions in filter runs that set variables
 | 
			
		||||
type: text/vnd.tiddlywiki-multiple
 | 
			
		||||
tags: [[$:/tags/wiki-test-spec]]
 | 
			
		||||
 | 
			
		||||
title: Output
 | 
			
		||||
 | 
			
		||||
\whitespace trim
 | 
			
		||||
\define currentTiddler() old-current
 | 
			
		||||
 | 
			
		||||
\function .inner() [<currentTiddler>]
 | 
			
		||||
\function .outer() [<currentTiddler>match[intermediate2]then[new-current]] :map[function[.inner]]
 | 
			
		||||
\function .wrappertwo() [<currentTiddler>match[intermediate]addsuffix[2]] :map[function[.outer]]
 | 
			
		||||
\function .wrapper() intermediate :map[.wrappertwo[]]
 | 
			
		||||
 | 
			
		||||
<$text text={{{ [.wrapper[]] }}}/>
 | 
			
		||||
 | 
			
		||||
+
 | 
			
		||||
title: ExpectedResult
 | 
			
		||||
 | 
			
		||||
new-current
 | 
			
		||||
		Reference in New Issue
	
	Block a user