From 65c8d74218857dad12474f236a5987664f4ea062 Mon Sep 17 00:00:00 2001 From: tw-FRed <95534072+tw-FRed@users.noreply.github.com> Date: Sat, 4 Dec 2021 18:34:57 +0100 Subject: [PATCH 1/4] Sign the CLA (#6306) --- licenses/cla-individual.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/licenses/cla-individual.md b/licenses/cla-individual.md index df87a0b51..0025d718b 100644 --- a/licenses/cla-individual.md +++ b/licenses/cla-individual.md @@ -471,3 +471,5 @@ Brian Theado, @btheado, 2021-10-10 @Telumire, 2021-10-18 @eiro10, 2021-11-14 + +Fred, @tw-FRed, 2021/12/04 From f5389b3859d8b8006389614ab9f6af6542e6677f Mon Sep 17 00:00:00 2001 From: tw-FRed <95534072+tw-FRed@users.noreply.github.com> Date: Sat, 4 Dec 2021 19:21:28 +0100 Subject: [PATCH 2/4] [FR_fr] Fix Latest Version image not displaying (#6308) Image broken link on the welcome screen of French documentation edition. See "Quoi de neuf dans la version 5.2.0" here: https://tiddlywiki.com/languages/fr-FR/index.html#HelloThere --- editions/fr-FR/tiddlers/HelloThumbnail - Latest Version.tid | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editions/fr-FR/tiddlers/HelloThumbnail - Latest Version.tid b/editions/fr-FR/tiddlers/HelloThumbnail - Latest Version.tid index c8b7427ca..9fc1a1702 100644 --- a/editions/fr-FR/tiddlers/HelloThumbnail - Latest Version.tid +++ b/editions/fr-FR/tiddlers/HelloThumbnail - Latest Version.tid @@ -2,7 +2,7 @@ caption: Quoi de neuf dans <> color: #fff created: 20160603124050989 fr-title: BonjourLaVignette - Dernière Version -image: New Release Banner.png +image: New Release Banner link: Releases modified: 20160603124131122 tags: HelloThumbnail From 2dd4fa41a56681fa8f1d32f272fa2a2219a22c8b Mon Sep 17 00:00:00 2001 From: btheado Date: Sat, 4 Dec 2021 15:44:04 -0500 Subject: [PATCH 3/4] Add documentation tiddlers for filter filter run prefix (#6310) * Added documentation tiddlers for filter filter run prefix * Added examples to compare :filter filter run prefix to :and prefix --- .../filters/syntax/Filter Expression.tid | 3 +- .../Filter Filter Run Prefix (Examples).tid | 30 +++++++++++++++++++ .../syntax/Filter Filter Run Prefix.tid | 27 +++++++++++++++++ .../syntax/Filter Run Prefix (Examples).tid | 8 +++-- 4 files changed, 65 insertions(+), 3 deletions(-) create mode 100644 editions/tw5.com/tiddlers/filters/syntax/Filter Filter Run Prefix (Examples).tid create mode 100644 editions/tw5.com/tiddlers/filters/syntax/Filter Filter Run Prefix.tid diff --git a/editions/tw5.com/tiddlers/filters/syntax/Filter Expression.tid b/editions/tw5.com/tiddlers/filters/syntax/Filter Expression.tid index fb621743b..02bcd4732 100644 --- a/editions/tw5.com/tiddlers/filters/syntax/Filter Expression.tid +++ b/editions/tw5.com/tiddlers/filters/syntax/Filter Expression.tid @@ -1,5 +1,5 @@ created: 20150124182421000 -modified: 20210618153333369 +modified: 20211129032301006 tags: [[Filter Syntax]] title: Filter Expression type: text/vnd.tiddlywiki @@ -23,6 +23,7 @@ If a run has: * the prefix `~`, if the filter output so far is an empty list then the output titles of the run are [[dominantly appended|Dominant Append]] to the filter's output. If the filter output so far is not an empty list then the run is ignored. <<.from-version "5.1.18">> * named prefixes for filter runs are available. <<.from-version "5.1.23">> * named prefix `:filter`, it receives the filter output so far as its input. The next run is evaluated for each title of the input, removing every input title for which the output is an empty list. <<.from-version "5.1.23">> +** See [[Filter Filter Run Prefix]]. * named prefix `:intersection` replaces all filter output so far with titles that are present in the output of this run, as well as the output from previous runs. Forms the input for the next run. <<.from-version "5.1.23">> * named prefix `:reduce` replaces all filter output so far with a single item by repeatedly applying a formula to each input title. A typical use is to add up the values in a given field of each input title. <<.from-version "5.1.23">> ** [[Examples|Filter Run Prefix (Examples)]] diff --git a/editions/tw5.com/tiddlers/filters/syntax/Filter Filter Run Prefix (Examples).tid b/editions/tw5.com/tiddlers/filters/syntax/Filter Filter Run Prefix (Examples).tid new file mode 100644 index 000000000..dd1e98e63 --- /dev/null +++ b/editions/tw5.com/tiddlers/filters/syntax/Filter Filter Run Prefix (Examples).tid @@ -0,0 +1,30 @@ +created: 20211129022707404 +modified: 20211204154839890 +tags: [[Filter Syntax]] [[Filter Run Prefix Examples]] [[Filter Filter Run Prefix]] +title: Filter Filter Run Prefix (Examples) +type: text/vnd.tiddlywiki + +<<.operator-example 1 "[tag[HelloThere]] :filter[get[text]length[]compare:integer:gteq[1000]]">> +<<.operator-example 2 "[tag[HelloThere]] :filter[get[text]length[]compare:integer:lteq[2000]]">> +<<.operator-example 3 "[tag[HelloThere]] :filter[get[text]length[]compare:integer:gteq[1000]] :filter[get[text]length[]compare:integer:lteq[2000]]">> +<<.operator-example 4 "[tag[Features]] :filter[links[]!is[shadow]is[missing]]">> + +<<.operator-example 5 "A B C D E F :filter[remainder[2]compare:integer:eq[0]]" "Return every other element of the input list">> + +<<.operator-example 6 "[tag[shopping]] :filter[{!!quantity}compare:integer:gt[4]] :map[addprefix[ ]addprefix{!!quantity}]">> +<<.operator-example 7 "[tag[shopping]] :filter[{!!quantity}compare:integer:lteq[4]] :map[addprefix[ ]addprefix{!!quantity}]">> + +!! Comparison between `:filter` and `:and`/`+` filter run prefixes + +The functionality of the <<.op :filter>> filter run prefix has some overlap with the <<.op :and>> prefix (alias <<.op +>>). Notice the filter expressions above all have the following two properties: + +# The start of the filter expression transforms the input titles (i.e. `get[text]length[]`, `links[]`, `remainder[2]`, `{!!quantity}`. +# The end of the filter expression only sends input items to the output if they meet some condition (i.e. `compare`, `is`). + +The purpose of the <<.op :filter>> prefix is to return the original input titles despite property #1 causing those input titles to be transformed. That way, the "meet some condition" check can be performed on something other than the original input. If some filter expression does not require property #1, then the <<.op :and>> prefix can be used instead. + +| <<.op :filter>> | <<.op :and>> | +|^<<.operator-example c1.1 "[tag[HelloThere]] :filter[get[text]length[]compare:integer:gteq[1000]]">>|^<<.operator-example c1.2 "[tag[HelloThere]] :and[get[text]length[]compare:integer:gteq[1000]]">>| +|^<<.operator-example c2.1 "[tag[Features]] :filter[links[]!is[shadow]is[missing]]">>|^<<.operator-example c2.2 "[tag[Features]] :and[links[]!is[shadow]is[missing]]">>| +|!results are the same|<| +|^<<.operator-example c3.1 "cat can bat bug :filter[suffix[at]minlength[3]]">>|^<<.operator-example c3.2 "cat can bat bug :and[suffix[at]minlength[3]]">>| \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/filters/syntax/Filter Filter Run Prefix.tid b/editions/tw5.com/tiddlers/filters/syntax/Filter Filter Run Prefix.tid new file mode 100644 index 000000000..f8eb66847 --- /dev/null +++ b/editions/tw5.com/tiddlers/filters/syntax/Filter Filter Run Prefix.tid @@ -0,0 +1,27 @@ +created: 20211129022455873 +modified: 20211129022550425 +tags: [[Filter Syntax]] [[Filter Run Prefix]] +title: Filter Filter Run Prefix +type: text/vnd.tiddlywiki + +<<.from-version "5.1.23">> + +|''purpose'' |remove every input title for which the filter run output is an empty list | +|''input'' |all titles from previous filter runs | +|''output''|the input titles for which the filter run is not empty | + +It receives the filter output so far as its input. The next run is evaluated for each title of the input, removing every input title for which the output is an empty list. + +Note that within the filter run, the "currentTiddler" variable is set to the title of the tiddler being processed. This permits filter runs like `:filter[{!!price}multiply{!!cost}compare:integer:gteq[5]]` to be used for computation. The value of currentTiddler outside the run is available in the variable "..currentTiddler". + +The following variables are available within the filter run: + +* ''currentTiddler'' - the input title +* ''..currentTiddler'' - the value of the variable `currentTiddler` outside the filter run. +* ''index'' - <<.from-version "5.2.1">> the numeric index of the current list item (with zero being the first item in the list). +* ''revIndex'' - <<.from-version "5.2.1">> the reverse numeric index of the current list item (with zero being the last item in the list). +* ''length'' - <<.from-version "5.2.1">> the total length of the input list. + +<<.tip "Compare named filter run prefix `:filter` with [[filter Operator]] which applies a subfilter to every input title, removing the titles that return an empty result from the subfilter">> + +[[Examples|Filter Filter Run Prefix (Examples)]] diff --git a/editions/tw5.com/tiddlers/filters/syntax/Filter Run Prefix (Examples).tid b/editions/tw5.com/tiddlers/filters/syntax/Filter Run Prefix (Examples).tid index 970bcc434..452943176 100644 --- a/editions/tw5.com/tiddlers/filters/syntax/Filter Run Prefix (Examples).tid +++ b/editions/tw5.com/tiddlers/filters/syntax/Filter Run Prefix (Examples).tid @@ -1,9 +1,13 @@ created: 20201117073343969 -modified: 20210428084013109 +modified: 20211129032537195 tags: [[Filter Syntax]] [[Filter Run Prefix Examples]] title: Filter Run Prefix (Examples) type: text/vnd.tiddlywiki +!! `:filter` examples + +See [[Filter Filter Run Prefix (Examples)]] + !! Difference between `+` and `:intersection` The `+` prefix should be thought of as an "AND" in formal logic, e.g. "give me all titles that satisfy condition A ''and'' condition B". But it's not suitable for all cases; if condition B uses a filter operator that replaces its input, then it will be difficult to use the `+` prefix. For example, if you wanted to find out what tags two tiddlers have in common, you might try to write a filter expression like: @@ -47,4 +51,4 @@ Specifying a default value when input is empty: !! `:sort` examples -See [[Sort Filter Run Prefix (Examples)]] \ No newline at end of file +See [[Sort Filter Run Prefix (Examples)]] From 44ad8c770fe9727a5a3bca2549cc303f2a4f16f2 Mon Sep 17 00:00:00 2001 From: btheado Date: Sun, 5 Dec 2021 12:27:35 -0500 Subject: [PATCH 4/4] Added documentation tiddlers for intersection filter run prefix (#6307) --- .../filters/syntax/Filter Expression.tid | 3 +- .../syntax/Filter Run Prefix (Examples).tid | 21 ++--------- ...ersection Filter Run Prefix (Examples).tid | 36 +++++++++++++++++++ .../syntax/Intersection Filter Run Prefix.tid | 15 ++++++++ 4 files changed, 55 insertions(+), 20 deletions(-) create mode 100644 editions/tw5.com/tiddlers/filters/syntax/Intersection Filter Run Prefix (Examples).tid create mode 100644 editions/tw5.com/tiddlers/filters/syntax/Intersection Filter Run Prefix.tid diff --git a/editions/tw5.com/tiddlers/filters/syntax/Filter Expression.tid b/editions/tw5.com/tiddlers/filters/syntax/Filter Expression.tid index 02bcd4732..d691a9a24 100644 --- a/editions/tw5.com/tiddlers/filters/syntax/Filter Expression.tid +++ b/editions/tw5.com/tiddlers/filters/syntax/Filter Expression.tid @@ -1,5 +1,5 @@ created: 20150124182421000 -modified: 20211129032301006 +modified: 20211129014550442 tags: [[Filter Syntax]] title: Filter Expression type: text/vnd.tiddlywiki @@ -25,6 +25,7 @@ If a run has: * named prefix `:filter`, it receives the filter output so far as its input. The next run is evaluated for each title of the input, removing every input title for which the output is an empty list. <<.from-version "5.1.23">> ** See [[Filter Filter Run Prefix]]. * named prefix `:intersection` replaces all filter output so far with titles that are present in the output of this run, as well as the output from previous runs. Forms the input for the next run. <<.from-version "5.1.23">> +** See [[Intersection Filter Run Prefix]]. * named prefix `:reduce` replaces all filter output so far with a single item by repeatedly applying a formula to each input title. A typical use is to add up the values in a given field of each input title. <<.from-version "5.1.23">> ** [[Examples|Filter Run Prefix (Examples)]] * named prefix `:sort` sorts all filter output so far by applying this run to each input title and sorting according to that output. <<.from-version "5.2.0">> diff --git a/editions/tw5.com/tiddlers/filters/syntax/Filter Run Prefix (Examples).tid b/editions/tw5.com/tiddlers/filters/syntax/Filter Run Prefix (Examples).tid index 452943176..030394d6f 100644 --- a/editions/tw5.com/tiddlers/filters/syntax/Filter Run Prefix (Examples).tid +++ b/editions/tw5.com/tiddlers/filters/syntax/Filter Run Prefix (Examples).tid @@ -8,26 +8,9 @@ type: text/vnd.tiddlywiki See [[Filter Filter Run Prefix (Examples)]] -!! Difference between `+` and `:intersection` +!! `:intersection` examples -The `+` prefix should be thought of as an "AND" in formal logic, e.g. "give me all titles that satisfy condition A ''and'' condition B". But it's not suitable for all cases; if condition B uses a filter operator that replaces its input, then it will be difficult to use the `+` prefix. For example, if you wanted to find out what tags two tiddlers have in common, you might try to write a filter expression like: - -* <$link to="tags Operator">`[[field Operator]tags[]] +[[compare Operator]tags[]]` - -But that won't work, because the second filter run will end up throwing away its input and replacing it with an input consisting of the single title `[[compare Operator]]`. So the result you'd get from that filter expression would be just the tags of the `compare Operator` tiddler. - -For cases like this, the `:intersection` prefix is what you need. It takes the filter output so far, //sets it aside//, and starts the next filter run with all tiddler titles as input. Then once the latest filter run has completed, it takes the latest output, compares it to the set-aside output, and produces a new output that contains only titles that appeared in both the set-aside output and the latest output. So to get only the tags that the `field Operator` and `compare Operator` tiddlers have in common, you would write a filter expression like this: - -* <$link to="tags Operator">`[[field Operator]tags[]] :intersection[[compare Operator]tags[]]` - -The following examples use the [[field Operator]] and [[compare Operator]] tiddlers and their respective tags. - -<<.operator-example 1 "[[field Operator]tags[]]">> -<<.operator-example 2 "[[compare Operator]tags[]]">> - -<<.operator-example 3 "[[field Operator]tags[]] +[[compare Operator]tags[]]" """The "field Operator" tiddler's tags are lost, so only the "compare Operator" tiddler's tags are returned""">> - -<<.operator-example 4 "[[field Operator]tags[]] :intersection[[compare Operator]tags[]]" """Returns the tags that both tiddlers have in common""">> +See [[Intersection Filter Run Prefix (Examples)]] !! `:reduce` examples diff --git a/editions/tw5.com/tiddlers/filters/syntax/Intersection Filter Run Prefix (Examples).tid b/editions/tw5.com/tiddlers/filters/syntax/Intersection Filter Run Prefix (Examples).tid new file mode 100644 index 000000000..d074eb247 --- /dev/null +++ b/editions/tw5.com/tiddlers/filters/syntax/Intersection Filter Run Prefix (Examples).tid @@ -0,0 +1,36 @@ +created: 20211128212902292 +modified: 20211128233320674 +tags: [[Filter Syntax]] [[Filter Run Prefix Examples]] [[Intersection Filter Run Prefix]] +title: Intersection Filter Run Prefix (Examples) +type: text/vnd.tiddlywiki + +<<.operator-example 1 "A B C D :intersection[enlist[C D E F]]">> + +<<.operator-example 2 "A B C D :intersection[enlist[A B C D]]">> + +<<.operator-example 3 "A B C D :intersection[enlist[E F G H]]">> + +<<.operator-example 4 ":intersection[enlist[A B C D]]" "Using intersection in the first filter run is of little use. The result will always be empty.">> + +!! Difference between `+` and `:intersection` + +The `+` prefix should be thought of as an "AND" in formal logic, e.g. "give me all titles that satisfy condition A ''and'' condition B". But it's not suitable for all cases; if condition B uses a filter operator that replaces its input, then it will be difficult to use the `+` prefix. For example, if you wanted to find out what tags two tiddlers have in common, you might try to write a filter expression like: + +* <$link to="tags Operator">`[[field Operator]tags[]] +[[compare Operator]tags[]]` + +But that won't work, because the second filter run will end up throwing away its input and replacing it with an input consisting of the single title `[[compare Operator]]`. So the result you'd get from that filter expression would be just the tags of the `compare Operator` tiddler. + +For cases like this, the `:intersection` prefix is what you need. It takes the filter output so far, //sets it aside//, and starts the next filter run with all tiddler titles as input. Then once the latest filter run has completed, it takes the latest output, compares it to the set-aside output, and produces a new output that contains only titles that appeared in both the set-aside output and the latest output. So to get only the tags that the `field Operator` and `compare Operator` tiddlers have in common, you would write a filter expression like this: + +* <$link to="tags Operator">`[[field Operator]tags[]] :intersection[[compare Operator]tags[]]` + +The following examples use the [[field Operator]] and [[compare Operator]] tiddlers and their respective tags. + +<<.operator-example 5 "[[field Operator]tags[]]">> +<<.operator-example 6 "[[compare Operator]tags[]]">> + +<<.operator-example 7 "[[field Operator]tags[]] +[[compare Operator]tags[]]" """The "field Operator" tiddler's tags are lost, so only the "compare Operator" tiddler's tags are returned""">> + +<<.operator-example 8 "[[field Operator]tags[]] :intersection[[compare Operator]tags[]]" """Returns the tags that both tiddlers have in common""">> + + diff --git a/editions/tw5.com/tiddlers/filters/syntax/Intersection Filter Run Prefix.tid b/editions/tw5.com/tiddlers/filters/syntax/Intersection Filter Run Prefix.tid new file mode 100644 index 000000000..2fc8dd40f --- /dev/null +++ b/editions/tw5.com/tiddlers/filters/syntax/Intersection Filter Run Prefix.tid @@ -0,0 +1,15 @@ +created: 20211128212902292 +modified: 20211128212904721 +tags: [[Filter Syntax]] [[Filter Run Prefix]] +title: Intersection Filter Run Prefix +type: text/vnd.tiddlywiki + +<<.from-version "5.1.23">> + +|''purpose'' |find the intersection of titles from previous runs with titles in this filter run | +|''input'' |all titles from previous filter runs | +|''output''|the titles that are present in both the result of this filter run and the output from previous runs | + +The filter output from previous runs is set aside. The `:intersection` filter run is started with all tiddler titles as input. Once this latest filter run has completed, the latest output is compared to the set-aside output. A new output is produced that contains only titles that appeared in both the set-aside output and the latest output. + +[[Examples|Intersection Filter Run Prefix (Examples)]]