diff --git a/editions/tw5.com/tiddlers/Operators without parameters.tid b/editions/tw5.com/tiddlers/Operators without parameters.tid new file mode 100644 index 000000000..756efb74e --- /dev/null +++ b/editions/tw5.com/tiddlers/Operators without parameters.tid @@ -0,0 +1,18 @@ +created: 20240708171243370 +modified: 20240708201827711 +tags: +title: Operators without parameters + +Many [[Filter Operators]] have no [[parameter|Filter Parameter]] available. Still, each operator must be followed by a bracketed parameter expression — even if it is empty — as with the <<.olink backlinks>> operator below: + +`[backlinks[]]` + +(Even though an expression such as `[backlinks]` may at first <<.em seem>> well-formed — insofar as closing brackets seem to pair properly with opening brackets — each operator needs its own parameter brackets, even if empty. See [[Filter Syntax]].) + +The following [[Filter Operators]] accept no parameters: + +
+ +<> + +
\ No newline at end of file diff --git a/editions/tw5.com/tiddlers/Selection Constructors: Conditional.tid b/editions/tw5.com/tiddlers/Selection Constructors: Conditional.tid new file mode 100644 index 000000000..511b0f979 --- /dev/null +++ b/editions/tw5.com/tiddlers/Selection Constructors: Conditional.tid @@ -0,0 +1,9 @@ +created: 20240708174435694 +modified: 20240708175546166 +title: Selection Constructors: Conditional + +Most [[filter Operators|filter Operator]] are either ''selection modifiers'' or [[Selection Constructors]]. + +Within the exceptional category <> are a tiny minority that //usually// act as ''selection modifiers'', but which can construct a fresh selection under special conditions — namely, whenever their [[parameter|Filter Parameter]] is specified with a selection constructor. + +<]">> diff --git a/editions/tw5.com/tiddlers/concepts/Dominant Append.tid b/editions/tw5.com/tiddlers/concepts/Dominant Append.tid index 59e79d6c7..c473936bb 100644 --- a/editions/tw5.com/tiddlers/concepts/Dominant Append.tid +++ b/editions/tw5.com/tiddlers/concepts/Dominant Append.tid @@ -1,5 +1,5 @@ created: 20150123220223000 -modified: 20190610165255223 +modified: 20240709151004998 tags: Filters title: Dominant Append type: text/vnd.tiddlywiki @@ -13,3 +13,5 @@ For example, if a selection contains `Andrew Becky Clara Daniel` and `Andrew Bar This behaviour can cause unexpected results when working with [[Mathematics Operators]]. For example, `1 2 3 +[sum[]]` evaluates to `6`, as expected. But `1 1 1 +[sum[]]` evaluates to `1`. Removing the `+[sum[]]` from each filter reveals the problem: `1 2 3` evaluates to the list `1`, `2`, `3`, while `1 1 1` evaluates to the single item `1` due to de-duplication. In such situations, the `=` prefix can be used to disable the de-duplication. For example, `=1 =1 =1 +[sum[]]` evaluates to `3` as expected. Alternatively, the [[split Operator]] can be used: `[[1,1,1]split[,]sum[]]`. + +<<.tip """To build a list of unique values that retains only the <<.em earliest>> copy of each value (the opposite behavior from <<.link "Dominant Append" "Dominant Append">>), first use the <<.link `:all` "All Filter Run Prefix">> filter run prefix (or its short form `=`) to retain all duplicate values while building your list. Then finish your filter run with the <<.olink unique>> operator" to remove later duplicates.""">> \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/concepts/Selection Constructors.tid b/editions/tw5.com/tiddlers/concepts/Selection Constructors.tid index 9aac725a5..313339efb 100644 --- a/editions/tw5.com/tiddlers/concepts/Selection Constructors.tid +++ b/editions/tw5.com/tiddlers/concepts/Selection Constructors.tid @@ -1,5 +1,5 @@ created: 20150117204109000 -modified: 20150917193713204 +modified: 20240708201746542 tags: Filters title: Selection Constructors type: text/vnd.tiddlywiki @@ -11,3 +11,7 @@ The output of a [[Filter Step]] depends on its [[operator|Filter Operators]]: * A few operators ignore their input and generate an independent output instead. These are called <<.def "selection constructors">>: they construct an entirely new [[selection|Title Selection]]. A good example of a constructor is <<.olink title>>. The output of `[title[A]title[B]]` is just <<.tid B>>. But the <<.olink field>> operator is a modifier, so `[title[A]field:title[B]` outputs nothing at all. + +The following [[filter Operators|filter Operator]] are tagged <>: + +<]" class:"multi-columns">> diff --git a/editions/tw5.com/tiddlers/filters/syntax/Filter Parameter.tid b/editions/tw5.com/tiddlers/filters/syntax/Filter Parameter.tid index 9334fd069..0cfb83d5c 100644 --- a/editions/tw5.com/tiddlers/filters/syntax/Filter Parameter.tid +++ b/editions/tw5.com/tiddlers/filters/syntax/Filter Parameter.tid @@ -1,5 +1,5 @@ created: 20150220152540000 -modified: 20230710074423650 +modified: 20240708202234843 tags: [[Filter Step]] title: Filter Parameter type: text/vnd.tiddlywiki @@ -29,6 +29,8 @@ The parameter to a [[filter operator|Filter Operators]] can be: :: The parameter is the current value of the [[variable|Variables]] whose name appears between the angle brackets. Macro parameters are <<.em not>> supported up to v5.2.0 ::<<.from-version "5.2.0">> Literal macro parameters are supported. For example: `[]`. +<<.note """Every [[filter Operator]] must be followed by a parameter expression. In the case of [[Operators without parameters]], that expression is empty, as with the filter Operator <<.olink links>> in `[links[]]`.""">> + --- <<.from-version "5.1.23">> [[Filter Step]]s support multiple parameters which are separated by a `,` character. diff --git a/editions/tw5.com/tiddlers/filters/unique.tid b/editions/tw5.com/tiddlers/filters/unique.tid index 672817968..836c41db8 100644 --- a/editions/tw5.com/tiddlers/filters/unique.tid +++ b/editions/tw5.com/tiddlers/filters/unique.tid @@ -1,4 +1,6 @@ caption: unique +created: 20240709151018238 +modified: 20240709151336906 op-input: a list of items op-output: a list of unique items op-parameter: ignored @@ -7,4 +9,6 @@ tags: [[Filter Operators]] [[Order Operators]] [[Listops Operators]] title: unique Operator type: text/vnd.tiddlywiki +<<.note """Unlike the default <<.link "Dominant Append" "Dominant Append">> handling of duplication, the effect of <<.op unique>> is to retain only the <<.em earliest>> instance among duplicated values.""">> + <<.operator-examples "unique">> diff --git a/editions/tw5.com/tiddlers/tag-picker Macro (Examples).tid b/editions/tw5.com/tiddlers/tag-picker Macro (Examples).tid index 1fc150dcc..89c9a9d11 100644 --- a/editions/tw5.com/tiddlers/tag-picker Macro (Examples).tid +++ b/editions/tw5.com/tiddlers/tag-picker Macro (Examples).tid @@ -1,13 +1,13 @@ created: 20230616104546608 -modified: 20240214174032498 +modified: 20240708132312901 tags: [[tag-picker Macro]] [[Macro Examples]] title: tag-picker Macro (Examples) type: text/vnd.tiddlywiki -<<.warning """The first example will set the tag of the <<.tid currentTiddler>> so you should copy / paste it to a new tiddler for testing. Otherwise you'll change "this tiddler" """>> +<<.warning """The first example will add tags to the <<.tid currentTiddler>> so you should copy / paste it to a new tiddler for testing. Otherwise you'll change "this tiddler" """>> -<$macrocall $name=".example" n="1" -eg="""Use all existing tags and set the ''tags'' field here: <> +<$transclude $variable=".example" n="1" +eg="""Add tags to this tiddler's ''tags'' field (selecting from a list of all tags): <> """/> ---- @@ -17,41 +17,41 @@ eg="""Use all existing tags and set the ''tags'' field here: <> <<.tip """The following examples use a temporary tiddler: $:/temp/test/tag-picker. So this tiddler will not be changed """>> -<$macrocall $name=".example" n="2" +<$transclude $variable=".example" n="2" eg="""$:/temp/test/tag-picker ''tags'': <$text text={{{ [[$:/temp/test/tag-picker]get[tags]enlist-input[]join[, ]else[n/a]] }}}/> -Use all existing tags and set the $:/temp/test/tag-picker ''tags'' field: <> +Add tags to the $:/temp/test/tag-picker ''tags'' field (selecting from a list of all tags): <> """/> ---- <<.tip """Use the following example to populate the $:/temp/test/tag-picker ''foo''-field, which are needed by some examples below """>> -<$macrocall $name=".example" n="3" +<$transclude $variable=".example" n="3" eg="""$:/temp/test/tag-picker ''foo'': <$text text={{{ [[$:/temp/test/tag-picker]get[foo]enlist-input[]join[, ]else[n/a]] }}}/> -Use all existing tags and set the $:/temp/test/tag-picker ''foo'' field: <> +Add tags to the $:/temp/test/tag-picker ''foo'' field (selecting from a list of all tags): <> """/> ---- <<.tip """The following example expects some values in the "foo" field of the tiddler $:/temp/test/tag-picker, which can be created by the example above.""">> -<$macrocall $name=".example" n="4" eg="""\procedure listSource() $:/temp/test/tag-picker +<$transclude $variable=".example" n="4" eg="""\procedure listSource() $:/temp/test/tag-picker $:/temp/test/tag-picker foo: <$text text={{{ [[$:/temp/test/tag-picker]get[foo]enlist-input[]join[, ]else[n/a]] }}}/>
$:/temp/test/tag-picker bar: <$text text={{{ [[$:/temp/test/tag-picker]get[bar]enlist-input[]join[, ]else[n/a]] }}}/> -Use $:/temp/test/tag-picker ''foo'' field as source and set ''bar'': <get[foo]enlist-input[]]" tiddler:"$:/temp/test/tag-picker">> +Add tags to the ''bar'' field, selecting from values in ''foo'' field of $:/temp/test/tag-picker: <get[foo]enlist-input[]]" tiddler:"$:/temp/test/tag-picker">> """/> ---- <<.tip """The following example expects some values in the "foo" field of the tiddler $:/temp/test/tag-picker, which can be created by the example above.
-It will also add completely new tags to the bar-field and the source tiddlers foo-field. New tags can be entered by typing into the tag-name input +It will also add completely new tags to the bar-field and the source tiddler‘s foo-field. New tags can be entered by typing into the tag-name input """>> -<$macrocall $name=".example" n="5" eg=""" +<$transclude $variable=".example" n="5" eg=""" \procedure listSource() $:/temp/test/tag-picker \procedure listSourceField() foo @@ -62,7 +62,7 @@ It will also add completely new tags to the bar-field and the source tiddlers fo $:/temp/test/tag-picker foo: <$text text={{{ [[$:/temp/test/tag-picker]get[foo]enlist-input[]join[, ]else[n/a]] }}}/>
$:/temp/test/tag-picker ''bar'': <$text text={{{ [[$:/temp/test/tag-picker]get[bar]enlist-input[]join[, ]else[n/a]] }}}/> -Use $:/temp/test/tag-picker ''foo'' field as source and set ''bar'': <$macrocall $name="tag-picker" tagField="bar" tagListFilter="[getenlist-input[]]" tiddler="$:/temp/test/tag-picker" actions=<>/> +Add tags to ''bar'' field, selecting from values in ''foo'' field of $:/temp/test/tag-picker: <$macrocall $name="tag-picker" tagField="bar" tagListFilter="[getenlist-input[]]" tiddler="$:/temp/test/tag-picker" actions=<>/> """/>