mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-09 11:29:58 +00:00
Merge branch 'tiddlywiki-com'
This commit is contained in:
commit
5758d0b313
18
editions/tw5.com/tiddlers/Operators without parameters.tid
Normal file
18
editions/tw5.com/tiddlers/Operators without parameters.tid
Normal file
@ -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:
|
||||
|
||||
`[<currentTiddler>backlinks[]]`
|
||||
|
||||
(Even though an expression such as `[<currentTiddler>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:
|
||||
|
||||
<div>
|
||||
|
||||
<<list-links filter:"[op-parameter[none]] [tag[Filter Operators]!has[op-parameter]] -[search:op-purpose[same]]" class:"multi-columns">>
|
||||
|
||||
</div>
|
@ -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 <<tag>> 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.
|
||||
|
||||
<<list-links "[tag<currentTiddler>]">>
|
@ -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.""">>
|
@ -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 <<tag>>:
|
||||
|
||||
<<list-links "[tag<currentTiddler>]" class:"multi-columns">>
|
||||
|
@ -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: `[<now [UTC]YYYY0MM0DD0hh0mm0ssXXX>]`.
|
||||
|
||||
<<.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 `[<currentTiddler>links[]]`.""">>
|
||||
|
||||
---
|
||||
|
||||
<<.from-version "5.1.23">> [[Filter Step]]s support multiple parameters which are separated by a `,` character.
|
||||
|
@ -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">>
|
||||
|
@ -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: <<tag-picker>>
|
||||
<$transclude $variable=".example" n="1"
|
||||
eg="""Add tags to this tiddler's ''tags'' field (selecting from a list of all tags): <<tag-picker>>
|
||||
"""/>
|
||||
|
||||
----
|
||||
@ -17,41 +17,41 @@ eg="""Use all existing tags and set the ''tags'' field here: <<tag-picker>>
|
||||
<<.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: <<tag-picker tiddler:"$:/temp/test/tag-picker">>
|
||||
Add tags to the $:/temp/test/tag-picker ''tags'' field (selecting from a list of all tags): <<tag-picker tiddler:"$:/temp/test/tag-picker">>
|
||||
"""/>
|
||||
|
||||
----
|
||||
|
||||
<<.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: <<tag-picker tagField:"foo" tiddler:"$:/temp/test/tag-picker">>
|
||||
Add tags to the $:/temp/test/tag-picker ''foo'' field (selecting from a list of all tags): <<tag-picker tagField:"foo" 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.""">>
|
||||
|
||||
<$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]] }}}/><br>
|
||||
$:/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'': <<tag-picker tagField:"bar" tagListFilter:"[<listSource>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: <<tag-picker tagField:"bar" tagListFilter:"[<listSource>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.<br>
|
||||
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]] }}}/><br>
|
||||
$:/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="[<listSource>get<listSourceField>enlist-input[]]" tiddler="$:/temp/test/tag-picker" actions=<<addNewTagToSource>>/>
|
||||
Add tags to ''bar'' field, selecting from values in ''foo'' field of $:/temp/test/tag-picker: <$macrocall $name="tag-picker" tagField="bar" tagListFilter="[<listSource>get<listSourceField>enlist-input[]]" tiddler="$:/temp/test/tag-picker" actions=<<addNewTagToSource>>/>
|
||||
|
||||
"""/>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user