1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-09-30 07:50:47 +00:00

Merge branch 'master' into parameterised-transclusions

This commit is contained in:
jeremy@jermolene.com 2022-10-01 10:18:34 +01:00
commit 0a309f4865
4 changed files with 25 additions and 11 deletions

View File

@ -12,6 +12,9 @@ Adds tiddler filtering methods to the $tw.Wiki object.
/*global $tw: false */
"use strict";
/* Maximum permitted filter recursion depth */
var MAX_FILTER_DEPTH = 300;
/*
Parses an operation (i.e. a run) within a filter string
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();
self.filterRecursionCount = (self.filterRecursionCount || 0) + 1;
if(self.filterRecursionCount < 300) {
if(self.filterRecursionCount < MAX_FILTER_DEPTH) {
$tw.utils.each(operationFunctions,function(operationFunction) {
operationFunction(results,source,widget);
});

View 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>

View File

@ -6,11 +6,7 @@ tags: [[$:/tags/wiki-test-spec]]
title: Output
\whitespace trim
\procedure recurse(a:0)
<$transclude $variable="recurse" a={{{ [<a>add[1]] }}}/>
\end
<<recurse>>
<$transclude $tiddler="Output"/>
+
title: ExpectedResult

View File

@ -1,6 +1,6 @@
title: LetWidget
created: 20220502144738010
modified: 20220502144738010
created: 20211028115900000
modified: 20221001094658854
tags: Widgets
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.
|!Attribute |!Description |
|//{any 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}// |Each attribute name specifies a variable name. The attribute value is assigned to the variable |
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
Consider a case where you need to set multiple variables, where some depend on the evaluation of others.