mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-30 05:19:57 +00:00
Merge branch 'tiddlywiki-com'
This commit is contained in:
commit
af02349e47
@ -9,7 +9,7 @@ config: Data to be inserted into `$tw.config`.
|
||||
filteroperator: Individual filter operator methods.
|
||||
global: Global data to be inserted into `$tw`.
|
||||
info: Publishes system information via the [[$:/temp/info-plugin]] pseudo-plugin.
|
||||
isfilteroperator: Operands for the ''is'' filter operator.
|
||||
isfilteroperator: Parameters for the ''is'' filter operator.
|
||||
library: Generic module type for general purpose JavaScript modules.
|
||||
macro: JavaScript macro definitions.
|
||||
parser: Parsers for different content types.
|
||||
|
@ -30,7 +30,7 @@ Error/DeserializeOperator/UnknownDeserializer: Filter Error: Unknown deserialize
|
||||
Error/Filter: Filter error
|
||||
Error/FilterSyntax: Syntax error in filter expression
|
||||
Error/FilterRunPrefix: Filter Error: Unknown prefix for filter run
|
||||
Error/IsFilterOperator: Filter Error: Unknown operand for the 'is' filter operator
|
||||
Error/IsFilterOperator: Filter Error: Unknown parameter for the 'is' filter operator
|
||||
Error/FormatFilterOperator: Filter Error: Unknown suffix for the 'format' filter operator
|
||||
Error/LoadingPluginLibrary: Error loading plugin library
|
||||
Error/NetworkErrorAlert: `<h2>''Network Error''</h2>It looks like the connection to the server has been lost. This may indicate a problem with your network connection. Please attempt to restore network connectivity before continuing.<br><br>''Any unsaved changes will be automatically synchronised when connectivity is restored''.`
|
||||
|
@ -1,5 +0,0 @@
|
||||
created: 20220728145919904
|
||||
list: Brackets Base64 HelloThere GettingStarted Community
|
||||
modified: 20220728145919904
|
||||
title: $:/StoryList
|
||||
type: text/vnd.tiddlywiki
|
8
editions/tw5.com/tiddlers/Temporary Tiddlers.tid
Normal file
8
editions/tw5.com/tiddlers/Temporary Tiddlers.tid
Normal file
@ -0,0 +1,8 @@
|
||||
created: 20240202112358997
|
||||
modified: 20240202120248326
|
||||
tags: Concepts
|
||||
title: Temporary Tiddlers
|
||||
|
||||
Temporary tiddlers are tiddlers that will be discarded when TiddlyWiki is saved. Under default configuration of the SavingMechanism (more specifically, the filter in [[$:/core/save/all]]), these are tiddlers prefixed with `$:/temp/`. This prefix makes them SystemTiddlers as well.
|
||||
|
||||
One example usage of temporary tiddlers is storing the search queries. The query typed in the [[$:/AdvancedSearch]] is stored in [[$:/temp/advancedsearch]].
|
@ -1,7 +1,7 @@
|
||||
created: 20130827080000000
|
||||
list: [[Introduction to filter notation]] [[Filter Syntax]]
|
||||
modified: 20220316145511797
|
||||
tags: Reference Concepts
|
||||
modified: 20230710074511095
|
||||
tags: Reference Concepts TableOfContents
|
||||
title: Filters
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
@ -15,7 +15,7 @@ You can think of TiddlyWiki as a database in which the records are tiddlers. A d
|
||||
|
||||
A <<.def filter>> is a concise notation for selecting a particular [[set of tiddlers|Title Selection]], known as its <<.def "output">>. Whenever ~TiddlyWiki encounters a filter, it calculates the output. Further work can then be done with just those tiddlers, such as [[counting|CountWidget]] or [[listing|ListWidget]] them.
|
||||
|
||||
The following example passes a filter to the <<.mlink list-links>> macro to display a list of all tiddlers whose titles are <<.olink2 tagged tag>> with the word <<.word Filters>>:
|
||||
The following example passes a filter to the <<.mlink list-links>> macro. It displays a list of all tiddlers using the <<.olink2 tag tag>> <<.word Filters>>:
|
||||
|
||||
<<wikitext-example-without-html """<<list-links "[tag[Filters]]">>""" >>
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
created: 20130827075900000
|
||||
modified: 20161216173541948
|
||||
modified: 20230321130421587
|
||||
tags: Concepts
|
||||
title: TextReference
|
||||
type: text/vnd.tiddlywiki
|
||||
@ -27,7 +27,7 @@ Text references can be used in several places:
|
||||
|
||||
* As [[indirect parameters|Filter Parameter]] within [[Filters]] (eg, `<$list filter="[tag{MyTag!!name}]"/>`)
|
||||
* As [[indirect attributes|HTML in WikiText]] of an element or widget (eg, `<$widget attrib={{Title!!description}}/>`)
|
||||
* As the operand of a shortcut transclusion (eg, `{{MyTiddler!!title}}`)
|
||||
* As the parameter of a shortcut transclusion (eg, `{{MyTiddler!!title}}`)
|
||||
* As the `state` attribute of the RevealWidget and the LinkCatcherWidget
|
||||
|
||||
<$macrocall $name=".tip" _="""Note the distinction between a text reference such as `foo!!bar` and a transclusion of a text reference such as `{{foo!!bar}}`"""/>
|
||||
|
9
editions/tw5.com/tiddlers/definitions/Legacy.tid
Normal file
9
editions/tw5.com/tiddlers/definitions/Legacy.tid
Normal file
@ -0,0 +1,9 @@
|
||||
created: 20230319131443509
|
||||
modified: 20230319132235520
|
||||
tags: Definitions
|
||||
title: Legacy
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
>Legacy code is old computer source code that is no longer supported on the standard hardware and environments, and is a codebase that is in some respect obsolete or supporting something obsolete. Legacy code may be written in programming languages, use frameworks and external libraries, or use architecture and patterns that are no longer considered modern, increasing the mental burden and ramp-up time for software engineers who work on the codebase.
|
||||
>
|
||||
>https://en.wikipedia.org/wiki/Legacy_system
|
@ -1,10 +1,10 @@
|
||||
created: 20190802113703788
|
||||
modified: 20230501175143648
|
||||
modified: 20230711082337975
|
||||
tags: Filters
|
||||
title: Conditional Operators
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
<<.from-version "5.1.20">>The conditional filter operators allow for ''if-then-else'' logic to be expressed within filters.
|
||||
<<.from-version "5.1.20">> The conditional filter operators allow ''if-then-else'' logic to be expressed within filters.
|
||||
|
||||
The foundation is the convention that an empty list can be used to represent the Boolean value <<.value false>> and a list with at one (or more) entries to represent <<.value true>>.
|
||||
|
||||
@ -25,6 +25,8 @@ The <<.olink else>> operator can be used to apply a defaults for missing values.
|
||||
|
||||
<<.operator-example 2 "[[HelloThere]get[custom-field]else[default-value]]">>
|
||||
|
||||
! Filter Run Prefixes
|
||||
''Filter Run Prefixes''
|
||||
|
||||
The [[:then|:then Filter Run Prefix]] and [[:else|:else Filter Run Prefix]] filter run prefixes serve a similar purpose as the conditional operators. Refer to their documentation for more information.
|
||||
The [[:then|Then Filter Run Prefix]] and [[:else|Else Filter Run Prefix]] named filter run prefixes serve a similar purpose as the conditional operators.
|
||||
|
||||
Also see: [[Named Filter Run Prefix]]
|
||||
|
@ -1,5 +1,6 @@
|
||||
breadcrumbs: [[Filter Step]]
|
||||
created: 20140410103123179
|
||||
modified: 20211217141224284
|
||||
modified: 20230410114132501
|
||||
tags: Filters
|
||||
title: Filter Operators
|
||||
type: text/vnd.tiddlywiki
|
||||
@ -18,13 +19,19 @@ type: text/vnd.tiddlywiki
|
||||
<tr class="doc-table-subheading"><th colspan="5" align="center">$_$</th></tr>
|
||||
\end
|
||||
|
||||
A <<.def "filter operator">> is a predefined keyword attached to an individual [[step|Filter Step]] of a [[filter|Filters]]. It defines the particular action of that step.
|
||||
A <<.def "filter operator">> is a predefined keyword attached to an individual step of a [[filter|Filters]]. It defines the particular action of that step.
|
||||
|
||||
''Important:'' Each first [[step|Filter Step]] of a [[filter run|Filter Run]] not given any input titles receives the output of <$link to="all Operator">[all[tiddlers]]</$link> as its input.
|
||||
''Important:'' In general, each first [[filter step|Filter Step]] of a [[filter run|Filter Run]] not given any input titles receives the output of <$link to="all Operator">[all[tiddlers]]</$link> as its input.
|
||||
|
||||
The following table lists all core operators, the most common ones marked ✓. The `!` column indicates whether an operator allows ''negation'' using the <$link to="Filter Step"><code>!</code> prefix</$link>. For specifics as to each operator's negated output please refer to its documentation.
|
||||
|
||||
Most steps process the [[selection of titles|Title Selection]] that are supplied as their input, but a few [[construct an entirely new selection|Selection Constructors]] instead, as indicated by the last column. A `C?` indicates it might construct a new selection, depending on usage. For specifics as to each operator's selection creation please refer to its documentation.
|
||||
''Table legend:''
|
||||
|
||||
|tc-table-no-border tc-first-col-min-width|k
|
||||
|^ ✓|^... |,Used to mark the most common ones |
|
||||
|^ `!`|^... |,The column indicates whether an operator allows ''negation'' using the <$link to="Filter Step"><code>!</code> prefix</$link>.<br>For specifics as to each operator's negated output please refer to its documentation |
|
||||
|^ `C`|^... |,Most steps process the [[selection of titles|Title Selection]] that are supplied as their input, but a few [[construct an entirely new selection|Selection Constructors]] instead, as indicated by the last column.<br>A `C?` indicates it might construct a new selection, depending on usage. For specifics as to each operator's selection creation please refer to its documentation |
|
||||
|
||||
The following table lists all core operators:
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
@ -49,6 +56,6 @@ Most steps process the [[selection of titles|Title Selection]] that are supplied
|
||||
<<.operator-rows "[tag[Filter Operators]!tag[Order Operators]!tag[Mathematics Operators]!tag[String Operators]!tag[Tag Operators]tag[Special Operators]sort[]]">>
|
||||
</table>
|
||||
|
||||
A typical step is written as `[operator[parameter]]`, although not all of the operators need a [[parameter|Filter Parameter]].
|
||||
A typical step is written as `[operator[parameter]]`, although not all of the operators need a [[parameter|Filter Parameter]].
|
||||
|
||||
For the exact rules, see [[Filter Syntax]].
|
@ -1,5 +1,5 @@
|
||||
created: 20190206140446821
|
||||
modified: 20220330133748666
|
||||
modified: 20230321133008898
|
||||
tags: Filters
|
||||
title: Mathematics Operators
|
||||
type: text/vnd.tiddlywiki
|
||||
@ -22,7 +22,7 @@ The mathematics operators take three different forms:
|
||||
** <<.inline-operator-example "=1 =2 =3 =4 +[negate[]]">>
|
||||
** <<.inline-operator-example "=1.2 =2.4 =3.6 =4.8 +[trunc[]]">>
|
||||
** <<.inline-operator-example "=1.2 =2.4 =3.6 =4.8 +[round[]]">>
|
||||
* ''Binary operators'' apply an operation and operand to each number in the input list (e.g. add, multiply, remainder)
|
||||
* ''Binary operators'' apply an operation and parameter to each number in the input list (e.g. add, multiply, remainder)
|
||||
** <<.inline-operator-example "=1 =2 =3 =4 +[add[3]]">>
|
||||
** <<.inline-operator-example "=1 =2 =3 =4 +[multiply[8]]">>
|
||||
* ''Reducing operators'' apply an operation to all of the numbers in the input list, returning a single result (e.g. sum, product)
|
||||
|
@ -1,11 +1,11 @@
|
||||
caption: add
|
||||
created: 20190206140446821
|
||||
modified: 20190611125053329
|
||||
modified: 20230321130647487
|
||||
op-input: a [[selection of titles|Title Selection]]
|
||||
op-output: the input as numbers, but with <<.place N>> added to each one
|
||||
op-parameter: a number
|
||||
op-parameter-name: N
|
||||
op-purpose: treating each input title as a number, add to each the numeric value of the operand
|
||||
op-purpose: treating each input title as a number, add to each the numeric value of the parameter
|
||||
tags: [[Filter Operators]] [[Mathematics Operators]] [[Binary Mathematics Operators]]
|
||||
title: add Operator
|
||||
type: text/vnd.tiddlywiki
|
||||
|
@ -1,6 +1,6 @@
|
||||
caption: all
|
||||
created: 20140410103123179
|
||||
modified: 20211217135719266
|
||||
modified: 20230321131457669
|
||||
op-input: ignored, unless the parameter is empty
|
||||
op-output: the titles that belong to all the specified categories
|
||||
op-parameter: zero or more categories
|
||||
@ -9,10 +9,14 @@ tags: [[Filter Operators]] [[Common Operators]] [[Selection Constructors]] [[Sel
|
||||
title: all Operator
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
The parameter specifies zero or more fundamental categories using the following syntax:
|
||||
The parameter specifies zero or more fundamental categories using the following [[filter step|Filter Step]] syntax:
|
||||
|
||||
<$railroad text="""
|
||||
[{: ("current" | "missing" |: "orphans" | "shadows" | "tags" | "tiddlers" ) +"+" }]
|
||||
\start none
|
||||
\end none
|
||||
<-"all"-> ( "[" | "<" | "{" )
|
||||
[{: ("current" | "missing" |: "orphans" | "shadows" | "tags" | "tiddlers" ) +"+" }]
|
||||
( "]" | ">" | "}" )
|
||||
"""/>
|
||||
|
||||
|!Category |!Members |!Sorted |
|
||||
@ -25,7 +29,7 @@ The parameter specifies zero or more fundamental categories using the following
|
||||
|
||||
If the parameter specifies more than one category, they are processed from left to right. The overall output is initially empty, and each category's output is [[dominantly appended|Dominant Append]] to it in turn. Unrecognised categories contribute nothing to the output.
|
||||
|
||||
As a special case, if the parameter is empty, the output is simply a copy of the input. This can be useful when the parameter is [[soft|Filter Parameter]].
|
||||
As a special case, if the parameter is empty, the output is simply a copy of the input. This can be useful when the parameter is a [[soft parameter|Filter Parameter]].
|
||||
|
||||
The <<.olink is>> operator is similar, but its scope is restricted to its input.
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
caption: append
|
||||
created: 20151017145358368
|
||||
modified: 20151108051540981
|
||||
modified: 20230321131631510
|
||||
op-input: a list of items
|
||||
op-neg-output: a list with items appended from the tail of the operand array
|
||||
op-output: a list with items appended from the head of the operand array
|
||||
op-neg-output: a list with items appended from the tail of the parameter array
|
||||
op-output: a list with items appended from the head of the parameter array
|
||||
op-parameter: the array of items to be appended to the tail of the list
|
||||
op-parameter-name: list
|
||||
op-purpose: append a range of items from an array to the list
|
||||
|
@ -2,7 +2,7 @@ caption: charcode
|
||||
created: 20210622214425635
|
||||
modified: 20210622214425635
|
||||
op-input: ignored
|
||||
op-output: a string formed from concatenating the characters specified by the numeric codes given in the operand(s)
|
||||
op-output: a string formed from concatenating the characters specified by the numeric codes given in the parameter(s)
|
||||
op-parameter: numeric character code
|
||||
op-parameter-name: C
|
||||
op-purpose: generates string characters from their numeric character codes
|
||||
@ -12,6 +12,6 @@ type: text/vnd.tiddlywiki
|
||||
|
||||
<<.from-version "5.2.0">>
|
||||
|
||||
This operator returns a string formed from concatenating the characters specified by the numeric codes given in one or more operands. It is useful for generating special characters such as tab (`charcode[9]`) or new line (`charcode[13],[10]`).
|
||||
This operator returns a string formed from concatenating the characters specified by the numeric codes given in one or more parameters. It is useful for generating special characters such as tab (`charcode[9]`) or new line (`charcode[13],[10]`).
|
||||
|
||||
<<.operator-examples "charcode">>
|
||||
|
@ -4,7 +4,7 @@ tags: [[Filter Operators]] [[Mathematics Operators]] [[String Operators]] [[Nega
|
||||
title: compare Operator
|
||||
type: text/vnd.tiddlywiki
|
||||
caption: compare
|
||||
op-purpose: filter the input by comparing each item against the operand
|
||||
op-purpose: filter the input by comparing each item against the parameter
|
||||
op-input: a [[selection of titles|Title Selection]]
|
||||
op-suffix: the <<.op compare>> operator uses a rich suffix, see below for details
|
||||
op-parameter: the value to compare
|
||||
@ -16,7 +16,7 @@ op-neg-output: those input titles <<.em not>> matching the specified comparison
|
||||
The <<.op compare>> operator uses an extended syntax to specify all the options:
|
||||
|
||||
```
|
||||
[compare:<type>:<mode>[<operand>]]
|
||||
[compare:<type>:<mode>[<parameter>]]
|
||||
```
|
||||
|
||||
The ''type'' can be:
|
||||
|
@ -4,7 +4,7 @@ modified: 20201118192136472
|
||||
op-input: a list of items
|
||||
op-output: the input list with the titles specified in the parameter toggled in a cyclical manner
|
||||
op-parameter: the <<.op cycle>> operator accepts 1 or 2 parameters, see below for details
|
||||
op-purpose: toggle in the input, the titles specified in the first operand in a cyclical manner
|
||||
op-purpose: toggle the titles specified in the first parameter in a cyclical manner
|
||||
tags: [[Filter Operators]] [[Listops Operators]] [[Order Operators]]
|
||||
title: cycle Operator
|
||||
type: text/vnd.tiddlywiki
|
||||
|
@ -5,7 +5,7 @@ op-input: a [[selection of titles|Title Selection]]
|
||||
op-output: the input as numbers, but with each one divided by <<.place N>>
|
||||
op-parameter: a number
|
||||
op-parameter-name: N
|
||||
op-purpose: treating each input title as a number, divide them by the numeric value of the operand
|
||||
op-purpose: treating each input title as a number, divide it by the numeric value of the parameter
|
||||
tags: [[Filter Operators]] [[Mathematics Operators]] [[Binary Mathematics Operators]]
|
||||
title: divide Operator
|
||||
type: text/vnd.tiddlywiki
|
||||
|
@ -7,14 +7,14 @@ op-neg-output: those input titles that are <<.em not>> listed in <<.place L>>
|
||||
op-output: the titles stored as a [[title list|Title List]] at <<.place L>>
|
||||
op-parameter: a [[title list|Title List]]
|
||||
op-parameter-name: L
|
||||
op-purpose: select titles from the operand interpreted as a [[title list|Title List]]
|
||||
op-purpose: select titles from the parameter interpreted as a [[title list|Title List]]
|
||||
op-suffix: <<.from-version "5.1.20">> `dedupe` (the default) to remove duplicates, `raw` to leave duplicates untouched
|
||||
op-suffix-name: D
|
||||
tags: [[Filter Operators]] [[Field Operators]] [[Selection Constructors]] [[Negatable Operators]]
|
||||
title: enlist Operator
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
<<.tip """Literal filter operands cannot contain square brackets but you can work around the issue by using a variable. ''Learn more at:'' [[SetWidget]] documentation under the heading "Filtered List Variable Assignment" """>>
|
||||
<<.tip """Literal filter parameters cannot contain square brackets but you can work around the issue by using a variable. ''Learn more at:'' [[SetWidget]] documentation under the heading "Filtered List Variable Assignment" """>>
|
||||
|
||||
```
|
||||
<$set name="myList" value="first [[second with a space]] third">
|
||||
|
@ -12,7 +12,7 @@ type: text/vnd.tiddlywiki
|
||||
|
||||
<<.from-version "5.1.23">>
|
||||
|
||||
<<.tip " Compare with [[enlist|enlist Operator]] operator that interprets its operand as a title list">>
|
||||
<<.tip " Compare with [[enlist|enlist Operator]] operator that interprets its parameter as a title list">>
|
||||
|
||||
```
|
||||
<$vars days={{{ [[Days of the Week]get[list]] }}}>
|
||||
|
@ -1,5 +1,5 @@
|
||||
created: 20151017151508135
|
||||
modified: 20151108051743531
|
||||
modified: 20230321130446467
|
||||
tags: [[Operator Examples]] [[prepend Operator]]
|
||||
title: prepend Operator (Examples)
|
||||
type: text/vnd.tiddlywiki
|
||||
@ -10,6 +10,6 @@ The operator may be used to prepend a number of items to the list.
|
||||
|
||||
<<.operator-example 1 "[list[Days of the Week]prepend[Yesterday Today Tomorrow]]">>
|
||||
|
||||
The operand may list only items without spaces -- to include items with spaces, use a reference to an array e.g. prepend the last three short days of the week to the list
|
||||
The parameter may list only items without spaces -- to include items with spaces, use a reference to an array, e.g. prepend the last three short days of the week to the list
|
||||
|
||||
<<.operator-example 2 "[list[Days of the Week]!prepend:3{Days of the Week!!short}]">>
|
||||
|
@ -9,7 +9,7 @@ type: text/vnd.tiddlywiki
|
||||
''<$text text=<<__name__>>/>'': <code><$text text={{{ [<__name__>getvariable[]] }}}/></code>
|
||||
\end
|
||||
|
||||
Literal filter operands can be used, but such cases are better rewritten without using <<.op subfilter>>:
|
||||
Literal filter parameters can be used, but such cases are better rewritten without using <<.op subfilter>>:
|
||||
<<.operator-example 1 "[subfilter[one two three]addsuffix[!]]" "same as `one two three +[addsuffix[!]]`">>
|
||||
|
||||
The <<.op subfilter>> operator can be used to dynamically define parts of a [[filter run|Filter Run]]. This is useful for sharing a common pieces of a filter across multiple filters.
|
||||
|
@ -1,23 +1,23 @@
|
||||
caption: field
|
||||
created: 20140410103123179
|
||||
modified: 20150203184718000
|
||||
modified: 20230316111901766
|
||||
op-input: a [[selection of titles|Title Selection]]
|
||||
op-neg-output: those input tiddlers in which field <<.place F>> does <<.em not>> have the value <<.place S>>
|
||||
op-output: those input tiddlers in which field <<.place F>> has the value <<.place S>>
|
||||
op-parameter: a possible value of field <<.place F>>
|
||||
op-parameter-name: S
|
||||
op-purpose: filter the input by field
|
||||
op-suffix: the name of a [[field|TiddlerFields]]
|
||||
op-suffix-name: F
|
||||
tags: [[Filter Operators]] [[Common Operators]] [[Field Operators]] [[Negatable Operators]]
|
||||
title: field Operator
|
||||
type: text/vnd.tiddlywiki
|
||||
caption: field
|
||||
op-purpose: filter the input by field
|
||||
op-input: a [[selection of titles|Title Selection]]
|
||||
op-suffix: the name of a [[field|TiddlerFields]]
|
||||
op-suffix-name: F
|
||||
op-parameter: a possible value of field <<.place F>>
|
||||
op-parameter-name: S
|
||||
op-output: those input tiddlers in which field <<.place F>> has the value <<.place S>>
|
||||
op-neg-output: those input tiddlers in which field <<.place F>> does <<.em not>> have the value <<.place S>>
|
||||
|
||||
If <<.place S>> is empty, <<.op field>> will match both of the following:
|
||||
|
||||
* tiddlers that don't contain field <<.place F>>
|
||||
* tiddlers in which field <<.place F>> exists but has an empty value
|
||||
|
||||
The syntax of a [[filter step|Filter Step]] treats any unrecognised [[filter operator|Filter Operators]] as if it was the suffix to the <<.op field>> operator. See the <<.operator-examples "field" "examples">>.
|
||||
The syntax of a [[filter step|Filter Step]] treats any unrecognised [[filter operator|Filter Operators]] as if it was the suffix to the <<.op field>> operator.
|
||||
|
||||
<<.operator-examples "field">>
|
||||
|
@ -1,6 +1,6 @@
|
||||
caption: format
|
||||
created: 20201020100834443
|
||||
modified: 20220611104737314
|
||||
modified: 20230321132245053
|
||||
op-input: a [[selection of titles|Title Selection]]
|
||||
op-output: input strings formatted according to the specified suffix <<.place B>>
|
||||
op-parameter: optional format string for the formats
|
||||
@ -16,11 +16,11 @@ type: text/vnd.tiddlywiki
|
||||
|
||||
The suffix <<.place B>> is one of the following supported string formats:
|
||||
|
||||
|!Format |!Description |
|
||||
|^`date` |The input string is interpreted as a UTC date and displayed according to the DateFormat specified in the optional operator operand. (Defaults to "YYYY MM DD 0hh:0mm") |
|
||||
|^`json` |<<.from-version "5.2.4">> The input string is interpreted as JSON and displayed with standard formatting. The optional operator operand specifies the number of spaces to use for indenting, or a string to use for indenting. Nothing is returned if the input string is not valid JSON |
|
||||
|^`relativedate` |The input string is interpreted as a UTC date and displayed as the interval from the present instant. Any operator parameters are ignored |
|
||||
|^`timestamp` |<<.from-version "5.3.0">> The input string is interpreted as number of milliseconds since the [[ECMAScript epoch|https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#the_ecmascript_epoch_and_timestamps]], 1 January 1970, and displayed according to the DateFormat specified in the optional operator operand. (Defaults to "[UTC]YYYY0MM0DD0hh0mm0ss0XXX") |
|
||||
|Format |Description |h
|
||||
|^`date` |The input string is interpreted as a UTC date and displayed according to the DateFormat specified in the optional parameter <<.place C>>. (Defaults to "YYYY MM DD 0hh:0mm") |
|
||||
|^`json` |<<.from-version "5.2.4">> The input string is interpreted as JSON and displayed with standard formatting. The optional parameter <<.place C>> specifies the number of spaces to use for indenting, or a string to use for indenting. Nothing is returned if the input string is not valid JSON |
|
||||
|^`relativedate` |The input string is interpreted as a UTC date and displayed as the interval from the present instant. Any operator parameters <<.place C>> are ignored |
|
||||
|^`timestamp` |<<.from-version "5.3.0">> The input string is interpreted as number of milliseconds since the [[ECMAScript epoch|https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#the_ecmascript_epoch_and_timestamps]], 1 January 1970, and displayed according to the DateFormat specified in the optional operator parameter. (Defaults to "[UTC]YYYY0MM0DD0hh0mm0ss0XXX") |
|
||||
|^`titlelist` |<<.from-version "5.2.0">> The input string wrapped in double square brackets if it contains a space. Appropriate for use in a [[title list|Title List]]. |
|
||||
|
||||
Invalid input strings are dropped by the <<.op format>> operator.
|
||||
|
@ -43,7 +43,7 @@ Properties within a JSON object are identified by a sequence of indexes. In the
|
||||
|
||||
The following examples assume that this JSON data is contained in a variable called `jsondata`.
|
||||
|
||||
The <<.op jsonextract>> operator uses multiple operands to specify the indexes of the property to retrieve. Values are returned as literal JSON strings:
|
||||
The <<.op jsonextract>> operator uses multiple parameters to specify the indexes of the property to retrieve. Values are returned as literal JSON strings:
|
||||
|
||||
```
|
||||
[<jsondata>jsonextract[a]] --> "one"
|
||||
@ -67,7 +67,7 @@ Indexes can be dynamically composed from variables and transclusions:
|
||||
[<jsondata>jsonextract<variable>,{!!field},[0]]
|
||||
```
|
||||
|
||||
A subtlety is that the special case of a single blank operand is used to identify the root object. Thus:
|
||||
A subtlety is that the special case of a single blank parameter is used to identify the root object. Thus:
|
||||
|
||||
```
|
||||
[<jsondata>jsonextract[]] --> {"a":"one","b":"","c":"three","d":{"e":"four","f":["five","six",true,false,null],"g":{"x":"max","y":"may","z":"maize"}}}
|
||||
|
@ -43,7 +43,7 @@ Properties within a JSON object are identified by a sequence of indexes. In the
|
||||
|
||||
The following examples assume that this JSON data is contained in a variable called `jsondata`.
|
||||
|
||||
The <<.op jsonget>> operator uses multiple operands to specify the indexes of the property to retrieve:
|
||||
The <<.op jsonget>> operator uses multiple parameters to specify the indexes of the property to retrieve:
|
||||
|
||||
```
|
||||
[<jsondata>jsonget[a]] --> "one"
|
||||
@ -94,7 +94,7 @@ If the object or array contains nested child objects or arrays then the values a
|
||||
[<jsondata>jsonget[d]] --> "four","five","six","true","false","null","max","may","maize"
|
||||
```
|
||||
|
||||
A subtlety is that the special case of a single blank operand is used to identify the root object. Thus:
|
||||
A subtlety is that the special case of a single blank parameter is used to identify the root object. Thus:
|
||||
|
||||
```
|
||||
[<jsondata>jsonindexes[]] --> "a", "b", "c", "d"
|
||||
|
@ -43,7 +43,7 @@ Properties within a JSON object are identified by a sequence of indexes. In the
|
||||
|
||||
The following examples assume that this JSON data is contained in a variable called `jsondata`.
|
||||
|
||||
The <<.op jsonindexes>> operator uses multiple operands to specify the indexes of the property to retrieve:
|
||||
The <<.op jsonindexes>> operator uses multiple parameters to specify the indexes of the property to retrieve:
|
||||
|
||||
```
|
||||
[<jsondata>jsonindexes[d],[f]] --> "0", "1", "2", "3", "4"
|
||||
@ -58,7 +58,7 @@ Indexes can be dynamically composed from variables and transclusions:
|
||||
|
||||
Retrieving the indexes of JSON properties that are not objects or arrays will return nothing.
|
||||
|
||||
A subtlety is that the special case of a single blank operand is used to identify the root object. Thus:
|
||||
A subtlety is that the special case of a single blank parameter is used to identify the root object. Thus:
|
||||
|
||||
```
|
||||
[<jsondata>jsonindexes[]] --> "a", "b", "c", "d"
|
||||
|
@ -52,7 +52,7 @@ Properties within a JSON object are identified by a sequence of indexes. In the
|
||||
|
||||
The following examples assume that this JSON data is contained in a variable called `jsondata`.
|
||||
|
||||
The <<.op jsontype>> operator uses multiple operands to specify the indexes of the property whose type is to be retrieved:
|
||||
The <<.op jsontype>> operator uses multiple parameters to specify the indexes of the property whose type is to be retrieved:
|
||||
|
||||
```
|
||||
[<jsondata>jsontype[a]] --> "string"
|
||||
@ -75,7 +75,7 @@ Indexes can be dynamically composed from variables and transclusions:
|
||||
[<jsondata>jsontype<variable>,{!!field},[0]]
|
||||
```
|
||||
|
||||
A subtlety is that the special case of a single blank operand is used to identify the root object. Thus:
|
||||
A subtlety is that the special case of a single blank parameter is used to identify the root object. Thus:
|
||||
|
||||
```
|
||||
[<jsondata>jsontype[]] --> "object"
|
||||
|
@ -5,7 +5,7 @@ op-input: a [[selection of titles|Title Selection]]
|
||||
op-output: the logarithm of each input title as numbers, with base <<.place N>> if specified otherwise base `e`
|
||||
op-parameter: a number
|
||||
op-parameter-name: N
|
||||
op-purpose: treating each input title as a number, return its logarithm with base equal to the numeric value of the operand if specified, otherwise base `e`
|
||||
op-purpose: treating each input title as a number, return its logarithm with base equal to the numeric value of the parameter if specified, otherwise base `e`
|
||||
tags: [[Filter Operators]] [[Mathematics Operators]] [[Binary Mathematics Operators]]
|
||||
title: log Operator
|
||||
type: text/vnd.tiddlywiki
|
||||
|
@ -1,11 +1,11 @@
|
||||
caption: match
|
||||
created: 20190731080209404
|
||||
modified: 20190731081047732
|
||||
modified: 20230711082432865
|
||||
op-input: a [[selection of titles|Title Selection]]
|
||||
op-neg-output: each item in the input list that does not match the operand string
|
||||
op-output: each item in the input list that matches the operand string (potentially including duplicates)
|
||||
op-neg-output: each item in the input list that does not match the parameter string
|
||||
op-output: each item in the input list that matches the parameter string (potentially including duplicates)
|
||||
op-parameter: the string to be matched
|
||||
op-purpose: returns each item in the list that matches the operand string
|
||||
op-purpose: returns each item in the list that matches the parameter string
|
||||
op-suffix: the <<.op match>> operator uses a rich suffix, see below for details
|
||||
tags: [[Filter Operators]]
|
||||
title: match Operator
|
||||
@ -16,11 +16,10 @@ type: text/vnd.tiddlywiki
|
||||
The <<.op match>> operator uses an extended syntax that permits multiple flags to be passed:
|
||||
|
||||
```
|
||||
[match:<flag list>[<operand>]]
|
||||
[match:<flag list>[<parameter>]]
|
||||
```
|
||||
|
||||
* ''flag list'': a comma delimited list of flags
|
||||
* ''operand'': filter operand
|
||||
|
||||
The available flags are:
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
caption: max
|
||||
created: 20190611130631390
|
||||
modified: 20190611131047026
|
||||
modified: 20230321133057297
|
||||
op-input: a [[selection of titles|Title Selection]]
|
||||
op-output: the input as numbers, with any that are less than <<.place N>> being replaced by <<.place N>>
|
||||
op-parameter: a number
|
||||
op-parameter-name: N
|
||||
op-purpose: treating each input title as a number, take the maximum of its value and the numeric value of the operand
|
||||
op-purpose: treating each input title as a number, take the maximum of its value and the numeric value of the parameter
|
||||
tags: [[Filter Operators]] [[Mathematics Operators]] [[Binary Mathematics Operators]]
|
||||
title: max Operator
|
||||
type: text/vnd.tiddlywiki
|
||||
|
@ -5,7 +5,7 @@ op-input: a [[selection of titles|Title Selection]]
|
||||
op-output: the input as numbers, with any that are greater than <<.place N>> being replaced by <<.place N>>
|
||||
op-parameter: a number
|
||||
op-parameter-name: N
|
||||
op-purpose: treating each input title as a number, take the minimum of its value and the numeric value of the operand
|
||||
op-purpose: treating each input title as a number, take the minimum of its value and the numeric value of the parameter
|
||||
tags: [[Filter Operators]] [[Mathematics Operators]] [[Binary Mathematics Operators]]
|
||||
title: min Operator
|
||||
type: text/vnd.tiddlywiki
|
||||
|
@ -2,7 +2,7 @@ caption: modulesproperty
|
||||
created: 20210919201126246
|
||||
modified: 20210919201347702
|
||||
op-input: a [[selection|Title Selection]] of modules
|
||||
op-output: the value of the module property as specified in the operand
|
||||
op-output: the value of the module property as specified in the parameter
|
||||
op-parameter: module property to retrieve
|
||||
op-purpose: retrieve a module property
|
||||
tags: [[Filter Operators]] [[Special Operators]]
|
||||
|
@ -9,6 +9,6 @@ tags: [[Filter Operators]] [[Special Operators]]
|
||||
title: modules Operator
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
<<.from-version "5.2.0">>The <<.op modules>> filter allows two optional operands. When both are specified, it returns the modules with the module property specified in the first operand which has the value in the second operand.
|
||||
<<.from-version "5.2.0">>The <<.op modules>> filter allows two optional parameters. When both are specified, it returns the modules with the module property specified in the first parameter which has the value in the second parameter.
|
||||
|
||||
<<.operator-examples "modules">>
|
||||
|
@ -5,7 +5,7 @@ op-input: a [[selection of titles|Title Selection]]
|
||||
op-output: the input as numbers, but with each one multiplied by <<.place N>>
|
||||
op-parameter: a number
|
||||
op-parameter-name: N
|
||||
op-purpose: treating each input title as a number, multiply it by the numeric value of the operand
|
||||
op-purpose: treating each input title as a number, multiply it by the numeric value of the parameter
|
||||
tags: [[Filter Operators]] [[Mathematics Operators]] [[Binary Mathematics Operators]]
|
||||
title: multiply Operator
|
||||
type: text/vnd.tiddlywiki
|
||||
|
@ -5,7 +5,7 @@ op-input: a [[selection of titles|Title Selection]]
|
||||
op-output: the input as numbers, but with each one raised to the power of <<.place N>>
|
||||
op-parameter: a number
|
||||
op-parameter-name: N
|
||||
op-purpose: treating each input title as a number, raise it to the power of the numeric value of the operand
|
||||
op-purpose: treating each input title as a number, raise it to the power of the numeric value of the parameter
|
||||
tags: [[Filter Operators]] [[Mathematics Operators]] [[Binary Mathematics Operators]]
|
||||
title: power Operator
|
||||
type: text/vnd.tiddlywiki
|
||||
|
@ -1,27 +1,26 @@
|
||||
caption: prefix
|
||||
created: 20140410103123179
|
||||
modified: 20220218023400000
|
||||
modified: 20230711082821266
|
||||
op-input: a [[selection of titles|Title Selection]]
|
||||
op-neg-output: those input tiddlers that do <<.em not>> start with <<.place S>>
|
||||
op-output: those input titles that start with <<.place S>>
|
||||
op-parameter: a string of characters
|
||||
op-parameter-name: S
|
||||
op-purpose: filter the input titles by how they start
|
||||
op-suffix: the <<.op prefix>> operator uses a rich suffix, see below for details
|
||||
tags: [[Filter Operators]] [[String Operators]] [[Negatable Operators]]
|
||||
title: prefix Operator
|
||||
type: text/vnd.tiddlywiki
|
||||
caption: prefix
|
||||
op-purpose: filter the input titles by how they start
|
||||
op-input: a [[selection of titles|Title Selection]]
|
||||
op-parameter: a string of characters
|
||||
op-parameter-name: S
|
||||
op-output: those input titles that start with <<.place S>>
|
||||
op-neg-output: those input tiddlers that do <<.em not>> start with <<.place S>>
|
||||
op-suffix: the <<.op prefix>> operator uses a rich suffix, see below for details
|
||||
|
||||
<<.from-version "5.2.2">>
|
||||
|
||||
The <<.op prefix>> operator uses an extended syntax that permits multiple flags to be passed:
|
||||
|
||||
```
|
||||
[prefix:<flag list>[<operand>]]
|
||||
[prefix:<flag list>[<parameter>]
|
||||
```
|
||||
|
||||
* ''flag list'': a comma delimited list of flags
|
||||
* ''operand'': filter operand
|
||||
|
||||
The available flags are:
|
||||
|
||||
|
@ -2,8 +2,8 @@ caption: prepend
|
||||
created: 20151017145439292
|
||||
modified: 20151108051701587
|
||||
op-input: a list of items
|
||||
op-neg-output: a list with items prepended from the tail of the operand array
|
||||
op-output: a list with items prepended from the head of the operand array
|
||||
op-neg-output: a list with items prepended from the tail of the parameter array
|
||||
op-output: a list with items prepended from the head of the parameter array
|
||||
op-parameter: the array of items to be prepended to the head of the list
|
||||
op-parameter-name: list
|
||||
op-purpose: prepend a range of items from an array to the list
|
||||
|
@ -1,15 +1,15 @@
|
||||
caption: range
|
||||
created: 20171221184734665
|
||||
modified: 20210907170339891
|
||||
modified: 20230321133838310
|
||||
op-input: ignored
|
||||
op-neg-output: a series of evenly spaced numbers ranging from `<begin>` to `<end>` in reverse order
|
||||
op-output: a series of evenly spaced numbers ranging from `<begin>` to `<end>`
|
||||
op-parameter: a range specification, like `[1],[5]`
|
||||
op-parameter-name: N
|
||||
op-purpose: generate a range of numbers
|
||||
tags: [[Filter Operators]] [[Negatable Operators]] [[Selection Constructors]]
|
||||
title: range Operator
|
||||
type: text/vnd.tiddlywiki
|
||||
caption: range
|
||||
op-purpose: generate a range of numbers
|
||||
op-input: ignored
|
||||
op-parameter: a range specification, like `[1],[5]`
|
||||
op-parameter-name: N
|
||||
op-output: a series of evenly spaced numbers ranging from `<begin>` to `<end>`
|
||||
op-neg-output: a series of evenly spaced numbers ranging from `<begin>` to `<end>` in reverse order
|
||||
|
||||
\define range_example(range)
|
||||
```
|
||||
@ -21,7 +21,7 @@ op-neg-output: a series of evenly spaced numbers ranging from `<begin>` to `<end
|
||||
|
||||
The `range` operator produces a list of numbers counting up or down. It is useful for counting and numbering.
|
||||
|
||||
<<.from-version "5.2.0">> The range operator has been updated to use multiple operands to specify its parameters. Prior to this version, the range operator only had one operand, with the three parts delimited by `,`, `;` or `:`.
|
||||
<<.from-version "5.2.0">> The range operator has been updated to use multiple parameters. Prior to this version, the range operator only had one parameter, with the three parts delimited by `,`, `;` or `:`.
|
||||
|
||||
```
|
||||
[range[<begin>]]
|
||||
@ -29,7 +29,7 @@ The `range` operator produces a list of numbers counting up or down. It is usef
|
||||
[range[<begin>],[<end>],[<step>]]
|
||||
```
|
||||
|
||||
The behaviour depends on the number of operands:
|
||||
The behaviour depends on the number of parameters:
|
||||
|
||||
|Parameter |Output |h
|
||||
|`<end>` |Whole numbers up to `<end>` |
|
||||
@ -47,7 +47,7 @@ Each part must be a number, and works as follows:
|
||||
** Cannot be zero.
|
||||
** We always count from `<begin>` toward `<end>`, whether `<step>` is positive or negative.
|
||||
|
||||
The number of decimal points in the output is fixed, and based on the operand with the //most// decimal points.
|
||||
The number of decimal points in the output is fixed, and based on the parameter with the //most// decimal points.
|
||||
|
||||
To prevent the browser from freezing, `range` is currently limited to 10,000 values.
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
caption: reduce
|
||||
created: 20201004154131193
|
||||
modified: 20210522162536854
|
||||
modified: 20230321133918020
|
||||
op-input: a [[selection of titles|Title Selection]] passed as input to the filter
|
||||
op-output: the final result of running the subfilter <<.place S>>
|
||||
op-parameter: a [[filter expression|Filter Expression]]. Optional second parameter for initial value for accumulator
|
||||
@ -25,7 +25,7 @@ The following variables are available within the subfilter:
|
||||
|
||||
If the <<.op reduce>> operator receives no input, its output will be empty. The [[else Operator]] can be useful in such cases.
|
||||
|
||||
<<.tip "Literal filter operands cannot contain square brackets but you can work around the issue by using a variable:">>
|
||||
<<.tip "Literal filter parameters cannot contain square brackets but you can work around the issue by using a variable:">>
|
||||
|
||||
```
|
||||
<$set name="sum-input" value="[add<accumulator>]">
|
||||
|
@ -5,7 +5,7 @@ op-input: a [[selection of titles|Title Selection]]
|
||||
op-output: the input as numbers, but with each replaced by the remainder when dividing it by <<.place N>>
|
||||
op-parameter: a number
|
||||
op-parameter-name: N
|
||||
op-purpose: treating each input title as a number, return the remainder when divided by the numeric value of the operand
|
||||
op-purpose: treating each input title as a number, return the remainder when divided by the numeric value of the parameter
|
||||
tags: [[Filter Operators]] [[Mathematics Operators]] [[Binary Mathematics Operators]]
|
||||
title: remainder Operator
|
||||
type: text/vnd.tiddlywiki
|
||||
|
@ -2,12 +2,12 @@ caption: remove
|
||||
created: 20151017144531676
|
||||
modified: 20170125200005000
|
||||
op-input: a list of items
|
||||
op-neg-output: items removed from current list that appear at the tail of the operand array
|
||||
op-output: items removed from current list that appear at the head of the operand array
|
||||
op-neg-output: items removed from current list that appear at the tail of the parameter array
|
||||
op-output: items removed from current list that appear at the head of the parameter array
|
||||
op-parameter: an array of items to remove
|
||||
op-parameter-name: array
|
||||
op-prefix: causes N items from the end of the array to be removed
|
||||
op-purpose: remove a list of titles specified in the operand from the input
|
||||
op-purpose: remove a list of titles specified in the parameter from the input
|
||||
op-suffix: an integer N, defaulting to all
|
||||
tags: [[Filter Operators]] [[Order Operators]] [[Listops Operators]]
|
||||
title: remove Operator
|
||||
|
@ -1,15 +1,15 @@
|
||||
caption: removeprefix
|
||||
created: 20140410103123179
|
||||
modified: 20220218023400000
|
||||
modified: 20230711082842515
|
||||
op-input: a [[selection of titles|Title Selection]]
|
||||
op-output: those input titles that start with <<.place S>>, but with those characters discarded
|
||||
op-parameter: a string of characters
|
||||
op-parameter-name: S
|
||||
op-purpose: filter the input titles by how they start, deleting that prefix
|
||||
op-suffix: the <<.op removeprefix>> operator uses a rich suffix, see below for details
|
||||
tags: [[Filter Operators]] [[String Operators]]
|
||||
title: removeprefix Operator
|
||||
type: text/vnd.tiddlywiki
|
||||
caption: removeprefix
|
||||
op-purpose: filter the input titles by how they start, deleting that prefix
|
||||
op-input: a [[selection of titles|Title Selection]]
|
||||
op-parameter: a string of characters
|
||||
op-parameter-name: S
|
||||
op-output: those input titles that start with <<.place S>>, but with those characters discarded
|
||||
op-suffix: the <<.op removeprefix>> operator uses a rich suffix, see below for details
|
||||
|
||||
<<.tip " This filters out input titles that do not start with S. For removing S without filtering out input titles that don't start with S, see [[trim|trim Operator]].">>
|
||||
|
||||
@ -18,11 +18,10 @@ op-suffix: the <<.op removeprefix>> operator uses a rich suffix, see below for d
|
||||
The <<.op removeprefix>> operator uses an extended syntax that permits multiple flags to be passed:
|
||||
|
||||
```
|
||||
[removeprefix:<flag list>[<operand>]]
|
||||
[removeprefix:<flag list>[<parameter>]]
|
||||
```
|
||||
|
||||
* ''flag list'': a comma delimited list of flags
|
||||
* ''operand'': filter operand
|
||||
|
||||
The available flags are:
|
||||
|
||||
|
@ -1,15 +1,15 @@
|
||||
caption: removesuffix
|
||||
created: 20140828133830424
|
||||
modified: 20220218023400000
|
||||
modified: 20230711082859816
|
||||
op-input: a [[selection of titles|Title Selection]]
|
||||
op-output: those input titles that end with <<.place S>>, but with those characters discarded
|
||||
op-parameter: a string of characters
|
||||
op-parameter-name: S
|
||||
op-purpose: filter the input titles by how they end, deleting that suffix
|
||||
op-suffix: the <<.op removesuffix>> operator uses a rich suffix, see below for details
|
||||
tags: [[Filter Operators]] [[String Operators]]
|
||||
title: removesuffix Operator
|
||||
type: text/vnd.tiddlywiki
|
||||
caption: removesuffix
|
||||
op-purpose: filter the input titles by how they end, deleting that suffix
|
||||
op-input: a [[selection of titles|Title Selection]]
|
||||
op-parameter: a string of characters
|
||||
op-parameter-name: S
|
||||
op-output: those input titles that end with <<.place S>>, but with those characters discarded
|
||||
op-suffix: the <<.op removesuffix>> operator uses a rich suffix, see below for details
|
||||
|
||||
<<.tip " This filters out input titles that do not end with S. For removing S without filtering out input titles that don't end with S, see [[trim|trim Operator]].">>
|
||||
|
||||
@ -18,11 +18,10 @@ op-suffix: the <<.op removesuffix>> operator uses a rich suffix, see below for d
|
||||
The <<.op removesuffix>> operator uses an extended syntax that permits multiple flags to be passed:
|
||||
|
||||
```
|
||||
[removesuffix:<flag list>[<operand>]]
|
||||
[removesuffix:<flag list>[<parameter>]]
|
||||
```
|
||||
|
||||
* ''flag list'': a comma delimited list of flags
|
||||
* ''operand'': filter operand
|
||||
|
||||
The available flags are:
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
caption: search
|
||||
created: 20140410103123179
|
||||
modified: 20211129120739275
|
||||
modified: 20230711084359603
|
||||
op-input: a [[selection of titles|Title Selection]]
|
||||
op-neg-output: those input tiddlers in which <<.em not>> all of the search terms can be found
|
||||
op-output: those input tiddlers in which <<.em all>> of the search terms can be found in the value of field <<.place F>>
|
||||
@ -16,7 +16,7 @@ type: text/vnd.tiddlywiki
|
||||
The <<.op search>> operator uses an extended syntax that permits multiple fields and flags to be passed:
|
||||
|
||||
```
|
||||
[search:<field list>:<flag list>[<operand>]]
|
||||
[search:<field list>:<flag list>[<parameter>]]
|
||||
```
|
||||
|
||||
* ''field list'': a comma delimited list of field names to restrict the search
|
||||
@ -24,7 +24,7 @@ The <<.op search>> operator uses an extended syntax that permits multiple fields
|
||||
** an asterisk `*` instead of the field list causes the search to be performed across all fields available on each tiddler
|
||||
** preceding the list with a minus sign `-` reverses the order so that the search is performed on all fields except the listed fields
|
||||
* ''flag list'': a comma delimited list of flags (defaults to `words` if blank)
|
||||
* ''operand'': filter operand
|
||||
* ''parameter'': filter parameter
|
||||
|
||||
This example searches the fields <<.field title>> and <<.field caption>> for a case-sensitive match for the literal string <<.op-word "The first">>:
|
||||
|
||||
|
@ -5,7 +5,7 @@ op-input: a list of items
|
||||
op-output: all items sorted by lookup list
|
||||
op-parameter: a list specifying the order in which to sort the current list
|
||||
op-parameter-name: order
|
||||
op-purpose: sort the current list in the order of the list referenced in the operand
|
||||
op-purpose: sort the current list in the order of the list referenced in the parameter
|
||||
tags: [[Filter Operators]] [[Order Operators]] [[Listops Operators]]
|
||||
title: sortby Operator
|
||||
type: text/vnd.tiddlywiki
|
||||
|
@ -7,14 +7,14 @@ op-neg-output: those input titles that are <<.em not>> returned from the subfilt
|
||||
op-output: the [[selection of titles|Title Selection]] returned from the subfilter <<.place S>>
|
||||
op-parameter: a [[filter expression|Filter Expression]]
|
||||
op-parameter-name: S
|
||||
op-purpose: select titles from the operand interpreted as a [[filter expression|Filter Expression]]
|
||||
op-purpose: select titles from the parameter interpreted as a [[filter expression|Filter Expression]]
|
||||
tags: [[Filter Operators]] [[Field Operators]] [[Selection Constructors]] [[Negatable Operators]] [[Selection Constructors: Conditional]]
|
||||
title: subfilter Operator
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
<<.from-version "5.1.18">> Note that the <<.op subfilter>> operator was introduced in version 5.1.18 and is not available in earlier versions.
|
||||
|
||||
<<.tip " Literal filter operands cannot contain square brackets but you can work around the issue by using a variable:">>
|
||||
<<.tip " Literal filter parameters cannot contain square brackets but you can work around the issue by using a variable:">>
|
||||
|
||||
```
|
||||
<$set name="myFilter" value="[tag[one]]">
|
||||
@ -24,6 +24,6 @@ type: text/vnd.tiddlywiki
|
||||
|
||||
<<.tip "Compare with the similar [[filter|filter Operator]] operator which runs a subfilter against each title, returning those titles that return a non-empty list (and discards the results of the subfilter)">>
|
||||
|
||||
The <<.op subfilter>> operator will act as a [[constructor|Selection Constructors]] whenever the filter defined by its operand is a [[constructor|Selection Constructors]]. Otherwise, it will act as a [[modifier|Selection Constructors]].
|
||||
The <<.op subfilter>> operator will act as a [[constructor|Selection Constructors]] whenever the filter defined by its parameter is a [[constructor|Selection Constructors]]. Otherwise, it will act as a [[modifier|Selection Constructors]].
|
||||
|
||||
<<.operator-examples "subfilter">>
|
||||
|
@ -5,7 +5,7 @@ op-input: a [[selection of titles|Title Selection]]
|
||||
op-output: the input as numbers, but with <<.place N>> subtracted from each one
|
||||
op-parameter: a number
|
||||
op-parameter-name: N
|
||||
op-purpose: treating each input title as a number, subtract from each the numeric value of the operand
|
||||
op-purpose: treating each input title as a number, subtract from each the numeric value of the parameter
|
||||
tags: [[Filter Operators]] [[Mathematics Operators]] [[Binary Mathematics Operators]]
|
||||
title: subtract Operator
|
||||
type: text/vnd.tiddlywiki
|
||||
|
@ -1,27 +1,26 @@
|
||||
caption: suffix
|
||||
created: 20140828133830424
|
||||
modified: 20220218023400000
|
||||
modified: 20230711083049169
|
||||
op-input: a [[selection of titles|Title Selection]]
|
||||
op-neg-output: those input tiddlers that do <<.em not>> end with <<.place S>>
|
||||
op-output: those input titles that end with <<.place S>>
|
||||
op-parameter: a string of characters
|
||||
op-parameter-name: S
|
||||
op-purpose: filter the input titles by how they end
|
||||
op-suffix: the <<.op suffix>> operator uses a rich suffix, see below for details
|
||||
tags: [[Filter Operators]] [[String Operators]] [[Negatable Operators]]
|
||||
title: suffix Operator
|
||||
type: text/vnd.tiddlywiki
|
||||
caption: suffix
|
||||
op-purpose: filter the input titles by how they end
|
||||
op-input: a [[selection of titles|Title Selection]]
|
||||
op-parameter: a string of characters
|
||||
op-parameter-name: S
|
||||
op-output: those input titles that end with <<.place S>>
|
||||
op-neg-output: those input tiddlers that do <<.em not>> end with <<.place S>>
|
||||
op-suffix: the <<.op suffix>> operator uses a rich suffix, see below for details
|
||||
|
||||
<<.from-version "5.2.2">>
|
||||
|
||||
The <<.op suffix>> operator uses an extended syntax that permits multiple flags to be passed:
|
||||
|
||||
```
|
||||
[suffix:<flag list>[<operand>]]
|
||||
[suffix:<flag list>[<parameter>]]
|
||||
```
|
||||
|
||||
* ''flag list'': a comma delimited list of flags
|
||||
* ''operand'': filter operand
|
||||
|
||||
The available flags are:
|
||||
|
||||
|
@ -0,0 +1,18 @@
|
||||
created: 20230316150731234
|
||||
from-version: 5.1.23
|
||||
modified: 20230711084644541
|
||||
rp-input: all titles from previous filter runs
|
||||
rp-output: output titles are appended to the output of previous filter runs without de-duplication.
|
||||
rp-purpose: union of sets without de-duplication
|
||||
tags: [[Named Filter Run Prefix]]
|
||||
title: All Filter Run Prefix
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
<$railroad text="""
|
||||
\start none
|
||||
\end none
|
||||
( ":all" | - )
|
||||
[[run|"Filter Run"]]
|
||||
"""/>
|
||||
|
||||
This prefix has an optional [[shortcut syntax|Shortcut Filter Run Prefix]] symbol `=run`
|
@ -0,0 +1,18 @@
|
||||
created: 20230318142752854
|
||||
from-version: 5.1.23
|
||||
modified: 20230711084712170
|
||||
op-purpose: accumulation of filter steps
|
||||
rp-input: the filter output of all previous runs so far
|
||||
rp-output: output titles replace the output of previous filter runs
|
||||
tags: [[Named Filter Run Prefix]]
|
||||
title: And Filter Run Prefix
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
<$railroad text="""
|
||||
\start none
|
||||
\end none
|
||||
( ":and" | - )
|
||||
[[run|"Filter Run"]]
|
||||
"""/>
|
||||
|
||||
This prefix has an optional [[shortcut syntax|Shortcut Filter Run Prefix]] symbol `+run`
|
@ -2,8 +2,8 @@ created: 20211130114857532
|
||||
filter1: [prefix[ca]then[ca]]
|
||||
filter2: [suffix[at]then[at]]
|
||||
filter3: other
|
||||
modified: 20211204010918504
|
||||
tags: [[Filter Run Prefix Examples]] [[Filter Syntax]] [[Cascade Filter Run Prefix]]
|
||||
modified: 20230305125250563
|
||||
tags: [[Cascade Filter Run Prefix]]
|
||||
title: Cascade Filter Run Prefix (Examples)
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
|
@ -1,20 +1,25 @@
|
||||
created: 20211130114043280
|
||||
modified: 20211130121544118
|
||||
tags: [[Filter Syntax]] [[Filter Run Prefix]]
|
||||
from-version: 5.2.1
|
||||
modified: 20230710073343947
|
||||
rp-input: the filter output of all previous runs so far
|
||||
rp-output: the input titles as modified by the filters returned by this filter run
|
||||
rp-purpose: modify input titles by successively evaluating a list of filters and applying the first result
|
||||
tags: [[Named 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 |
|
||||
<$railroad text="""
|
||||
\start none
|
||||
\end none
|
||||
( ":cascade" | - )
|
||||
[[run|"Filter Run"]]
|
||||
"""/>
|
||||
|
||||
The [[filter expression|Filter Expression]] for this [[filter run|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.
|
||||
* <<.var ..currentTiddler>> - the value of the variable <<.var currentTiddler>> outside the filter run.
|
||||
|
||||
[[Examples|Cascade Filter Run Prefix (Examples)]]
|
||||
[[Cascade Filter Run Prefix (Examples)]]
|
||||
|
@ -0,0 +1,18 @@
|
||||
created: 20230318142408662
|
||||
from-version: 5.1.23
|
||||
modified: 20230322140756821
|
||||
rp-input: all titles from previous filter runs
|
||||
rp-output: 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.<br>if the filter output so far is not an empty list then the run is ignored.
|
||||
rp-purpose: the filter run is only evaluated if the filter output of all previous runs so far is an empty list
|
||||
tags: [[Named Filter Run Prefix]]
|
||||
title: Else Filter Run Prefix
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
<$railroad text="""
|
||||
\start none
|
||||
\end none
|
||||
( ":else" | - )
|
||||
[[run|"Filter Run"]]
|
||||
"""/>
|
||||
|
||||
This prefix has a [[Shortcut Filter Run Prefix]] symbol `~run`
|
@ -0,0 +1,18 @@
|
||||
created: 20230318142056008
|
||||
from-version: 5.1.23
|
||||
modified: 20230322140643066
|
||||
rp-input: all titles from previous filter runs
|
||||
rp-output: output titles are removed from the filter's output (if such tiddlers exist)
|
||||
rp-purpose: if output titles of this filter run are contained in the output of previous filter runs, they are removed, and otherwise ignored
|
||||
tags: [[Named Filter Run Prefix]]
|
||||
title: Except Filter Run Prefix
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
<$railroad text="""
|
||||
\start none
|
||||
\end none
|
||||
( ":except" | - )
|
||||
[[run|"Filter Run"]]
|
||||
"""/>
|
||||
|
||||
This prefix has a [[Shortcut Filter Run Prefix]] symbol `-run`
|
@ -1,73 +1,21 @@
|
||||
created: 20150124182421000
|
||||
modified: 20211129014550442
|
||||
modified: 20230710074507466
|
||||
tags: [[Filter Syntax]]
|
||||
title: Filter Expression
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
A <<.def "filter expression">> is the outermost level of the [[filter syntax|Filter Syntax]]. It consists of [[filter runs|Filter Run]] with optional [[filter run prefixes|Filter Run Prefix]]. Multiple filter runs are separated by [[whitespace|Filter Whitespace]].
|
||||
|
||||
<$railroad text="""
|
||||
[{:
|
||||
[: [[whitespace|"Filter Whitespace"]] ]
|
||||
("+"|"~"|:-|"-"|"="|":"[[named-prefix|"Named Filter Run Prefix"]])
|
||||
{ (
|
||||
- |
|
||||
: [[<"prefix">|"Filter Run Prefix"]]
|
||||
)
|
||||
[[run|"Filter Run"]]
|
||||
}]
|
||||
+ [[whitespace|"Filter Whitespace"]]
|
||||
}
|
||||
"""/>
|
||||
|
||||
A <<.def "filter expression">> is the outermost level of the [[filter syntax|Filter Syntax]]. It consists of one or more [[runs|Filter Run]].
|
||||
<<.tip """If the diagram has a single start and end line, as shown above, it means there is more info in the linked level above. The breadcrumbs can be used to navigate""">>
|
||||
|
||||
If a run has:
|
||||
|
||||
* no prefix, its output titles are [[dominantly appended|Dominant Append]] to the filter's output
|
||||
* the prefix `=`, output titles are appended to the filter's output without de-duplication. <<.from-version "5.1.20">>
|
||||
* the prefix `-`, output titles are <<.em removed>> from the filter's output (if such tiddlers exist)
|
||||
* the prefix `+`, it receives the filter output so far as its input; its output then <<.em "replaces">> all filter output so far and forms the input for the next run
|
||||
* 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">>
|
||||
** 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">>
|
||||
** See [[Reduce Filter Run Prefix]].
|
||||
* 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">>
|
||||
** See [[Sort Filter Run Prefix]].
|
||||
* named prefix `:map` transforms all filter output so far by applying this run to each input title and replacing the input title with the output of this run for that title.
|
||||
** See [[Map Filter Run Prefix]]. <<.from-version "5.2.0">>
|
||||
|
||||
|
||||
<<.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">>
|
||||
|
||||
<<.tip "Compare named filter run prefix `:reduce` with [[reduce Operator]] which is used to used to flatten a list of items down to a single item by repeatedly applying a subfilter.">>
|
||||
|
||||
<<.tip """Within the filter runs prefixed with `:reduce`, `:sort`, `:map` and `:filter`, the "currentTiddler" variable is set to the title of the tiddler being processed. The value of currentTiddler outside the subfilter is available in the variable "..currentTiddler".<<.from-version "5.2.0">>""" >>
|
||||
|
||||
In technical / logical terms:
|
||||
|
||||
|!Run |!Equivalent named prefix |!Interpretation |!Output |
|
||||
|`run` |`:or[run]` |de-duplicated union of sets |... OR run |
|
||||
|`=run` |`:all[run]` |union of sets without de-duplication |... OR run |
|
||||
|`+run` |`:and[run]` |accumulation of filter steps |... AND run |
|
||||
|`-run` |`:except[run]` |difference of sets |... AND NOT run |
|
||||
|`~run` |`:else[run]` |else |... ELSE run |
|
||||
||`:intersection`|intersection of sets||
|
||||
|
||||
For the difference between `+` and `:intersection`, see [[Intersection Filter Run Prefix (Examples)]].
|
||||
|
||||
The input of a run is normally a list of all the non-[[shadow|ShadowTiddlers]] tiddler titles in the wiki (in no particular order). But the `+` prefix can change this:
|
||||
|
||||
|Prefix|Input|h
|
||||
|`-`, `~`, `=`, `:intersection` or none| <$link to="all Operator">`[all[]]`</$link> tiddler titles, unless otherwise determined by the first [[filter operator|Filter Operators]]|
|
||||
|`+`, `:filter`, `:reduce`,`:sort`|the filter output of all previous runs so far|
|
||||
|
||||
Precisely because of varying inputs, be aware that both prefixes `-` and `+` do not behave inverse to one another!
|
||||
|
||||
For example, in both of the following, `$:/baz` will only be removed if it actually exists:
|
||||
|
||||
* <$link to="is Operator"> `foo bar $:/baz -[is[system]]`</$link>
|
||||
* <$link to="prefix Operator">`foo bar $:/baz -[prefix[$:/]]`</$link>
|
||||
|
||||
To understand why, consider the input for both final runs with their `-` prefix.
|
||||
|
||||
In order to remove `$:/baz` in any case, existing or not, simply use the `+` prefix with [[negated filter operators|Filter Operators]]:
|
||||
|
||||
* <$link to="is Operator">`foo bar $:/baz +[!is[system]]`</$link>
|
||||
* <$link to="prefix Operator">`foo bar $:/baz +[!prefix[$:/]]`</$link>
|
||||
<<.tip """If the diagram has no start and no end, as used in lower levels, it means that higher level syntax elements have been removed, to increase readability and simplicity. The breadcrumbs can be used to navigate""">>
|
||||
|
@ -1,6 +1,6 @@
|
||||
created: 20211129022707404
|
||||
modified: 20211204154839890
|
||||
tags: [[Filter Syntax]] [[Filter Run Prefix Examples]] [[Filter Filter Run Prefix]]
|
||||
modified: 20230305125338118
|
||||
tags: [[Filter Filter Run Prefix]]
|
||||
title: Filter Filter Run Prefix (Examples)
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
|
@ -1,27 +1,32 @@
|
||||
created: 20211129022455873
|
||||
modified: 20211129022550425
|
||||
tags: [[Filter Syntax]] [[Filter Run Prefix]]
|
||||
from-version: 5.1.23
|
||||
modified: 20230710073334078
|
||||
rp-input: the filter output of all previous runs so far
|
||||
rp-output: the input titles for which the filter run is not empty
|
||||
rp-purpose: remove every input title for which the filter run output is an empty list
|
||||
tags: [[Named 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 |
|
||||
<$railroad text="""
|
||||
\start none
|
||||
\end none
|
||||
( ":filter" | - )
|
||||
[[run|"Filter Run"]]
|
||||
"""/>
|
||||
|
||||
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".
|
||||
Note that within the filter run, the <<.var 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 <<.var ..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.
|
||||
* <<.var currentTiddler>> - the input title
|
||||
* <<.var ..currentTiddler>> - the value of the variable `currentTiddler` outside the filter run.
|
||||
* <<.var index>> - <<.from-version "5.2.1">> the numeric index of the current list item (with zero being the first item in the list).
|
||||
* <<.var revIndex>> - <<.from-version "5.2.1">> the reverse numeric index of the current list item (with zero being the last item in the list).
|
||||
* <<.var 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)]]
|
||||
[[Filter Filter Run Prefix (Examples)]]
|
||||
|
@ -1,15 +1,17 @@
|
||||
created: 20150220152540000
|
||||
modified: 20210629215024053
|
||||
tags: [[Filter Syntax]]
|
||||
modified: 20230710074423650
|
||||
tags: [[Filter Step]]
|
||||
title: Filter Parameter
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
<$railroad text="""
|
||||
( "[" [:{/"anything but ]"/}] "]"
|
||||
\start none
|
||||
\end none
|
||||
( "[" [: <-"hard"-> /"anything but ]"/] "]"
|
||||
|
|
||||
"{" [:{/"anything but }"/}] "}"
|
||||
"{" [: <-"indirect"-> /"anything but }"/] "}"
|
||||
|
|
||||
"<" [:{/"anything but >"/}] ">"
|
||||
"<" [: <-"variable"-> /"anything but >"/] ">"
|
||||
)
|
||||
"""/>
|
||||
|
||||
@ -24,9 +26,11 @@ The parameter to a [[filter operator|Filter Operators]] can be:
|
||||
:: The parameter is the text indicated by the [[text reference|TextReference]] whose name appears between the curly brackets, i.e. a [[field|TiddlerFields]] of a specified tiddler, or the value of a property of a specified [[data tiddler|DataTiddlers]].
|
||||
: <<.def variable>>
|
||||
:: `<like this>`
|
||||
:: 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 and including ~TiddlyWiki v5.1.23.
|
||||
:: 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>]`.
|
||||
|
||||
<<.from-version "5.1.23">> Filter operators support multiple parameters which are separated by a ` , ` character.
|
||||
---
|
||||
|
||||
<<.from-version "5.1.23">> [[Filter Step]]s support multiple parameters which are separated by a `,` character.
|
||||
|
||||
For example: `[param1],[param2]` or `<param1>,{param2}`
|
||||
|
@ -1,6 +1,6 @@
|
||||
created: 20201117073343969
|
||||
modified: 20211129032537195
|
||||
tags: [[Filter Syntax]] [[Filter Run Prefix Examples]]
|
||||
modified: 20230315152812472
|
||||
tags:
|
||||
title: Filter Run Prefix (Examples)
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
|
@ -0,0 +1,18 @@
|
||||
created: 20230305130600148
|
||||
modified: 20230711090913687
|
||||
tags: [[Filter Expression]]
|
||||
title: Filter Run Prefix
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
There are 2 types of filter run prefixes that are interchangeable. Named prefixes and shortcut prefixes.
|
||||
|
||||
<$railroad text="""
|
||||
\start none
|
||||
\end none
|
||||
(
|
||||
- |
|
||||
: [[<":named prefix"> /"starting with v5.1.23"/ |"Named Filter Run Prefix"]] |
|
||||
[[<"shortcut prefix"> /"prior to v5.1.23"/ |"Shortcut Filter Run Prefix"]]
|
||||
)
|
||||
[[run|"Filter Run"]]
|
||||
"""/>
|
@ -1,11 +1,13 @@
|
||||
created: 20150124182117000
|
||||
modified: 20150129133716000
|
||||
tags: [[Filter Syntax]]
|
||||
modified: 20230710074357002
|
||||
tags: [[Filter Expression]]
|
||||
title: Filter Run
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
<$railroad text="""
|
||||
( "[" { [[step|"Filter Step"]] } "]"
|
||||
\start none
|
||||
\end none
|
||||
( "[" { [[<"Filter Step">|"Filter Step"]] } "]"
|
||||
|
|
||||
[:{/"anything but [ ] or whitespace"/}]
|
||||
|
|
||||
@ -19,7 +21,6 @@ A <<.def run>> consists of [[steps|Filter Step]], and it outputs a [[selection|T
|
||||
|
||||
The steps are processed from left to right. The input to the first step is same as the input to the run. For each subsequent step, the input is the output of the previous step.
|
||||
|
||||
{{Selection Constructors}}
|
||||
|
||||
The lower three options in the diagram match syntax like `HelloThere`, `"HelloThere"`, `'HelloThere'` and `"Filter Operators"`. They are short for `[title[...]]`.
|
||||
|
||||
|
@ -1,23 +1,35 @@
|
||||
created: 20150124182127000
|
||||
modified: 20201103111044922
|
||||
tags: [[Filter Syntax]]
|
||||
modified: 20230710074414361
|
||||
tags: [[Filter Run]]
|
||||
title: Filter Step
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
A <<.def "filter step">> represents a single operation within a <<.def "filter run">>.
|
||||
|
||||
In programming terms, it is akin to a function call to which the step's input is passed as a parameter. A step's output is a [[title selection|Title Selection]] that contributes to a [[filter run|Filter Run]] and hence to the entire [[filter expression|Filter Expression]] that contains it.
|
||||
|
||||
<$railroad text="""
|
||||
\start none
|
||||
\end none
|
||||
[:"!"]
|
||||
[: [[operator|"Filter Operators"]] [:":" suffix] ]
|
||||
[[parameter|"Filter Parameter"]]
|
||||
( / "if omitted, defaults to: title" /|:
|
||||
( - | :[[operator|"Filter Operators"]] )
|
||||
{ [:":" [[suffix|"Filter Operators"]] ] } )
|
||||
{ [[parameter|"Filter Parameter"]] + "," }
|
||||
"""/>
|
||||
|
||||
A <<.def step>> represents a single operation within a [[filter|Filter Syntax]].
|
||||
The step's <<.def operator>> is drawn from a list of predefined keywoards which are known as [[filter operators|Filter Operators]].
|
||||
|
||||
In programming terms, it is akin to a function call to which [[the step's input|Filter Run]] is passed as an implicit parameter. A step's output is a [[selection|Title Selection]] that contributes to a [[run|Filter Run]] and hence to the entire [[filter expression|Filter Expression]] that contains it.
|
||||
|
||||
The step's <<.def operator>> is drawn from a list of [[predefined keywords|Filter Operators]], which can be extended by plugins. Any unrecognised operator is treated as if it was the suffix to the <<.olink field>> operator. If a step's operator is omitted altogether, it defaults to `title`.
|
||||
Many steps require an explicit <<.def parameter>>, that further defines what the step is to do.
|
||||
|
||||
The <<.def suffix>> is additional text, often the name of a [[field|TiddlerFields]], that extends the meaning of certain operators.
|
||||
|
||||
Many steps require an explicit <<.def parameter>> value, also known as an <<.def operand>>, that further defines what the step is to do.
|
||||
If a step's <<.def operator>> and <<.def suffix>> are //omitted// altogether, it defaults to the [[title|title Operator]] operator.
|
||||
|
||||
<<.from-version "5.1.23">> Some steps accept multiple parameters which are separated by a ` , ` character.
|
||||
<<.from-version "5.1.23">> Some steps accept multiple <<.def parameter>>s which are separated by a `,` character.
|
||||
|
||||
Any unrecognised operator is treated as if it was the suffix to the <<.olink field>> operator.
|
||||
|
||||
Filter operators can be extended by plugins.
|
||||
|
||||
{{Selection Constructors}}
|
||||
|
@ -1,18 +1,24 @@
|
||||
created: 20140210141217955
|
||||
modified: 20150124184229000
|
||||
list: [[Filter Expression]] [[Filter Run]] [[Filter Step]] [[Filter Parameter]] [[Filter Whitespace]]
|
||||
modified: 20230710074340943
|
||||
tags: Filters
|
||||
title: Filter Syntax
|
||||
type: text/vnd.tiddlywiki
|
||||
list: [[Filter Expression]] [[Filter Run]] [[Filter Step]] [[Filter Parameter]] [[Filter Whitespace]]
|
||||
|
||||
<<.preamble """[[Filters]] follow a grammar that is presented here, using [[railroad diagrams|Railroad Diagrams]], for those who find formal syntax descriptions helpful. However, you can [[learn to write filters|Introduction to filter notation]] without needing to understand this group of tiddlers.""">>
|
||||
|
||||
A <<.def filter>> is a pipeline for transforming an <<.def input>> into an <<.def output>>. Both the input and the output are [[ordered sets of titles|Title Selection]] of things like tiddlers and fields.
|
||||
A <<.def filter>> is a pipeline for transforming an <<.def input>> into an <<.def output>>. Both the input and the output are [[ordered sets of titles|Title Selection]] of tiddlers and fields.
|
||||
|
||||
Filters are [[expressions|Filter Expression]] constructed from smaller building blocks, called [[runs|Filter Run]] and [[steps|Filter Step]], each of which also transforms an input to an output.
|
||||
Filters are ''expressions'' constructed from smaller building blocks, called ''runs'', which are built using ''steps''. Eeach of which also transforms an input to an output.
|
||||
|
||||
A filter starts with an empty output. Its runs are processed from left to right, progressively modifying the output.
|
||||
|
||||
Here are details of the various building blocks involved:
|
||||
The "Filter Syntax" description starts with:
|
||||
|
||||
<<list-links "[tag[Filter Syntax]]">>
|
||||
<$railroad text="""
|
||||
\start double
|
||||
\end double
|
||||
[[<"Filter Expression">|"Filter Expression"]]
|
||||
"""/>
|
||||
|
||||
<<.tip "The railroad boxes as the one above can be used to navigate">>
|
@ -1,11 +1,13 @@
|
||||
created: 20150124182304000
|
||||
modified: 20150125105243000
|
||||
tags: [[Filter Syntax]]
|
||||
modified: 20230710074447240
|
||||
tags: [[Filter Expression]]
|
||||
title: Filter Whitespace
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
<$railroad text="""
|
||||
\start none
|
||||
\end none
|
||||
{( "space" | "tab" | "linefeed" | "return" | "vertical tab" | "formfeed" )}
|
||||
"""/>
|
||||
|
||||
Whitespace characters can appear between each [[run|Filter Run]] of a [[filter expression|Filter Expression]].
|
||||
Whitespace characters can appear between each run of a [[filter expression|Filter Expression]].
|
||||
|
@ -0,0 +1,44 @@
|
||||
created: 20230316151518640
|
||||
modified: 20230327130626715
|
||||
tags: [[Filter Run Prefix]]
|
||||
title: Interchangeable Filter Run Prefixes
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
!! Interchangeable Filter Run Prefixes
|
||||
|
||||
In technical / logical terms:
|
||||
|
||||
|!Run |!Equivalent named prefix |!Interpretation |!Output |
|
||||
|`[run]` |`:or[run]` |de-duplicated union of sets |... OR run |
|
||||
|`+[run]` |`:and[run]` |accumulation of filter steps |... AND run |
|
||||
|`-[run]` |`:except[run]` |difference of sets |... AND NOT run |
|
||||
|`~[run]` |`:else[run]` |else |... ELSE run |
|
||||
|`=[run]` |`:all[run]` |union of sets without de-duplication |... OR run |
|
||||
|
||||
The input of a run is normally a list of all the non-[[shadow|ShadowTiddlers]] tiddler titles in the wiki (in no particular order).<br>But the `+` prefix can change this:
|
||||
|
||||
|Prefix|Input|h
|
||||
|`-`, `~`, `=`, `:intersection` or none| <$link to="all Operator">`[all[]]`</$link> tiddler titles, unless otherwise determined by the first [[filter operator|Filter Operators]]|
|
||||
|`+`, `:filter`, `:map`, `:reduce`,`:sort` |the filter output of all previous runs so far|
|
||||
|
||||
Precisely because of varying inputs, be aware that both prefixes `-` and `+` do not behave inverse to one another!
|
||||
|
||||
For example, in both of the following, `$:/baz` will only be removed if it actually exists:
|
||||
|
||||
* <$link to="is Operator"> `foo bar $:/baz -[is[system]]`</$link>
|
||||
* <$link to="prefix Operator">`foo bar $:/baz -[prefix[$:/]]`</$link>
|
||||
|
||||
To understand why, consider the input for both final runs with their `-` prefix.
|
||||
|
||||
In order to remove `$:/baz` in any case, existing or not, simply use the `+` prefix with [[negated filter operators|Filter Operators]]:
|
||||
|
||||
* <$link to="is Operator">`foo bar $:/baz +[!is[system]]`</$link>
|
||||
* <$link to="prefix Operator">`foo bar $:/baz +[!prefix[$:/]]`</$link>
|
||||
|
||||
!! Difference between + and intersection
|
||||
|
||||
For the difference between `+` and `:intersection`, see [[Intersection Filter Run Prefix (Examples)]].
|
||||
|
||||
!! For Developers
|
||||
|
||||
To create a new filter run prefix, create a [[Javascript module|Modules]] with a [[module-type|ModuleType]] of `filterrunprefix`.
|
@ -1,6 +1,6 @@
|
||||
created: 20211128212902292
|
||||
modified: 20211128233320674
|
||||
tags: [[Filter Syntax]] [[Filter Run Prefix Examples]] [[Intersection Filter Run Prefix]]
|
||||
modified: 20230305125354209
|
||||
tags: [[Intersection Filter Run Prefix]]
|
||||
title: Intersection Filter Run Prefix (Examples)
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
|
@ -1,15 +1,20 @@
|
||||
created: 20211128212902292
|
||||
modified: 20211128212904721
|
||||
tags: [[Filter Syntax]] [[Filter Run Prefix]]
|
||||
from-version: 5.1.23
|
||||
modified: 20230710073322863
|
||||
rp-input: all titles from previous filter runs
|
||||
rp-output: the titles that are present in both the result of this filter run and the output from previous runs
|
||||
rp-purpose: find the intersection of titles from previous runs with titles in this filter
|
||||
tags: [[Named 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 |
|
||||
<$railroad text="""
|
||||
\start none
|
||||
\end none
|
||||
( ":intersection" | - )
|
||||
[[run|"Filter Run"]]
|
||||
"""/>
|
||||
|
||||
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)]]
|
||||
[[Intersection Filter Run Prefix (Examples)]]
|
||||
|
@ -1,6 +1,6 @@
|
||||
created: 20210618134753828
|
||||
modified: 20220724162340642
|
||||
tags: [[Filter Syntax]] [[Filter Run Prefix Examples]] [[Map Filter Run Prefix]]
|
||||
modified: 20230305125405422
|
||||
tags: [[Map Filter Run Prefix]]
|
||||
title: Map Filter Run Prefix (Examples)
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
|
@ -1,28 +1,33 @@
|
||||
created: 20210618133745003
|
||||
modified: 20220720190146771
|
||||
tags: [[Filter Syntax]] [[Filter Run Prefix]]
|
||||
from-version: 5.2.0
|
||||
modified: 20230710073315595
|
||||
rp-input: the filter output of all previous runs so far
|
||||
rp-output: the input titles as modified by the result of this filter run
|
||||
rp-purpose: modify input titles by the result of evaluating this filter run for each item
|
||||
rp-suffix: <<.from-version "5.2.3">> <<.value flat>> to return all results from the filter run, or omit (default) to return only the first result
|
||||
tags: [[Named Filter Run Prefix]]
|
||||
title: Map Filter Run Prefix
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
<<.from-version "5.2.0">>
|
||||
|
||||
|''purpose'' |modify input titles by the result of evaluating this filter run for each item |
|
||||
|''input'' |all titles from previous filter runs |
|
||||
|''suffix''|<<.from-version "5.2.3">> `flat` to return all results from the filter run, If omitted (default), only the first result is returned.|
|
||||
|''output''|the input titles as modified by the result of this filter run |
|
||||
<$railroad text="""
|
||||
\start none
|
||||
\end none
|
||||
( ":map" | - )
|
||||
[[run|"Filter Run"]]
|
||||
"""/>
|
||||
|
||||
Each input title from previous runs is passed to this run in turn. The filter run transforms the input titles and the output of this run replaces the input title. For example, the filter run `[get[caption]else{!!title}]` replaces each input title with its caption field, unless the field does not exist in which case the title is preserved.
|
||||
|
||||
Note that within the filter run, the "currentTiddler" variable is set to the title of the tiddler being processed. This permits filter runs like `:map[{!!price}multiply{!!cost}]` to be used for computation. The value of currentTiddler outside the run is available in the variable "..currentTiddler".
|
||||
Note that within the filter run, the <<.var currentTiddler>> variable is set to the title of the tiddler being processed. This permits filter runs like `:map[{!!price}multiply{!!cost}]` to be used for computation.
|
||||
|
||||
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.
|
||||
* <<.var currentTiddler>> - the input title
|
||||
* <<.var ..currentTiddler>> - the value of the variable `currentTiddler` outside the filter run.
|
||||
* <<.var index>> - <<.from-version "5.2.1">> the numeric index of the current list item (with zero being the first item in the list).
|
||||
* <<.var revIndex>> - <<.from-version "5.2.1">> the reverse numeric index of the current list item (with zero being the last item in the list).
|
||||
* <<.var length>> - <<.from-version "5.2.1">> the total length of the input list.
|
||||
|
||||
Filter runs used with the `:map` prefix should return at least the same number of items that they are passed. Any missing entries will be treated as an empty string. In particular, when retrieving the value of a field with the [[get Operator]] it is helpful to guard against a missing field value using the [[else Operator]]. For example `[get[myfield]else[default-value]...`.
|
||||
Filter runs used with the `:map` prefix should return at least the same number of items that they are passed. Input titles for which the filter run returns no output are replaced by an empty string. In particular, when retrieving the value of a field with the [[get Operator]] it is helpful to guard against a missing field value using the [[else Operator]]. For example `[get[myfield]else[default-value]...`.
|
||||
|
||||
[[Examples|Map Filter Run Prefix (Examples)]]
|
||||
[[Map Filter Run Prefix (Examples)]]
|
@ -1,10 +1,36 @@
|
||||
created: 20201214044413473
|
||||
modified: 20211118025845599
|
||||
tags: [[Filter Syntax]]
|
||||
modified: 20230711090833212
|
||||
tags: [[Filter Run Prefix]]
|
||||
title: Named Filter Run Prefix
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
<$set name="prefixlist" filter="""[all[shadows+tiddlers]has[module-type]module-type[filterrunprefix]trim:prefix[$:/core/modules/filterrunprefixes/]trim:suffix[.js]addprefix["]addsuffix["]join[|]addprefix[(]addsuffix[)]]""">
|
||||
<$railroad text=<<prefixlist>>/>
|
||||
</$set>
|
||||
In <<.from-version "5.1.23">> the named filter run prefixes where implemented. `:cascade`, `:map` and `:sort` have been added later as shown in the diagrams.
|
||||
|
||||
A named filter run prefix can precede any [[run|Filter Run]] of a [[filter expression|Filter Expression]] in place of a single-character prefix (`+`, `-` and so on). To create a new filter run prefix, create a [[Javascript module|Modules]] with a [[module-type|ModuleType]] of `filterrunprefix`.
|
||||
A named filter run prefix can precede any [[run|Filter Run]] of a [[filter expression|Filter Expression]] in place of a [[shortcut run prefix|Shortcut Filter Run Prefix]].
|
||||
|
||||
<$railroad text="""
|
||||
\start none
|
||||
\end none
|
||||
(
|
||||
[[<":all"> |"All Filter Run Prefix"]] |
|
||||
[[<":and"> |"And Filter Run Prefix"]] |
|
||||
[[<":cascade"> /"v5.2.1"/ |"Cascade Filter Run Prefix"]] |
|
||||
[[<":else"> |"Else Filter Run Prefix"]] |
|
||||
[[<":except"> |"Except Filter Run Prefix"]] |
|
||||
[[<":filter"> |"Filter Filter Run Prefix"]] |
|
||||
[[<":intersection"> |"Intersection Filter Run Prefix"]] |
|
||||
[[<":map"> /"v5.2.0"/ |"Map Filter Run Prefix"]] |
|
||||
[[<":or"> |"Or Filter Run Prefix"]] |
|
||||
[[<":reduce"> |"Reduce Filter Run Prefix"]] |
|
||||
[[<":sort"> /"v5.2.0"/ |"Sort Filter Run Prefix"]] |
|
||||
[[<":then"> /"v5.3.0"/ |"Then Filter Run Prefix"]]) [[run|"Filter Run"]]
|
||||
"""/>
|
||||
|
||||
|
||||
<<.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">>
|
||||
|
||||
<<.tip "Compare named filter run prefix `:reduce` with [[reduce Operator]] which is used to used to flatten a list of items down to a single item by repeatedly applying a subfilter">>
|
||||
|
||||
<<.tip """Within the filter runs prefixed with `:reduce`, `:sort`, `:map` and `:filter`, the <<.var currentTiddler>> variable is set to the title of the tiddler being processed.<br>The value of currentTiddler outside the subfilter is available in the variable <<.var "..currentTiddler">> <<.from-version "5.2.0">>""" >>
|
||||
|
||||
Also see: [[Interchangeable Filter Run Prefixes]]
|
||||
|
@ -0,0 +1,18 @@
|
||||
created: 20230318135743766
|
||||
from-version: 5.1.23
|
||||
modified: 20230322140708372
|
||||
rp-input: all titles from previous filter runs
|
||||
rp-output: output titles are [[dominantly appended|Dominant Append]] to the output of previous filter runs
|
||||
rp-purpose: de-duplicated union of tiddler sets
|
||||
tags: [[Named Filter Run Prefix]]
|
||||
title: Or Filter Run Prefix
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
<$railroad text="""
|
||||
\start none
|
||||
\end none
|
||||
( ":or" | - )
|
||||
[[run|"Filter Run Prefix"]]
|
||||
"""/>
|
||||
|
||||
The :or prefix is equivalent to using no prefix at all. See `run` at [[Shortcut Filter Run Prefix]]
|
@ -1,6 +1,6 @@
|
||||
created: 20211124151912931
|
||||
modified: 20211124160747921
|
||||
tags: [[Filter Syntax]] [[Reduce Filter Run Prefix]] [[Filter Run Prefix Examples]]
|
||||
modified: 20230305125430544
|
||||
tags: [[Reduce Filter Run Prefix]]
|
||||
title: Reduce Filter Run Prefix (Examples)
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
|
@ -1,25 +1,34 @@
|
||||
created: 20211124151912931
|
||||
modified: 20211124170117511
|
||||
tags: [[Filter Syntax]] [[Filter Run Prefix]]
|
||||
from-version: 5.1.23
|
||||
modified: 20230710073305239
|
||||
rp-input: the filter output of all previous runs so far
|
||||
rp-output: the accumulated single item
|
||||
rp-purpose: replaces all filter output so far with a single item by repeatedly applying a filter run to each input title
|
||||
tags: [[Named Filter Run Prefix]]
|
||||
title: Reduce Filter Run Prefix
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
<<.from-version "5.1.23">>
|
||||
|
||||
|''purpose'' |replaces all filter output so far with a single item by repeatedly applying a filter run to each input title |
|
||||
|''input'' |all titles from previous filter runs |
|
||||
|''output''|the accumulated single item |
|
||||
<$railroad text="""
|
||||
\start none
|
||||
\end none
|
||||
( ":reduce" | - )
|
||||
[[run|"Filter Run"]]
|
||||
"""/>
|
||||
|
||||
Each input title from previous runs is passed to this run in turn. The result of each previous call to this run is made available in the next call via the variable named "accumulator". The result of the last call to this run is returned as the output. A typical use is to add up the values in a given field of each input title.
|
||||
|
||||
Each input title from previous runs is passed to this run in turn. The result of each previous call to this run is made available in the next call via the variable named <<.var accumulator>>. The result of the last call to this run is returned as the output. A typical use is to add up the values in a given field of each input title.
|
||||
|
||||
Replaces all filter output so far with a single item by repeatedly applying a formula, as described above, to each input title.
|
||||
|
||||
The following variables are available within the filter run:
|
||||
|
||||
* ''accumulator'' - the result of the previous filter run
|
||||
* ''currentTiddler'' - the input title
|
||||
* ''..currentTiddler'' - the value of the variable `currentTiddler` outside the filter run. <<.from-version "5.2.0">>
|
||||
* ''index'' - the numeric index of the current list item (with zero being the first item in the list)
|
||||
* ''revIndex'' - the reverse numeric index of the current list item (with zero being the last item in the list)
|
||||
* ''length'' - the total length of the input list
|
||||
* <<.var accumulator>> - the result of the previous filter run
|
||||
* <<.var currentTiddler>> - the input title
|
||||
* <<.var ..currentTiddler>> - the value of the variable `currentTiddler` outside the filter run. <<.from-version "5.2.0">>
|
||||
* <<.var index>> - the numeric index of the current list item (with zero being the first item in the list)
|
||||
* <<.var revIndex>> - the reverse numeric index of the current list item (with zero being the last item in the list)
|
||||
* <<.var length>> - the total length of the input list
|
||||
|
||||
<<.tip "Compare named filter run prefix `:reduce` with [[reduce Operator]] which is used to flatten a list of items down to a single item by repeatedly applying a subfilter.">>
|
||||
|
||||
@ -35,4 +44,4 @@ is equivalent to:
|
||||
[tag[shopping]reduce<num-items>]
|
||||
```
|
||||
|
||||
[[Examples|Reduce Filter Run Prefix (Examples)]]
|
||||
[[Reduce Filter Run Prefix (Examples)]]
|
@ -0,0 +1,29 @@
|
||||
created: 20230305131705188
|
||||
modified: 20230710074438655
|
||||
tags: [[Filter Run Prefix]]
|
||||
title: Shortcut Filter Run Prefix
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
Shortcut prefixes are commonly used by advanced users because they are fast to type but they are harder to read by less experienced users. That's why [[named prefixes|Named Filter Run Prefix]] have been created, which are more verbose. Shortcut and named filter run prefixes are interchangeable as shown in the table below.
|
||||
|
||||
<$railroad text="""
|
||||
\start none
|
||||
\end none
|
||||
(-|:"+"|"-"|"~"|"=")
|
||||
[[run|"Filter Run"]]
|
||||
"""/>
|
||||
|
||||
If a run has:
|
||||
|
||||
* no prefix, its output titles are [[dominantly appended|Dominant Append]] to the filter's output
|
||||
|
||||
* the prefix `+`, it receives the filter output so far as its input; its output then <<.em "replaces">> all filter output so far and forms the input for the next run
|
||||
|
||||
* the prefix `-`, output titles are <<.em removed>> from the filter's output (if such tiddlers exist)
|
||||
|
||||
* 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">>
|
||||
|
||||
* the prefix `=`, output titles are appended to the filter's output without de-duplication. <<.from-version "5.1.20">>
|
||||
|
||||
|
||||
{{Interchangeable Filter Run Prefixes}}
|
@ -1,6 +1,6 @@
|
||||
created: 20210428074912172
|
||||
modified: 20210428085746041
|
||||
tags: [[Filter Syntax]] [[Sort Filter Run Prefix]] [[Filter Run Prefix Examples]]
|
||||
modified: 20230315165343329
|
||||
tags: [[Sort Filter Run Prefix]]
|
||||
title: Sort Filter Run Prefix (Examples)
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
|
@ -1,19 +1,26 @@
|
||||
created: 20210428083929749
|
||||
modified: 20210522162628946
|
||||
tags: [[Filter Syntax]] [[Filter Run Prefix]]
|
||||
from-version: 5.2.0
|
||||
modified: 20230322140722470
|
||||
rp-input: the filter output of all previous runs so far
|
||||
rp-output: output titles replace the output of previous filter runs
|
||||
rp-purpose: sort the input titles by the result of evaluating this filter run for each item
|
||||
rp-suffix: the <<.op :sort>> filter run prefix uses a rich suffix, see below for details
|
||||
tags: [[Named Filter Run Prefix]]
|
||||
title: Sort Filter Run Prefix
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
<<.from-version "5.2.0">>
|
||||
|
||||
|''purpose'' |sort the input titles by the result of evaluating this filter run for each item |
|
||||
|''input'' |all titles from previous filter runs |
|
||||
|''suffix'' |the `:sort` filter run prefix uses a rich suffix, see below for details |
|
||||
|''output''|the sorted result of previous filter runs |
|
||||
<$railroad text="""
|
||||
\start none
|
||||
\end none
|
||||
( ":sort" )
|
||||
( : ":string" | ":alphanumeric" | ":number" | ":integer" | ":version" | ":date" )
|
||||
( : ":casesensitive" /"required for string and alphanumeric"/ | ":caseinsensitive" /"required for string and alphanumeric"/ | ":reverse" /"optional"/ | - )
|
||||
[[run|"Filter Run"]]
|
||||
"""/>
|
||||
|
||||
Each input title from previous runs is passed to this run in turn. The filter run transforms the input titles into the form needed for sorting. For example, the filter run `[length[]]` transforms each input title in to the number representing its length, and thus sorts the input titles according to their length.
|
||||
|
||||
Note that within the filter run, the "currentTiddler" variable is set to the title of the tiddler being processed. This permits filter runs like `:sort:number[{!!value}divide{!!cost}]` to be used for computation. The value of currentTiddler outside the run is available in the variable "..currentTiddler".
|
||||
Note that within the filter run, the <<.var currentTiddler>> variable is set to the title of the tiddler being processed. This permits filter runs like `:sort:number[{!!value}divide{!!cost}]` to be used for computation. The value of <<.var currentTiddler>> outside the run is available in the variable <<.var "..currentTiddler">>.
|
||||
|
||||
The `:sort` filter run prefix uses an extended syntax that allows for multiple suffixes, some of which are required:
|
||||
|
||||
|
@ -1,45 +1,14 @@
|
||||
created: 20210618133745003
|
||||
from-version: 5.3.0
|
||||
modified: 20230506172920710
|
||||
modified: 20230710074225410
|
||||
rp-input: <<.olink all>> tiddler titles
|
||||
rp-output: the output of this filter run replaces the output of previous runs unless it is an empty list (see below)
|
||||
rp-purpose: replace any input to this filter run with its output, only evaluating the run when there is any input
|
||||
search:
|
||||
tags: [[Filter Run Prefix]] [[Filter Syntax]]
|
||||
tags: [[Named Filter Run Prefix]]
|
||||
title: Then Filter Run Prefix
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
\define .op-row()
|
||||
<$macrocall $name=".if"
|
||||
cond="""$(op-body)$"""
|
||||
then="""<tr><th align="left">$(op-head)$</th><td><<.op-place>>$(op-body)$</td></tr>"""
|
||||
else=""/>
|
||||
\end
|
||||
|
||||
<$list filter="[all[current]has[from-version]]" variable="listItem">
|
||||
<$macrocall $name=".from-version" version={{!!from-version}}/>
|
||||
</$list>
|
||||
<$let op-head="" op-body="" op-name="">
|
||||
<table class="doc-table">
|
||||
<!-- purpose -->
|
||||
<$let op-head="purpose" op-body={{!!rp-purpose}}>
|
||||
<<.op-row>>
|
||||
</$let>
|
||||
<!-- input -->
|
||||
<$let op-head="[[input|Filter Expression]]" op-body={{!!rp-input}}>
|
||||
<<.op-row>>
|
||||
</$let>
|
||||
<!-- suffix -->
|
||||
<$let op-head="suffix" op-body={{!!rp-suffix}} op-name={{!!rp-suffix-name}}>
|
||||
<<.op-row>>
|
||||
</$let>
|
||||
<!-- output -->
|
||||
<$let op-head="output" op-body={{!!rp-output}}>
|
||||
<<.op-row>>
|
||||
</$let>
|
||||
</table>
|
||||
</$let>
|
||||
|
||||
<$railroad text="""
|
||||
\start none
|
||||
\end none
|
||||
@ -47,8 +16,6 @@ type: text/vnd.tiddlywiki
|
||||
[[run|"Filter Run"]]
|
||||
"""/>
|
||||
|
||||
!Introduction
|
||||
|
||||
The <<.op :then>> filter run prefix is used to replace the result of all previous filter runs with its output.
|
||||
|
||||
If the result of all previous runs is an empty list, the <<.op :then>> prefixed filter run is not evaluated.
|
||||
@ -67,5 +34,5 @@ The major difference between the <<.op then>> operator and a <<.op :then>> prefi
|
||||
|^<<.operator-example m1-1 "[tag[WikiText]] :then[[true]]">>|^<<.operator-example m1-2 "[tag[WikiText]then[true]]">><p>To make them equivalent, additional filter steps may be added:</p> <<.operator-example m1-3 "[tag[WikiText]count[]compare:number:gt[0]then[true]]">>|
|
||||
|
||||
|
||||
! [[Examples|Then Filter Run Prefix (Examples)]]
|
||||
[[Then Filter Run Prefix (Examples)]]
|
||||
|
||||
|
@ -4,7 +4,7 @@ modified: 20201118192155504
|
||||
op-input: a list of items
|
||||
op-output: the input list with the title specified in the parameter toggled
|
||||
op-parameter: the <<.op toggle>> operator accepts 1 or more parameters, see below for details
|
||||
op-purpose: toggle the title specified in the operand in the input
|
||||
op-purpose: toggle the title specified in the parameter in the input
|
||||
tags: [[Filter Operators]] [[Listops Operators]] [[Order Operators]]
|
||||
title: toggle Operator
|
||||
type: text/vnd.tiddlywiki
|
||||
@ -19,7 +19,7 @@ The <<.op toggle>> operator requires at least one parameter and can accept addit
|
||||
* ''title1'' : a title to toggle in the input list. If it is already present, it is removed. Otherwise, it is added.
|
||||
* ''title2'': (optional). When the second parameter is provided, the operator toggles between the two values in the input list. If neither is present, the first parameter takes precedence is added to the list.
|
||||
|
||||
With more than two parameters, the <<.op toggle>> behaves similar to the [[cycle|cycle Operator]] and can be used to cycle through a list of values. Note that all operands should be unique.
|
||||
With more than two parameters, the <<.op toggle>> behaves similar to the [[cycle|cycle Operator]] and can be used to cycle through a list of values. Note that all parameters should be unique.
|
||||
|
||||
<$macrocall $name=".tip" _="While the <<.op cycle>> operator interprets its first parameter as a list of titles to cycle through and offers similar functionality, the <<.op toggle>> operator accepts an unlimited number of distinct parameters."/>
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
created: 20140112190154121
|
||||
modified: 20140912142655205
|
||||
modified: 20240202121048363
|
||||
tags: SystemTiddlers
|
||||
title: Naming of System Tiddlers
|
||||
type: text/vnd.tiddlywiki
|
||||
@ -17,11 +17,11 @@ The system tiddlers provided as part of the core are named according to the foll
|
||||
|`$:/core/wiki/*` |lowercase |Metadata about the entire wiki |
|
||||
|`$:/docs/*` |lowercase |Documentation tiddlers |
|
||||
|`$:/messages/*` |~CamelCase |System messages |
|
||||
|`$:/plugins/*` |lowercase |Plugin tiddlers, and plugin content |
|
||||
|`$:/plugins/*` |lowercase |[[Plugin|Plugins]] tiddlers, and plugin content |
|
||||
|`$:/snippets/*` |//inconsistent// |Reusable snippets (will be replaced by macros) |
|
||||
|`$:/state/*` |lowercase |User interface state tiddlers |
|
||||
|`$:/state/*` |lowercase |User interface state tiddlers (see StateMechanism) |
|
||||
|`$:/tags/*` |~CamelCase |User interface configuration tags |
|
||||
|`$:/temp/*` |lowercase |Temporary tiddlers that shouldn't be saved |
|
||||
|`$:/temp/*` |lowercase |[[Temporary tiddlers|Temporary Tiddlers]] that shouldn't be saved |
|
||||
|`$:/themes/*` |lowercase |Theme plugins |
|
||||
|
||||
In the format column:
|
||||
|
@ -1,8 +1,8 @@
|
||||
caption: {{$:/language/SideBar/Contents/Caption}}
|
||||
created: 20140809114010378
|
||||
list: HelloThere Learning [[Working with TiddlyWiki]] [[Customise TiddlyWiki]] Features Languages Editions Plugins Platforms Reference Community About
|
||||
list: HelloThere Learning [[Working with TiddlyWiki]] [[Customise TiddlyWiki]] Features Filters Languages Editions Plugins Platforms Reference Community About
|
||||
list-after: $:/core/ui/SideBar/Open
|
||||
modified: 20150414070242411
|
||||
modified: 20230322150307580
|
||||
tags: $:/tags/SideBar
|
||||
title: TableOfContents
|
||||
type: text/vnd.tiddlywiki
|
||||
|
49
editions/tw5.com/tiddlers/system/filter-run-template.tid
Normal file
49
editions/tw5.com/tiddlers/system/filter-run-template.tid
Normal file
@ -0,0 +1,49 @@
|
||||
code-body: yes
|
||||
created: 20230316112235083
|
||||
list-before: $:/core/ui/ViewTemplate/body
|
||||
modified: 20230326145802667
|
||||
tags: $:/tags/ViewTemplate
|
||||
title: $:/editions/tw5.com/filter-run-template
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
\define .op-place()
|
||||
<$macrocall $name=".if"
|
||||
cond="""$(op-name)$"""
|
||||
then="<<.place '$(op-name)$'>> = "
|
||||
else=""/>
|
||||
\end
|
||||
|
||||
\define .op-row()
|
||||
<$macrocall $name=".if"
|
||||
cond="""$(op-body)$"""
|
||||
then="""<tr><th align="left">$(op-head)$</th><td><<.op-place>>$(op-body)$</td></tr>"""
|
||||
else=""/>
|
||||
\end
|
||||
|
||||
\whitespace trim
|
||||
|
||||
<$list filter="[all[current]tag[Named Filter Run Prefix]]">
|
||||
<$let op-head="" op-body="" op-name="">
|
||||
<table class="doc-table">
|
||||
<!-- purpose -->
|
||||
<$let op-head="purpose" op-body={{!!rp-purpose}}>
|
||||
<<.op-row>>
|
||||
</$let>
|
||||
<!-- input -->
|
||||
<$let op-head="[[input|Filter Expression]]" op-body={{!!rp-input}}>
|
||||
<<.op-row>>
|
||||
</$let>
|
||||
<!-- suffix -->
|
||||
<$let op-head="[[suffix|Filter Run Prefix]]" op-body={{!!rp-suffix}} op-name={{!!rp-suffix-name}}>
|
||||
<<.op-row>>
|
||||
</$let>
|
||||
<!-- output -->
|
||||
<$let op-head="output" op-body={{!!rp-output}}>
|
||||
<<.op-row>>
|
||||
</$let>
|
||||
</table>
|
||||
<$list filter="[all[current]has[from-version]]" variable="listItem">
|
||||
<$macrocall $name=".from-version" version={{!!from-version}}/>
|
||||
</$list>
|
||||
</$let>
|
||||
</$list>
|
@ -2,82 +2,63 @@ created: 20150203173506000
|
||||
list-before: $:/core/ui/ViewTemplate/body
|
||||
modified: 20230602181119360
|
||||
tags: $:/tags/ViewTemplate
|
||||
code-body: yes
|
||||
title: $:/editions/tw5.com/operator-template
|
||||
|
||||
\define .op-place()
|
||||
<$macrocall $name=".if"
|
||||
cond="""$(op-name)$"""
|
||||
then="<<.place '$(op-name)$'>> = "
|
||||
else=""/>
|
||||
cond="""$(op-name)$"""
|
||||
then="<<.place '$(op-name)$'>> = "
|
||||
else=""/>
|
||||
\end
|
||||
|
||||
\define .op-row()
|
||||
<$macrocall $name=".if"
|
||||
cond="""$(op-body)$"""
|
||||
then="""<tr><th align="left">$(op-head)$</th><td><<.op-place>>$(op-body)$</td></tr>"""
|
||||
else=""/>
|
||||
cond="""$(op-body)$"""
|
||||
then="""<tr><th align="left">$(op-head)$</th><td><<.op-place>>$(op-body)$</td></tr>"""
|
||||
else=""/>
|
||||
\end
|
||||
|
||||
<$set name="op-head" value="">
|
||||
<$set name="op-body" value="">
|
||||
<$set name="op-name" value="">
|
||||
\whitespace trim
|
||||
|
||||
<$list filter="[all[current]tag[Filter Operators]]">
|
||||
<table class="doc-table before-tiddler-body">
|
||||
<!-- -->
|
||||
<$set name="op-head" value="purpose">
|
||||
<$set name="op-body" value={{!!op-purpose}}>
|
||||
<<.op-row>>
|
||||
</$set>
|
||||
</$set>
|
||||
<!-- -->
|
||||
<$set name="op-head" value="[[input|Filter Syntax]]">
|
||||
<$set name="op-body" value={{!!op-input}}>
|
||||
<<.op-row>>
|
||||
</$set>
|
||||
</$set>
|
||||
<!-- -->
|
||||
<$set name="op-head" value="`!` input">
|
||||
<$set name="op-body" value={{!!op-neg-input}}>
|
||||
<<.op-row>>
|
||||
</$set>
|
||||
</$set>
|
||||
<!-- -->
|
||||
<$set name="op-head" value="[[suffix|Filter Step]]">
|
||||
<$set name="op-body" value={{!!op-suffix}}>
|
||||
<$set name="op-name" value={{!!op-suffix-name}}>
|
||||
<<.op-row>>
|
||||
</$set>
|
||||
</$set>
|
||||
</$set>
|
||||
<!-- -->
|
||||
<$set name="op-head" value="[[parameter|Filter Parameter]]">
|
||||
<$set name="op-body" value={{!!op-parameter}}>
|
||||
<$set name="op-name" value={{!!op-parameter-name}}>
|
||||
<<.op-row>>
|
||||
</$set>
|
||||
</$set>
|
||||
</$set>
|
||||
<!-- -->
|
||||
<$set name="op-head" value="output">
|
||||
<$set name="op-body" value={{!!op-output}}>
|
||||
<<.op-row>>
|
||||
</$set>
|
||||
</$set>
|
||||
<!-- -->
|
||||
<$set name="op-head" value="`!` output">
|
||||
<$set name="op-body" value={{!!op-neg-output}}>
|
||||
<<.op-row>>
|
||||
</$set>
|
||||
</$set>
|
||||
<!-- -->
|
||||
</table>
|
||||
<$let op-head="" op-body="" op-name="">
|
||||
<table class="doc-table before-tiddler-body">
|
||||
<!-- purpose -->
|
||||
<$let op-head="purpose" op-body={{!!op-purpose}}>
|
||||
<<.op-row>>
|
||||
</$let>
|
||||
<!-- input -->
|
||||
<$let op-head="[[input|Filter Syntax]]" op-body={{!!op-input}}>
|
||||
<<.op-row>>
|
||||
</$let>
|
||||
<!-- input negated -->
|
||||
<$let op-head="`!` input" op-body={{!!op-neg-input}}>
|
||||
<<.op-row>>
|
||||
</$let>
|
||||
<!-- suffix -->
|
||||
<$let op-head="[[suffix|Filter Step]]" op-body={{!!op-suffix}} op-name={{!!op-suffix-name}}>
|
||||
<<.op-row>>
|
||||
</$let>
|
||||
<!-- parameter -->
|
||||
<$let op-head="[[parameter|Filter Parameter]]" op-body={{!!op-parameter}} op-name={{!!op-parameter-name}}>
|
||||
<<.op-row>>
|
||||
</$let>
|
||||
<!-- output -->
|
||||
<$let op-head="output" op-body={{!!op-output}}>
|
||||
<<.op-row>>
|
||||
</$let>
|
||||
<!-- output negated -->
|
||||
<$let op-head="`!` output" op-body={{!!op-neg-output}}>
|
||||
<<.op-row>>
|
||||
</$let>
|
||||
</table>
|
||||
<p>
|
||||
[[Learn more about how to use Filters|Filters]]
|
||||
</p>
|
||||
|
||||
<p>[[Learn more about how to use Filters|Filters]]</p>
|
||||
|
||||
<$list filter="[all[current]has[from-version]]" variable="listItem">
|
||||
<p><$macrocall $name=".from-version" version={{!!from-version}}/></p>
|
||||
<$list filter="[all[current]has[from-version]]" variable="listItem">
|
||||
<$macrocall $name=".from-version" version={{!!from-version}}/>
|
||||
</$list>
|
||||
</$let>
|
||||
</$list>
|
||||
</$list>
|
||||
</$set>
|
||||
</$set>
|
||||
</$set>
|
||||
|
@ -27,7 +27,7 @@ As described in [[HTML in WikiText]], you can also transclude tiddler field valu
|
||||
<$text text={{MyTiddler}}/>
|
||||
```
|
||||
|
||||
As described in [[Introduction to filter notation]], you can also transclude tiddler field values as filter operands. For example:
|
||||
As described in [[Introduction to filter notation]], you can also transclude tiddler field values using the [[filter syntax|Filter Syntax]]. For example:
|
||||
|
||||
```
|
||||
{{{ [tag{TiddlerContainingMyTag}] }}}
|
||||
@ -47,7 +47,7 @@ As described in [[HTML in WikiText]], you can also transclude a variable as the
|
||||
<$text text=<<myMacro>>/>
|
||||
```
|
||||
|
||||
As described in [[Introduction to filter notation]], you can also transclude a variable as the value of a filter operand. For example:
|
||||
As described in [[Introduction to filter notation]], you can also transclude a variable as the value of a filter parameter using the [[filter syntax|Filter Syntax]]. For example:
|
||||
|
||||
```
|
||||
{{{ [tag<myMacro>] }}}
|
||||
|
@ -559,3 +559,5 @@ Wang Ke, @Gk0Wk, 2023/10/17
|
||||
@etardiff, 2023/12/10
|
||||
|
||||
John Long, @drevarr, 2023/12/12
|
||||
|
||||
Ed Holsinger, @eschlon, 2024/02/08
|
||||
|
Loading…
Reference in New Issue
Block a user