mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-17 23:34:50 +00:00
Merge branch 'master' into parameterised-transclusions
This commit is contained in:
commit
0a309f4865
@ -12,6 +12,9 @@ Adds tiddler filtering methods to the $tw.Wiki object.
|
|||||||
/*global $tw: false */
|
/*global $tw: false */
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
/* Maximum permitted filter recursion depth */
|
||||||
|
var MAX_FILTER_DEPTH = 300;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Parses an operation (i.e. a run) within a filter string
|
Parses an operation (i.e. a run) within a filter string
|
||||||
operators: Array of array of operator nodes into which results should be inserted
|
operators: Array of array of operator nodes into which results should be inserted
|
||||||
@ -341,7 +344,7 @@ exports.compileFilter = function(filterString) {
|
|||||||
}
|
}
|
||||||
var results = new $tw.utils.LinkedList();
|
var results = new $tw.utils.LinkedList();
|
||||||
self.filterRecursionCount = (self.filterRecursionCount || 0) + 1;
|
self.filterRecursionCount = (self.filterRecursionCount || 0) + 1;
|
||||||
if(self.filterRecursionCount < 300) {
|
if(self.filterRecursionCount < MAX_FILTER_DEPTH) {
|
||||||
$tw.utils.each(operationFunctions,function(operationFunction) {
|
$tw.utils.each(operationFunctions,function(operationFunction) {
|
||||||
operationFunction(results,source,widget);
|
operationFunction(results,source,widget);
|
||||||
});
|
});
|
||||||
|
15
editions/test/tiddlers/tests/data/filters/Recursion.tid
Normal file
15
editions/test/tiddlers/tests/data/filters/Recursion.tid
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
title: Filters/Recursion
|
||||||
|
description: Filter recursion detection
|
||||||
|
type: text/vnd.tiddlywiki-multiple
|
||||||
|
tags: [[$:/tags/wiki-test-spec]]
|
||||||
|
|
||||||
|
title: Output
|
||||||
|
|
||||||
|
\whitespace trim
|
||||||
|
\define myfilter() [subfilter<myfilter>]
|
||||||
|
|
||||||
|
<$text text={{{ [subfilter<myfilter>] }}}/>
|
||||||
|
+
|
||||||
|
title: ExpectedResult
|
||||||
|
|
||||||
|
<p>/**-- Excessive filter recursion --**/</p>
|
@ -6,11 +6,7 @@ tags: [[$:/tags/wiki-test-spec]]
|
|||||||
title: Output
|
title: Output
|
||||||
|
|
||||||
\whitespace trim
|
\whitespace trim
|
||||||
\procedure recurse(a:0)
|
<$transclude $tiddler="Output"/>
|
||||||
<$transclude $variable="recurse" a={{{ [<a>add[1]] }}}/>
|
|
||||||
\end
|
|
||||||
|
|
||||||
<<recurse>>
|
|
||||||
+
|
+
|
||||||
title: ExpectedResult
|
title: ExpectedResult
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
title: LetWidget
|
title: LetWidget
|
||||||
created: 20220502144738010
|
created: 20211028115900000
|
||||||
modified: 20220502144738010
|
modified: 20221001094658854
|
||||||
tags: Widgets
|
tags: Widgets
|
||||||
caption: let
|
caption: let
|
||||||
|
|
||||||
@ -13,12 +13,12 @@ caption: let
|
|||||||
The content of the <<.wid let>> widget is the scope for the value assigned to the variable.
|
The content of the <<.wid let>> widget is the scope for the value assigned to the variable.
|
||||||
|
|
||||||
|!Attribute |!Description |
|
|!Attribute |!Description |
|
||||||
|//{any attributes}// |Each attribute name specifies a variable name. The attribute value is assigned to the variable |
|
|//{attributes}// |Each attribute name specifies a variable name. The attribute value is assigned to the variable |
|
||||||
|
|
||||||
<<.from-version "5.3.0">> Previously, variable names were restricted to not start with a dollar sign. That restriction is no longer applied.
|
|
||||||
|
|
||||||
Attributes are evaluated in the order they are written. Attributes with the same name are allowed. Each time a duplicate attribute is encountered, it will replace the existing value set by the earlier duplicate.
|
Attributes are evaluated in the order they are written. Attributes with the same name are allowed. Each time a duplicate attribute is encountered, it will replace the existing value set by the earlier duplicate.
|
||||||
|
|
||||||
|
<<.note """<<.from-version "5.2.4">> There is no longer any restriction on using variable names that start with the $ character.""">>
|
||||||
|
|
||||||
! Examples
|
! Examples
|
||||||
|
|
||||||
Consider a case where you need to set multiple variables, where some depend on the evaluation of others.
|
Consider a case where you need to set multiple variables, where some depend on the evaluation of others.
|
||||||
|
Loading…
Reference in New Issue
Block a user