From 485730483b1936641ba6fd67aeabb09457575c9f Mon Sep 17 00:00:00 2001 From: Saq Imtiaz Date: Tue, 30 Nov 2021 16:07:10 +0100 Subject: [PATCH] Docs: reference documentation for :cascade filter run prefix (#6294) * docs: formal documentation for :cascade filter run prefix * fix: typos * fix: typos --- .../Cascade Filter Run Prefix (Examples).tid | 22 +++++++++++++++++++ .../syntax/Cascade Filter Run Prefix.tid | 20 +++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 editions/tw5.com/tiddlers/filters/syntax/Cascade Filter Run Prefix (Examples).tid create mode 100644 editions/tw5.com/tiddlers/filters/syntax/Cascade Filter Run Prefix.tid diff --git a/editions/tw5.com/tiddlers/filters/syntax/Cascade Filter Run Prefix (Examples).tid b/editions/tw5.com/tiddlers/filters/syntax/Cascade Filter Run Prefix (Examples).tid new file mode 100644 index 000000000..fc162b100 --- /dev/null +++ b/editions/tw5.com/tiddlers/filters/syntax/Cascade Filter Run Prefix (Examples).tid @@ -0,0 +1,22 @@ +created: 20211130114857532 +modified: 20211130132353406 +tags: [[Filter Run Prefix Examples]] [[Filter Syntax]] [[Cascade Filter Run Prefix]] +title: Cascade Filter Run Prefix (Examples) +type: text/vnd.tiddlywiki + +The <<.op ":cascade">> filter run prefix is used by the ~TiddlyWiki core to choose the colour for each tiddler as used in the tag pill generated by the tag macro. + +`:cascade[all[shadows+tiddlers]tag[$:/tags/TiddlerColourFilter]get[text]]` + +The filter expression inside the above <<.op :cascade>> filter run returns a list of filters from the text fields of tiddlers tagged <> as shown below: + + + +For each input title, each of these filters is now applied to in turn until the first filter that returns a non-empty list. The first result from this non-empty list replaces that input title and is used as the colour for that tiddler. + +<<.operator-example 1 """[all[shadows+tiddlers]] :cascade[all[shadows+tiddlers]tag[$:/tags/TiddlerColourFilter]get[text]] +[!is[blank]limit[10]]""">> + diff --git a/editions/tw5.com/tiddlers/filters/syntax/Cascade Filter Run Prefix.tid b/editions/tw5.com/tiddlers/filters/syntax/Cascade Filter Run Prefix.tid new file mode 100644 index 000000000..41924f91c --- /dev/null +++ b/editions/tw5.com/tiddlers/filters/syntax/Cascade Filter Run Prefix.tid @@ -0,0 +1,20 @@ +created: 20211130114043280 +modified: 20211130121544118 +tags: [[Filter Syntax]] [[Filter Run Prefix]] +title: Cascade Filter Run Prefix +type: text/vnd.tiddlywiki + +<<.from-version "5.2.1">> + +|''purpose'' |modify input titles by evaluating in turn a list of filters - as returned by the filter expression for this run - for each input title. | +|''input'' |all titles from previous filter runs | +|''output''|the input titles as modified by the filters returned by this filter run | + +The filter expression for this filter run is evaluated to return a list of filters. Each input title is then evaluated against each of the filters in turn, and the input title is replaced with the first result of the first filter that returns a non-empty list. If none of the filters return a result for an input title, it is replaced with an empty string. + +The following variables are available within the filter run: + +* <<.var currentTiddler>> - the input title +* <<.var ..currentTiddler>> - the value of the variable `currentTiddler` outside the filter run. + +[[Examples|Cascade Filter Run Prefix (Examples)]] \ No newline at end of file