1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-16 02:19:55 +00:00

Merge pull request #1417 from aelocson/filter-docs

Overhaul the filter operator documentation
This commit is contained in:
Jeremy Ruston 2015-01-26 18:43:24 +00:00
commit b81432aee2
211 changed files with 2223 additions and 1175 deletions

View File

@ -1,6 +1,8 @@
created: 20150117174359000
modified: 20150117205257000
title: Commands
tags: Reference
tags: Concepts Reference
Commands are used with [[TiddlyWiki on Node.js|Using TiddlyWiki on Node.js]].
A <<.def command>> is one of the following words, written with a `--` prefix and used as a command-line option to [[TiddlyWiki on Node.js]], indicating which action is desired.
<<list-links "[tag[Commands]]">>

View File

@ -0,0 +1,13 @@
created: 20150117204109000
modified: 20150124185709000
tags: Concepts
title: Absolute Operators
type: text/vnd.tiddlywiki
The output of a [[filter|Filters]] step depends on its [[operator|Filter Operators]]:
* Most operators perform <<.def relative>> to their input. They examine each input title in turn and filter out any that don't match. Such steps narrow down the output of a run.
* <<.def Absolute>> operators ignore their input and generate an independent output instead.
A good example of an absolute operator is <<.olink title>>. The output of `[title[A]title[B]]` is just <<.tid B>>. But the <<.olink field>> operator is relative, so `[title[A]field:title[B]` outputs nothing at all.

View File

@ -0,0 +1,28 @@
created: 20150117190213631
modified: 20150124214537000
tags: Concepts
title: Date Fields
type: text/vnd.tiddlywiki
Certain [[fields|TiddlerFields]] of a tiddler are used to store dates and times.
The two standard date fields are <<.field created>> and <<.field modified>>.
Values of date fields are 17-character strings:
* 4 digits for the year
* 2 digits for the month
* 2 digits for the day
* 2 digits for the hour
* 2 digits for the minute
* 2 digits for the second
* 3 digits for the millisecond
To avoid problems arising from differences of time zone, TiddlyWiki always uses [[UTC|http://en.wikipedia.org/wiki/Coordinated_Universal_Time]].
As an example, the <<.field created>> field of this tiddler has the value <<.value """<$view field="created"/>""">>.
Dates can be [[converted to other formats|DateFormat]] for display:
<$macrocall $name="wikitext-example-without-html"
src="""<$view field="created" format="date" template="DDD DDth MMM YYYY"/>""">

View File

@ -0,0 +1,11 @@
created: 20150123220223000
modified: 20150124185028000
tags: Concepts
title: Dominant Append
type: text/vnd.tiddlywiki
[[Filters]] manipulate [[sets of titles|Title Selection]] in which no title may appear more than once. Furthermore, they often need to append one such set to another.
This is done in such a way that, if a title would be duplicated, the earlier copy of that title is discarded. The titles being appended are dominant.
For example, if a selection contains `Andrew Becky Clara Daniel` and `Andrew Barney Clara Daisy` is then appended to it, the result is `Becky Daniel Andrew Barney Clara Daisy`.

View File

@ -1,13 +1,13 @@
created: 20130827080000000=
modified: 20140912145347313
created: 20130827080000000
modified: 20150124183938000
tags: Reference Concepts
title: Filters
type: text/vnd.tiddlywiki
list: [[Introduction to filter notation]] [[Filter Syntax]]
You can think of TiddlyWiki as a database where the records are tiddlers. A database typically provides a way of discovering which records match a given pattern, and in ~TiddlyWiki this is done with filters.
You can think of TiddlyWiki as a database in which the records are tiddlers. A database typically provides a way of discovering which records match a given pattern, and in ~TiddlyWiki this is done with filters.
A <<doc-def filter>> is a concise notation for selecting a particular set of tiddlers, known as its <<doc-def "result">>. Whenever ~TiddlyWiki encounters a filter, it calculates the result. Further work can then be done with just those tiddlers, such as [[counting|CountWidget]] or [[listing|ListWidget]] them.
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 [[list-links macro|ListMacro]] to display a list of all tiddlers whose titles start with the letter H:
@ -15,11 +15,11 @@ The following example passes a filter to the [[list-links macro|ListMacro]] to d
<<list-links "[prefix[H]]">>
```
The result of a filter can change as tiddlers are added and deleted in the wiki. ~TiddlyWiki recalculates the results on the fly, automatically updating any filter-based counts or lists as well.
A filter's output can change as tiddlers are added and deleted in the wiki. ~TiddlyWiki recalculates on the fly, automatically updating any filter-based counts or lists as well.
[[Advanced Search|$:/AdvancedSearch]] has a <<doc-advancedsearch-tab Filter>> tab that makes it easy to experiment with filters.
[[Advanced Search|$:/AdvancedSearch]] has a <<.advancedsearch-tab Filter>> tab that makes it easy to experiment with filters.
;Find out more:
* [[Introduction to filter notation]] -- a step-by-step walkthrough
* [[Filter Syntax]] -- the exact rules of the notation
* [[FilterOperators]] -- the available methods of filtering
* [[Filter Syntax]] -- the detailed technical rules
* [[Filter Operators]] -- the available methods of filtering

View File

@ -0,0 +1,15 @@
created: 20150123220237000
modified: 20150124120447000
tags: Concepts
title: Hard and Soft Links
type: text/vnd.tiddlywiki
A <<.def "hard link">> is one that can be detected by a superficial examination of WikiText.
A link is <<.def "soft">> if it is:
* contained in text [[trancluded|Transclusion]] from elsewhere
* supplied via a [[macro|Macros]] or [[variable|Variables]]
* generated by a link widget whose <<.attr to>> attribute is a transclusion, macro or variable
Soft links are not detected by link-related filter operators such as <<.olink backlinks>>, <<.olink links>>, <<.olink all>> and <<.olink is>>.

View File

@ -0,0 +1,15 @@
created: 20150124125646000
modified: 20150124202917000
tags: Concepts
title: Order of Tagged Tiddlers
When ~TiddlyWiki generates a list of the tiddlers that have a particular tag (e.g. the dropdown list of a tag pill), it orders the tiddlers using the following rules:
# Start with any that are [[declared|Title List]] in the <<.field list>> field of the tag tiddler, in the order given there.
# In each remaining tiddler <<.place T>>, look for a <<.field list-before>> field. If this has a tiddler title as its value, place <<.place T>> just <<.em before>> that one.
#* As a special case, if the field exists but its value is empty, place <<.place T>> at the very start of the list.
# In each remaining tiddler <<.place T>>, look for a <<.field list-after>> field. If this has a tiddler title as its value, place tiddler <<.place T>> just <<.em after>> that one.
# If any tiddlers still remain, place them at the end of the list. <!-- in alphabetical order if #1378 is accepted; then also update Tagging -->

View File

@ -1,8 +1,8 @@
created: 20150105133800000
modified: 20150105134300000
title: RailroadDiagrams
modified: 20150124181306000
title: Railroad Diagrams
Railroad diagrams, sometimes called syntax diagrams, are a visual way of explaining the syntax rules of a computer language. Reading one is like reading a public transport map.
<<.def "Railroad diagrams">>, sometimes called <<.def "syntax diagrams">>, are a visual way of explaining the syntax rules of a computer language. Reading one is like reading a public transport map.
Each diagram starts on the left and ends on the right. Simply follow any line from the startpoint to the endpoint. All the alternative lines are equally valid. A line will sometimes jump over an item that is optional, or loop back to indicate that an item can be repeated.
@ -14,4 +14,4 @@ In the example above, a comma appears between each occurrence of the `repeated`
Characters in round boxes are literal, i.e. they denote themselves. A name in a rectangular box denotes a further railroad diagram.
The railroad diagrams on this site are generated with the [[Railroad Plugin]].
The railroad diagrams in ~TiddlyWiki's documentation are generated with the [[Railroad Plugin]].

View File

@ -1,5 +1,5 @@
created: 201308270759
modified: 201311011115
modified: 20150124211238000
tags: Concepts
title: TextReference
@ -14,7 +14,7 @@ Text references are made up of several parts, most of which can be optional:
Text references can be used in several places:
* As IndirectOperands within [[Filters]] (eg, `<$list filter="[tag{MyTag!!name}]"/>`)
* As [[indirect parameters|Filter Parameter]] within [[Filters]] (eg, `<$list filter="[tag{MyTag!!name}]"/>`)
* As IndirectAttributes of an element or widget (eg, `<$widget attrib={{Title!!description}}/>`)
* As the operand of a shortcut transclusion (eg, `{{MyTiddler!!title}}`)
* As the `state` attribute of the RevealWidget and the LinkCatcherWidget

View File

@ -1,12 +1,14 @@
created: 20150117152418000
modified: 20150124205659000
tags: Concepts
title: TitleList
title: Title List
A title list is a line of text that presents one or more tiddler titles, strung together with a space between each one and the next.
A <<.def "title list">> is a line of text that presents one or more tiddler titles, strung together with a space between each one and the next.
If a title //contains// a space, it needs double square brackets around it.
Example:
If a title <<.em contains>> a space, it needs double square brackets around it:
`GettingStarted [[Discover TiddlyWiki]] Upgrading`
Title lists are used in various places, including PermaLinks and the ListField.
They are in fact the simplest case of a [[filter|Filters]], and are thus a way of expressing a [[selection of titles|Title Selection]].

View File

@ -0,0 +1,10 @@
created: 20150117152418000
modified: 20150124202920000
tags: Concepts
title: Title Selection
A <<.def "title selection">> is an ordered set of tiddler titles (or similar strings), in which no title appears more than once.
Title selections are important in [[filter|Filters]] processing.
The simplest way to write one down is as a [[title list|Title List]].

View File

@ -1,6 +1,7 @@
created: 201308251431
modified: 201308251431
modified: 20150124131347000
tags: task
title: Kill the Dragon
list-before: Get the Ring
//This is a sample task for the TaskManagementExample//

View File

@ -1,6 +1,7 @@
color: #8d9ac3
created: 201308252132
modified: 201308252132
modified: 20150124123528000
title: task
list: [[Make the beds]]
Sample tasks for the TaskManagementExample.
Sample tasks for the TaskManagementExample.

View File

@ -0,0 +1,13 @@
created: 20150117192110000
modified: 20150123214636000
title: Days of the Week
type: text/vnd.tiddlywiki
list: Monday Tuesday Wednesday Thursday Friday Saturday Sunday
short: Mon Tue Wed Thu Fri Sat Sun
my-special-list: [[listed Operator (Examples)]]
<<.this-is-operator-example>>
It has a <<.field list>> field containing the following items:
<<list-links "[list[]]">>

View File

@ -0,0 +1,6 @@
created: 20150117192111000
modified: 20150118131534000
title: Friday
type: text/vnd.tiddlywiki
<<.this-is-operator-example>>

View File

@ -0,0 +1,6 @@
created: 20150117192113000
modified: 20150118131645000
title: Monday
type: text/vnd.tiddlywiki
<<.this-is-operator-example>>

View File

@ -0,0 +1,6 @@
created: 20151620490000000
modified: 20150118131537000
title: Saturday
type: text/vnd.tiddlywiki
<<.this-is-operator-example>>

View File

@ -0,0 +1,6 @@
created: 20150117192115000
modified: 20150118131539000
title: Sunday
type: text/vnd.tiddlywiki
<<.this-is-operator-example>>

View File

@ -0,0 +1,13 @@
created: 20150117192116000
modified: 20150124204253000
title: Thursday
type: text/vnd.tiddlywiki
<<.this-is-operator-example>>
! <<.olink before>> and <<.olink after>>
<<.using-days-of-week>>
<<.operator-example 1 "[list[Days of the Week]before{!!title}]">>
<<.operator-example 2 "[list[Days of the Week]after{!!title}]">>

View File

@ -0,0 +1,6 @@
created: 20150117192118000
modified: 20150118131558000
title: Tuesday
type: text/vnd.tiddlywiki
<<.this-is-operator-example>>

View File

@ -0,0 +1,6 @@
created: 20150117192119000
modified: 20150118131707000
title: Wednesday
type: text/vnd.tiddlywiki
<<.this-is-operator-example>>

View File

@ -1,10 +1,11 @@
created: 20130830092500000
modified: 20140919155816993
modified: 20150124202924000
tags: Fields
title: ListField
caption: list
type: text/vnd.tiddlywiki
The `list` [[field of a tiddler|TiddlerFields]] is an optional feature that can be used to help structure your content. It is defined as an ordered sequence of tiddler titles, and it can be used in several ways:
The `list` [[field of a tiddler|TiddlerFields]] is an optional feature that can be used to help structure your content. Its value is a [[title list|Title List]], and it can be used in several ways:
* The `list` field of a tiddler that is being used as a tag determines the ordering of the tiddlers that carry that tag - see [[Tagging]] for details
* The `list` [[filter|Filters]] selects the entries from a list

View File

@ -1,15 +0,0 @@
created: 20140410103123179
modified: 20140410103123179
tags: Filters
caption: addprefix
title: FilterOperator: addprefix
type: text/vnd.tiddlywiki
The ''addprefix'' filter operator add a prefix to all titles in the current list.
For example:
|!Filter String |!Description |
|`one two three +[addprefix[tid-]]` |Returns `tid-one`, `tid-two`, `tid-three` |
See also [[FilterOperator: prefix]], [[FilterOperator: suffix]], [[FilterOperator: addsuffix]], [[FilterOperator: removeprefix]] and [[FilterOperator: removesuffix]].

View File

@ -1,15 +0,0 @@
created: 20140828133830424
modified: 20140902145613329
tags: Filters
caption: addsuffix
title: FilterOperator: addsuffix
type: text/vnd.tiddlywiki
The ''addsuffix'' filter operator adds a suffix to all titles in the current list.
For example:
|!Filter String |!Description |
|`one two three +[addsuffix[-tid]]` |Returns `one-tid`, `two-tid`, `three-tid` |
See also [[FilterOperator: suffix]], [[FilterOperator: prefix]], [[FilterOperator: addprefix]], [[FilterOperator: removesuffix]], and [[FilterOperator: removeprefix]].

View File

@ -1,21 +0,0 @@
created: 20140512103123179
modified: 20140512103123179
tags: Filters
title: FilterOperator: after
caption: after
type: text/vnd.tiddlywiki
The ''after'' filter operator returns the tiddler from the current list that is after the tiddler named in the operand.
The following examples assume a tiddler called `MyList` with a `list` field containing:
```
one two three four five
```
|!Filter String |!Description |
|`[list[MyList]after[two]]` |Returns `three` |
|`[list[MyList]after[five]]` |Returns an empty list |
|`[list[MyList]after{!!title}]` |Returns `five` if the current tiddler is `four` |
See also [[FilterOperator: before]], [[FilterOperator: previous]] and [[FilterOperator: next]].

View File

@ -1,22 +0,0 @@
created: 20140410103123179
modified: 20140410103123179
tags: Filters CommonFilters
title: FilterOperator: all
caption: all
type: text/vnd.tiddlywiki
The ''all'' filter operator is used to select combinations of lists of tiddlers for subsequent operations.
The operand of the ''all'' operator is a list of names of tiddler sources joined with `+`.
For example:
|!Filter String |!Description |
|`[all[tiddlers]]` |Selects all 'real' tiddlers (both system and non-system), excluding shadow tiddlers |
|`[all[shadows]]` |Selects all ShadowTiddlers, including those that have been overridden with real tiddlers |
|`[all[shadows+tiddlers]]` |Selects all ShadowTiddlers and all 'real' tiddlers together |
|`[all[current]]` |Selects the current tiddler |
|`[all[missing]]` |Selects all MissingTiddlers |
|`[all[orphans]]` |Selects all OrphanTiddlers |
|`[all[]]` |Selects all the source tiddlers available to the filter |

View File

@ -1,16 +0,0 @@
created: 20140410103123179
modified: 20140410103123179
tags: Filters
caption: backlinks
title: FilterOperator: backlinks
type: text/vnd.tiddlywiki
The ''backlinks'' filter operator replaces the current list with a list of the non-system tiddlers that link to them.
For example:
|!Filter String |!Description |
|`[[HelloThere]backlinks[]]` |Selects all tiddlers that contain links to the tiddler `HelloThere` |
|`[tag[Personal]backlinks[]]` |Selects all tiddlers that contain links to tiddlers tagged `Personal` |
|`[all[current]backlinks[]]` |Selects all tiddlers that contain links to the current tiddler |

View File

@ -1,21 +0,0 @@
created: 20140512103123179
modified: 20140512103123179
tags: Filters
caption: before
title: FilterOperator: before
type: text/vnd.tiddlywiki
The ''before'' filter operator returns the tiddler from the current list that is before the tiddler named in the operand.
The following examples assume a tiddler called `MyList` with a `list` field containing:
```
one two three four five
```
|!Filter String |!Description |
|`[list[MyList]before[two]]` |Returns `one` |
|`[list[MyList]before[one]]` |Returns an empty list |
|`[list[MyList]before{!!title}]` |Returns `three` if the current tiddler is `four` |
See also [[FilterOperator: after]], [[FilterOperator: previous]] and [[FilterOperator: next]].

View File

@ -1,8 +0,0 @@
created: 20140410103123179
modified: 20140410103123179
tags: Filters
caption: bf
title: FilterOperator: bf
type: text/vnd.tiddlywiki
The ''bf'' filter operator is a synonym for [[FilterOperator: rest]].

View File

@ -1,8 +0,0 @@
created: 20140410103123179
modified: 20140410103123179
tags: Filters
caption: butfirst
title: FilterOperator: butfirst
type: text/vnd.tiddlywiki
The ''butfirst'' filter operator is a synonym for [[FilterOperator: rest]].

View File

@ -1,14 +0,0 @@
created: 20140410103123179
modified: 20140410103123179
tags: Filters
caption: butlast
title: FilterOperator: butlast
type: text/vnd.tiddlywiki
Without an operand, the ''butlast'' filter operator returns all but the last entry in the current list. The optional operand specifies the number of entries to omit.
For example:
|!Filter String |!Description |
|`one two three four five +[butlast[]]` |Returns `one`, `two`, `three`, `four` |
|`one two three four five +[butlast[2]]` |Returns `one`, `two`, `three` |

View File

@ -1,14 +0,0 @@
created: 20140410103123179
modified: 20140410103123179
tags: Filters
caption: commands
title: FilterOperator: commands
type: text/vnd.tiddlywiki
The ''commands'' filter operator replaces the current list with a list of the available commands (see the HelpCommand for details).
For example:
|!Filter String |!Description |
|`[commands[]]` |Returns a list of the available command names |

View File

@ -1,27 +0,0 @@
created: 20140410103123179
modified: 20140410103123179
tags: Filters
caption: each
title: FilterOperator: each
type: text/vnd.tiddlywiki
The ''each'' filter operator filters the current list to leave only the first tiddler with each distinct value for a specified field.
For example:
|!Filter String |!Description |
|`[all[tiddlers]sort[title]each[type]]` |Returns a list of the first tiddler with each distinct ''type'' field |
The ''each'' operator can be used to group tiddlers. For example, the following example creates a list of tiddlers split into types:
<$list filter="[!is[system]has[type]!type[text/vnd.tiddlywiki]each[type]sort[type]]">
<div>
! <$view field="type"/>
<$list filter="[type{!!type}!is[system]sort[title]]">
<div>
<$link to={{!!title}}><$view field="title"/></$link>
</div>
</$list>
</div>
</$list>

View File

@ -1,21 +0,0 @@
created: 20140410103123179
modified: 20140410103123179
tags: Filters
caption: eachday
title: FilterOperator: eachday
type: text/vnd.tiddlywiki
The ''eachday'' filter operator filters the current list to leave only the first tiddler that has a distinct value for a specified date field.
For example:
|!Filter String |!Description |
|`[eachday[created]]` |Returns a list of the first tiddler created on each distinct day |
The ''eachday'' operator can be used to group tiddlers. For example, the following wiki text creates a list of the number of tiddlers that were modified on each day:
<$list filter="[!is[system]eachday[modified]!sort[modified]]">
<$view field="modified" format="date" template="DD MMM YYYY"/>: <$count filter="[sameday{!!modified}]"/> modifications
</$list>

View File

@ -1,10 +0,0 @@
created: 20150111145738451
modified: 20150111145738451
tags: Filters
caption: editiondescription
title: FilterOperator: editiondescription
type: text/vnd.tiddlywiki
The ''editiondescription'' filter operator returns a description string for each edition name in the current results. It is only available under Node.js.
Also see [[FilterOperator: editions]].

View File

@ -1,8 +0,0 @@
created: 20150111145738451
modified: 20150111145738451
tags: Filters
caption: editions
title: FilterOperator: editions
type: text/vnd.tiddlywiki
The ''editions'' filter operator returns the names of all the available editions. It is only available under Node.js.

View File

@ -1,16 +0,0 @@
created: 20140410103123179
modified: 20140410103123179
tags: Filters CommonFilters
caption: field
title: FilterOperator: field
type: text/vnd.tiddlywiki
The ''field'' filter operator filters the current list according to whether a field matches a specified value.
The operand is the value to match, and the suffix is used to identify the field. For example:
|!Filter String |!Description |
|`[field:modifier[JeremyRuston]]` |Returns a list of the tiddlers created by `JeremyRuston` |
|`[modifier[JeremyRuston]]` |Returns a list of the tiddlers created by `JeremyRuston` |
Note that if an unknown filter operator `[unknown[xxx]]` is encountered it is interpreted as `[field:unknown[xxx]]`.

View File

@ -1,13 +0,0 @@
caption: fields
created: 20140924115616653
modified: 20141002150019737
tags: Filters
title: FilterOperator: fields
type: text/vnd.tiddlywiki
The ''fields'' filter operator returns the names of all the fields used in the currently selected tiddlers.
|!Filter String |!Description |
|`[[HelloThere]fields[]]` |Returns the fields present in the tiddler `HelloThere` |
|`[tag[myTag]fields[]]` |Returns the aggregate of all the fields present on tiddlers that have the tag `myTag` |

View File

@ -1,14 +0,0 @@
created: 20140410103123179
modified: 20140410103123179
tags: Filters
caption: first
title: FilterOperator: first
type: text/vnd.tiddlywiki
The ''first'' filter operator returns the first entries in the current list. The optional operand specifies the number of entries to return.
For example:
|!Filter String |!Description |
|`one two three +[first[]]` |Returns `one` |
|`one two three +[first[2]]` |Returns `one`, `two` |

View File

@ -1,13 +0,0 @@
created: 20140426183123179
modified: 20140426183123179
tags: Filters
caption: get
title: FilterOperator: get
type: text/vnd.tiddlywiki
The ''get'' filter operator replaces the titles of the tiddlers in the current list with the values of the field specified by the operand.
For example:
|!Filter String |!Description |
|`[all[current]get[draft.of]]` |If the current tiddler is a draft, returns the original tiddler, otherwise returns an empty list |

View File

@ -1,14 +0,0 @@
created: 20140410103123179
modified: 20140410103123179
tags: Filters CommonFilters
caption: has
title: FilterOperator: has
type: text/vnd.tiddlywiki
The ''has'' filter operator chooses tiddlers from the current list that have a non-empty value for the field specified in the operand.
For example:
|!Filter String |!Description |
|`[has[modifier]]` |Returns tiddlers that have a `modifier` field |

View File

@ -1,14 +0,0 @@
created: 20140410103123179
modified: 20140410103123179
tags: Filters
title: FilterOperator: indexes
caption: indexes
type: text/vnd.tiddlywiki
The ''indexes'' filter operator returns a list of all the property indexes found in the DataTiddlers in the current list. Tiddlers that are not DataTiddlers are ignored.
For example:
|!Filter String |!Description |
|`[[MyData]indexes[]]` |Returns the indexes of all properties in the data tiddler `MyData` |
|`[{$:/palette}indexes[]sort[title]]` |Returns the names of all the colours defined in the current [[colour palette|ColourPalettes]] |

View File

@ -1,29 +0,0 @@
created: 20140410103123179
modified: 20140418103123179
tags: Filters CommonFilters
caption: is
title: FilterOperator: is
type: text/vnd.tiddlywiki
The ''is'' filter operator selects tiddlers from the current list according to their membership of the category specified in the operand:
* `[is[current]]` - returns any tiddler that matches the title of the current tiddler
* `[is[image]]` - tiddlers that contain an image (eg, GIF, JPEG, PNG etc.)
* `[is[missing]]` - MissingTiddlers that are referenced but undefined
* `[is[orphan]]` - OrphanTiddlers that are not referenced from any other tiddler
* `[is[shadow]]` - tiddlers that are ShadowTiddlers
* `[is[system]]` - tiddlers that are SystemTiddlers
* `[is[tiddler]]` - tiddlers that are not MissingTiddlers
* `[is[tag]]` - tiddlers that are being used as tags
For example:
|!Filter String |!Description |
|`[tag[task]is[shadow]]` |Returns ShadowTiddlers tagged `task` |
|`[tag[task]!is[system]]` |Returns non-SystemTiddlers tagged `task` |
|`[is[shadow]]` |Returns ShadowTiddlers that have been overridden by a 'real' tiddler |
|`[!is[shadow]]` |Returns ordinary tiddlers that are not shadow tiddlers |
|`[!is[tag]]` |Returns all tiddlers that are not being used as tags |
|`[is[missing]]` |Returns an empty list (see note below) |
Note that the ''is'' filter operator strictly filters the current list by choosing whether or not to include each one in the output. It never adds tiddlers to the results that are not already listed. This means that when used at the start of a run of filter operators the ''is'' operator will be choosing from the currently existing tiddlers, and so will never return missing tiddlers, or shadow tiddlers that haven't been overridden.

View File

@ -1,14 +0,0 @@
created: 20140410103123179
modified: 20140410103123179
tags: Filters
caption: last
title: FilterOperator: last
type: text/vnd.tiddlywiki
The ''last'' filter operator returns the last entries in the current list. The optional operand specifies the number of entries to return.
For example:
|!Filter String |!Description |
|`one two three +[last[]]` |Returns `three` |
|`one two three +[last[2]]` |Returns `two`, `three` |

View File

@ -1,15 +0,0 @@
created: 20140410103123179
modified: 20140410103123179
tags: Filters CommonFilters
caption: limit
title: FilterOperator: limit
type: text/vnd.tiddlywiki
The ''limit'' filter operator trims the current list to the length specified in the operator. Usually the first tiddlers in the list are returned; preceding the operator with ''!'' causes it to instead return the last tiddlers in the list.
For example:
|!Filter String |!Description |
|`[sort[modified]!limit[20]]` |Returns the titles of the last 20 tiddlers to have been modified |
|`[has[created]sort[created]limit[10]]` |Returns the titles of the oldest 10 tiddlers to have been created |

View File

@ -1,14 +0,0 @@
created: 20140410103123179
modified: 20140410103123179
tags: Filters CommonFilters
caption: links
title: FilterOperator: links
type: text/vnd.tiddlywiki
The ''links'' filter operator replaces the current list with a list of the targets of outgoing links from those tiddlers.
For example:
|!Filter String |!Description |
|`[[HelloThere]links[]]` |Returns the titles of tiddlers linked from `HelloThere` |
|`[all[current]links[]]` |Returns the titles of tiddlers linked from the current tiddler |

View File

@ -1,16 +0,0 @@
created: 20140410103123179
modified: 20140410103123179
tags: Filters
caption: list
title: FilterOperator: list
type: text/vnd.tiddlywiki
The ''list'' filter operator replaces the current list with the list contained in the TextReference specified in the operand. The default field for the text reference is `list`.
Preceding the operator name with `!` inverts the logic so that the filter only returns the tiddlers in the current list that are not listed in the specified list.
For example:
|!Filter String |!Description |
|`[list[HelloThere]]` |Returns the list of tiddlers in the `list` field of the tiddler `HelloThere` |
|`[list[HelloThere!!mylist]]` |Returns the list of tiddlers in the `mylist` field of the tiddler `HelloThere` |

View File

@ -1,14 +0,0 @@
created: 20140410103123179
modified: 20140613103123179
tags: Filters
caption: listed
title: FilterOperator: listed
type: text/vnd.tiddlywiki
The ''listed'' filter operator returns the titles of the tiddlers that have `list` fields that contain any members of the current list. The optional operand can be used to specify a different field.
For example:
|!Filter String |!Description |
|`[[HelloThere]listed[]]` |Returns the titles of any tiddlers containing `HelloThere` in their `list` fields |
|`[all[current]listed[my-special-list]]` |Returns the titles of any tiddlers containing the current tiddler in their `my-special-list` fields |

View File

@ -1,15 +0,0 @@
created: 20140410103123179
modified: 20140410103123179
tags: Filters
caption: modules
title: FilterOperator: modules
type: text/vnd.tiddlywiki
The ''modules'' filter operator treats the current list as a list of [[module types|ModuleType]], and returns the titles of all of the modules of those types.
For example:
|!Filter String |!Description |
|`[[filteroperator]modules[]]` |Returns a list of the modules of type `filteroperator` |
See also [[FilterOperator: moduletypes]].

View File

@ -1,15 +0,0 @@
created: 20140410103123179
modified: 20140410103123179
tags: Filters
caption: moduletypes
title: FilterOperator: moduletypes
type: text/vnd.tiddlywiki
The ''moduletypes'' filter operator replaces the current list with a list of the types of the currently loaded modules.
For example:
|!Filter String |!Description |
|`[moduletypes[]]` |Returns a list of the types of the currently loaded modules |
See also [[FilterOperator: modules]].

View File

@ -1,21 +0,0 @@
created: 20140410103123179
modified: 20140410103123179
tags: Filters
caption: next
title: FilterOperator: next
type: text/vnd.tiddlywiki
The ''next'' filter operator takes each tiddler in the current list and looks it up in the `list` field of the tiddler specified in the operand, and then returns the immediately following tiddler title.
The following examples assume a tiddler called `MyList` with a `list` field containing:
```
one two three four five
```
|!Filter String |!Description |
|`[[three]next[MyList]]` |Returns `four` |
|`[[five]next[MyList]]` |Returns an empty list |
|`one three +[next[MyList]]` |Returns `two`, `four` |
See also [[FilterOperator: previous]].

View File

@ -1,16 +0,0 @@
created: 20140410103123179
modified: 20140410103123179
tags: Filters
caption: nsort
title: FilterOperator: nsort
type: text/vnd.tiddlywiki
The ''nsort'' filter operator sorts the current list as numeric values, along the field specified in the operand (which defaults to `title`). String values are sorted case insensitively (upper and lower case letters are considered equivalent). Preceding the operator with `!` reverses the sort order.
For example:
|!Filter String |!Description |
|`10 010 1000 100 +[nsort[]]` |Returns `10`, `010`, `100`, `1000` |
|`10 010 alpha 1000 100 +[nsort[]]` |Returns `10`, `010`, `100`, `1000`, `alpha` |
See also [[FilterOperator: sort]], [[FilterOperator: sortcs]] and [[FilterOperator: nsortcs]].

View File

@ -1,16 +0,0 @@
created: 20140410103123179
modified: 20140410103123179
tags: Filters
caption: nsortcs
title: FilterOperator: nsortcs
type: text/vnd.tiddlywiki
The ''nsortcs'' filter operator sorts the current list as numeric values, along the field specified in the operand (which defaults to `title`). String values are sorted case sensitively (upper and lower case letters are considered different). Preceding the operator with `!` reverses the sort order.
For example:
|!Filter String |!Description |
|`10 010 1000 100 +[nsortcs[]]` |Returns `10`, `010`, `100`, `1000` |
|`10 010 alpha 1000 100 +[nsortcs[]]` |Returns `10`, `010`, `100`, `1000`, `alpha` |
See also [[FilterOperator: sort]], [[FilterOperator: sortcs]] and [[FilterOperator: nsort]].

View File

@ -1,14 +0,0 @@
created: 20140410103123179
modified: 20140410103123179
tags: Filters
caption: nth
title: FilterOperator: nth
type: text/vnd.tiddlywiki
Without an operand, the ''nth'' filter operator returns the first entry in the current list. The optional operand specifies the position of the entry in the list.
For example:
|!Filter String |!Description |
|`one two three four five +[nth[]]` |Returns `one` |
|`one two three four five +[nth[3]]` |Returns `three` |

View File

@ -1,15 +0,0 @@
created: 20140410103123179
modified: 20140410103123179
tags: Filters
caption: plugintiddlers
title: FilterOperator: plugintiddlers
type: text/vnd.tiddlywiki
The ''plugintiddlers'' filter operator returns the titles of the shadow tiddlers within any plugin tiddlers in the current list.
For example:
|!Filter String |!Description |
|`[[$:/core]plugintiddlers[]]` |Returns a list of the shadow tiddlers within the [[$:/core]] module |
See also [[FilterOperator: shadowsource]].

View File

@ -1,16 +0,0 @@
created: 20140410103123179
modified: 20140410103123179
tags: Filters
caption: prefix
title: FilterOperator: prefix
type: text/vnd.tiddlywiki
The ''prefix'' filter operator returns the titles in the current list that start with a specified prefix. If the ''prefix'' operator is preceded by `!` then it returns the titles that do not start with the specified prefix.
For example:
|!Filter String |!Description |
|`[tag[task]!prefix[hidden]]` |Returns tiddlers tagged `task` whose titles do not start with `hidden` |
|`[prefix[$:/]]` |Equivalent to `[is[system]]` |
See also [[FilterOperator: removeprefix]], [[FilterOperator: removesuffix]], [[FilterOperator: removesuffix]], [[FilterOperator: addprefix]], and [[FilterOperator: addsuffix]].

View File

@ -1,21 +0,0 @@
created: 20140410103123179
modified: 20140410103123179
tags: Filters
caption: previous
title: FilterOperator: previous
type: text/vnd.tiddlywiki
The ''previous'' filter operator takes each tiddler in the current list and looks it up in the `list` field of the tiddler specified in the operand, and then returns the immediately preceding tiddler title.
The following examples assume a tiddler called `MyList` with a `list` field containing:
```
one two three four five
```
|!Filter String |!Description |
|`[[three]previous[MyList]]` |Returns `two` |
|`[[one]previous[MyList]]` |Returns an empty list |
|`two four +[previous[MyList]]` |Returns `one`, `three` |
See also [[FilterOperator: next]].

View File

@ -1,37 +0,0 @@
created: 20140909134102102
modified: 20140909134102102
tags: Filters
caption: regexp
title: FilterOperator: regexp
type: text/vnd.tiddlywiki
The ''regexp'' filter operator filters tiddlers that match a regular expression.
Regular expressions are a way of encoding complex string matching criteria. The format is defined fully in [[this Mozilla reference|https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions]].
The regexp filter operator takes a fieldname as the optional suffix (defaulting to `title`).
The regular expression itself can start or end with an optional string to specify flags in the format `(?flags)` where flags can be "g", "m" or "i". Only the "i" flag is generally useful: it forces the match to be case-insensitive (ie upper and lower case letters are considered the same).
For example:
|!Filter String |!Description |
|`[all[tiddlers]regexp[EggCup]]` |Selects all tiddlers that have the CamelCase string "EggCup" in their title |
|`[all[tiddlers]regexp[eggcup(?i)]]` |Selects all tiddlers that have the string "eggcup" in their title (ignoring case) |
|`[all[tiddlers]regexp[(?i)\.jpe?g$]]` |Selects all tiddlers with titles ending in ".jpg" or ".jpeg" (ignoring case) |
|`[all[tiddlers]regexp:modified[^2014]]` |Selects all tiddlers whose modified field starts with the string "2014" |
! Regular Expressions with Square Brackets
Note that the filter syntax doesn't allow you to directly enter regular expressions that include square brackets. Instead, you should use a variable to store the filter string. For example, the following regular expression matches all titles that contain any combination the letters "a", "b" and "c" (with no other characters present).
```
<$set name="myfilter" value="^[abc]*$">
<$list filter="[regexp:title<myfilter>]">
<div>
<$view field="title"/>
</div>
</$list>
</$set>
```

View File

@ -1,15 +0,0 @@
created: 20140410103123179
modified: 20140410103123179
tags: Filters
caption: removeprefix
title: FilterOperator: removeprefix
type: text/vnd.tiddlywiki
The ''removeprefix'' filter operator returns the titles in the current list that start with a specified prefix with the prefix removed.
For example:
|!Filter String |!Description |
|`tid-one tid-two three +[removeprefix[tid-]]` |Returns `one`, `two` |
See also [[FilterOperator: prefix]], [[FilterOperator: suffix]], [[FilterOperator: removesuffix]], [[FilterOperator: addprefix]], and [[FilterOperator: addsuffix]].

View File

@ -1,15 +0,0 @@
created: 20140828133830424
modified: 20140902145613329
tags: Filters
caption: removesuffix
title: FilterOperator: removesuffix
type: text/vnd.tiddlywiki
The ''removesuffix'' filter operator returns the titles in the current list that end with a specified suffix with the suffix removed.
For example:
|!Filter String |!Description |
|`one-tid two-tid three +[removesuffix[-tid]]` |Returns `one`, `two` |
See also [[FilterOperator: suffix]], [[FilterOperator: prefix]], [[FilterOperator: removeprefix]], [[FilterOperator: addprefix]], and [[FilterOperator: addsuffix]].

View File

@ -1,14 +0,0 @@
created: 20140410103123179
modified: 20140410103123179
tags: Filters
caption: rest
title: FilterOperator: rest
type: text/vnd.tiddlywiki
Without an operand, the ''rest'' filter operator returns all but the first entry in the current list. The optional operand specifies the number of entries to omit.
For example:
|!Filter String |!Description |
|`one two three four five +[rest[]]` |Returns `two`, `three`, `four`, `five` |
|`one two three four five +[rest[2]]` |Returns `three`, `four`, `five` |

View File

@ -1,13 +0,0 @@
created: 20140410103123179
modified: 20140410103123179
tags: Filters
caption: reverse
title: FilterOperator: reverse
type: text/vnd.tiddlywiki
The ''reverse'' filter operator reverses the order of the titles in the current list.
For example:
|!Filter String |!Description |
|`one two three +[reverse[]]` |Returns the list `three`, `two`, `one` |

View File

@ -1,16 +0,0 @@
created: 20140410103123179
modified: 20140410103123179
tags: Filters
caption: sameday
title: FilterOperator: sameday
type: text/vnd.tiddlywiki
The ''sameday'' filter operator filters the current list to leave only those tiddlers whose `modified` field is on the same day as the date provided as the operand. The optional suffix allows a different field to be specified.
For example:
|!Filter String |!Description |
|`[sameday[20140410]]` |Returns a list of the tiddlers modified on the 10th April 2014 |
|`[sameday:created[20140410]]` |Returns a list of the tiddlers created on the 10th April 2014 |
See [[FilterOperator: eachday]] for an example.

View File

@ -1,17 +0,0 @@
created: 20140410103123179
modified: 20140410103123179
tags: Filters CommonFilters
caption: search
title: FilterOperator: search
type: text/vnd.tiddlywiki
The ''search'' filter operator filters the current list to leave only those tiddlers that include the operand text in their title, body or tags. Preceding the operator with `!` returns all tiddlers that do not include the specified text. The search is case-insenstive.
Optionally, a field can be specified to restrict the search.
For example:
|!Filter String |!Description |
|`[search[alsatian]]` |Returns a list of the tiddlers containing the text "alsatian" |
|`[all[shadows]search[alsatian]]` |Returns a list of the shadow tiddlers containing the text "alsatian" |
|`[search:caption[spaniel]]` |Returns a list of the tiddlers containing the text "spaniel" in their caption field |

View File

@ -1,15 +0,0 @@
created: 20140410103123179
modified: 20140410103123179
tags: Filters
title: FilterOperator: shadowsource
caption: shadowsource
type: text/vnd.tiddlywiki
The ''shadowsource'' filter operator returns the titles of the plugin tiddlers containing any ShadowTiddlers in the current list.
For example:
|!Filter String |!Description |
|`[[$:/core/copyright.txt]shadowsource[]]` |Returns `$:/core`, which is the plugin that contains the shadow tiddler [[$:/core/copyright.txt]] |
See also [[FilterOperator: plugintiddlers]].

View File

@ -1,18 +0,0 @@
created: 20140410103123179
modified: 20140410103123179
tags: Filters CommonFilters
title: FilterOperator: sort
caption: sort
type: text/vnd.tiddlywiki
The ''sort'' filter operator sorts the current list case insensitively (upper and lower case letters are considered equivalent), along the field specified in the operand (which defaults to `title`). Preceding the operator with `!` reverses the sort order.
For example:
|!Filter String |!Description |
|`one two three four +[sort[]]` |Returns `four`, `one`, `three`, `two` |
|`one two Three four +[sort[]]` |Returns `four`, `one`, `Three`, `two` |
For an example of use with explicit operands, see [[FilterOperator: limit]].
See also [[FilterOperator: nsort]], [[FilterOperator: sortcs]] and [[FilterOperator: nsortcs]].

View File

@ -1,15 +0,0 @@
created: 20140410103123179
modified: 20140410103123179
tags: Filters
title: FilterOperator: sortcs
caption: sortcs
type: text/vnd.tiddlywiki
The ''sortcs'' filter operator sorts the current list case sensitively (upper and lower case letters are considered different), along the field specified in the operand (which defaults to `title`). Preceding the operator with `!` reverses the sort order.
For example:
|!Filter String |!Description |
|`one two Three four +[sortcs[]]` |Returns `Three`, `four`, `one`, `two` |
See also [[FilterOperator: sort]], [[FilterOperator: nsort]] and [[FilterOperator: nsortcs]].

View File

@ -1,16 +0,0 @@
created: 20140828133830424
modified: 20140828133830424
tags: Filters
title: FilterOperator: suffix
caption: suffix
type: text/vnd.tiddlywiki
The ''suffix'' filter operator returns the titles in the current list that end with a specified suffix. If the ''suffix'' operator is preceded by `!` then it returns the titles that do not end with the specified suffix.
For example:
|!Filter String |!Description |
|`[tag[task]!suffix[hidden]]` |Returns tiddlers tagged `task` whose titles do not end with `hidden` |
|`[suffix[.jpg]]` |Returns tiddlers whose titles end with `.jpg` |
See also [[FilterOperator: removesuffix]], [[FilterOperator: prefix]], [[FilterOperator: removeprefix]], [[FilterOperator: addprefix]], and [[FilterOperator: addsuffix]].

View File

@ -1,19 +0,0 @@
created: 20140410103123179
modified: 20140410103123179
tags: Filters CommonFilters
title: FilterOperator: tag
caption: tag
type: text/vnd.tiddlywiki
The ''tag'' filter operator returns the tiddlers in the current list that have the tag specified in the operand. Preceding the operator with `!` returns tiddlers that do not have the specified tag.
For example:
|!Filter String |!Description |
|`[tag[mytag]]` |Returns all tiddlers tagged `mytag` |
|`[all[shadows]tag[mytag]]` |Returns all ShadowTiddlers tagged `mytag` |
|`[all[shadows+tiddlers]tag[mytag]]` |Returns all ShadowTiddlers and non-ShadowTiddlers tagged `mytag` |
|`[!tag[mytag]]` |Returns all tiddlers not tagged `mytag` |
|`[tag[mytag]!tag[exclude]]` |Returns all tiddlers tagged `mytag` that are not tagged `exclude` |
See also [[FilterOperator: tagging]], [[FilterOperator: tags]] and [[FilterOperator: untagged]].

View File

@ -1,16 +0,0 @@
created: 20140410103123179
modified: 20140410103123179
tags: Filters
title: FilterOperator: tagging
caption: tagging
type: text/vnd.tiddlywiki
The ''tagging'' filter operator returns all the tiddlers that are tagged by the tiddlers in the current list.
For example:
|!Filter String |!Description |
|`[[mytag]tagging[]]` |Returns all tiddlers tagged `mytag` |
|`[all[current]tagging[]]` |Returns all tiddlers tagged by the current tiddler |
See also [[FilterOperator: tag]], [[FilterOperator: tags]] and [[FilterOperator: untagged]].

View File

@ -1,16 +0,0 @@
created: 20140410103123179
modified: 20140410103123179
tags: Filters
title: FilterOperator: tags
caption: tags
type: text/vnd.tiddlywiki
The ''tags'' filter operator returns all the tags present on the tiddlers in the current list.
For example:
|!Filter String |!Description |
|`[[mytiddler]tags[]]` |Returns all tags for the tiddler `mytiddler` |
|`[all[shadows+tiddlers]tags[]]` |Returns all the tags used on ShadowTiddlers or non-ShadowTiddlers |
See also [[FilterOperator: tag]], [[FilterOperator: tagging]] and [[FilterOperator: untagged]].

View File

@ -1,16 +0,0 @@
created: 20140410103123179
modified: 20140410103123179
tags: Filters
title: FilterOperator: title
caption: title
type: text/vnd.tiddlywiki
The ''title'' filter operator replaces the current list with the title specified in the operand.
For example:
|!Filter String |!Description |
|`[[mytiddler]]` |Returns the title `mytiddler` |
|`[title[mytiddler]]` |Returns the title `mytiddler` |
Note that the ''title'' operator is the default when no operator name is specified.

View File

@ -1,16 +0,0 @@
created: 20140410103123179
modified: 20140410103123179
tags: Filters
title: FilterOperator: untagged
caption: untagged
type: text/vnd.tiddlywiki
The ''untagged'' filter operator selects from the current list any tiddlers that do not have any tags.
For example:
|!Filter String |!Description |
|`[untagged[]]` |Returns the titles of all tiddlers without tags |
|`[all[shadows]untagged[]]` |Returns all the ShadowTiddlers without tags |
See also [[FilterOperator: tag]], [[FilterOperator: tagging]] and [[FilterOperator: tags]].

View File

@ -1,17 +1,42 @@
created: 20140410103123179
modified: 20141007213204936
tags: Concepts
title: FilterOperators
modified: 20150124200331000
tags: Concepts Filters
title: Filter Operators
type: text/vnd.tiddlywiki
A <<doc-def "filter operator">> is a predefined name attached to an individual step in a [[filter|Filters]]. It defines how that step is to be performed.
\define .operator-rows(filter)
<$list filter="$filter$"><tr>
<td><$link to={{!!title}}>{{!!caption}}</$link></td>
<td>{{!!purpose}} <$list filter="[all[current]tag[Common Operators]]">{{$:/core/images/done-button}}</$list></td>
<td align="center"><$list filter="[all[current]tag[Negatable Operators]]">`!`</$list></td>
</tr></$list>
\end
A typical step is written as `[operator[parameter]]`, although not all of the operators need a parameter.
\define .group-heading(_)
<tr class="doc-table-subheading"><th colspan="3" align="center">$_$</th></tr>
\end
Here are the most commonly used operators:
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.
<<list-links "[tag[CommonFilters]]">>
The following table lists all the core operators. The commonest ones are checkmarked. The third column indicates which operators allow <$link to="Filter Step">the <code>!</code> prefix</$link> to reverse their meaning.
The complete list is:
<table>
<tr>
<th align="left">Operator</th>
<th align="left">Purpose</th>
<th align="left">Neg</th>
</tr>
<<.operator-rows "[tag[Filter Operators]!tag[Order Operators]!tag[String Operators]!tag[Tag Operators]!tag[Special Operators]sort[]]">>
<<.group-heading "Order Operators">>
<<.operator-rows "[tag[Filter Operators]tag[Order Operators]!tag[String Operators]!tag[Tag Operators]!tag[Special Operators]sort[]]">>
<<.group-heading "String Operators">>
<<.operator-rows "[tag[Filter Operators]!tag[Order Operators]tag[String Operators]!tag[Tag Operators]!tag[Special Operators]sort[]]">>
<<.group-heading "Tag Operators">>
<<.operator-rows "[tag[Filter Operators]!tag[Order Operators]!tag[String Operators]tag[Tag Operators]!tag[Special Operators]sort[]]">>
<<.group-heading "Special Operators">>
<<.operator-rows "[tag[Filter Operators]!tag[Order Operators]!tag[String Operators]!tag[Tag Operators]tag[Special Operators]sort[]]">>
</table>
<<list-links "[tag[Filters]] -[[Introduction to filter notation]] -[[Filter Syntax]]">>
A typical step is written as `[operator[parameter]]`, although not all of the operators need a [[parameter|Filter Parameter]].
Most steps process the [[selection of titles|Title Selection]] that are supplied as their input, but a few are [[absolute|Absolute Operators]]. For the exact rules, see [[Filter Syntax]].

View File

@ -1,95 +0,0 @@
created: 20140210141217955
modified: 20150102174633890
tags: Filters
title: Filter Syntax
type: text/vnd.tiddlywiki
[[Filters]] follow a grammar that is presented here, using [[RailroadDiagrams]], for those who find formal syntax descriptions helpful. However, [[you can learn to write filters|Introduction to filter notation]] without needing to understand this tiddler.
When a filter is evaluated, it generates a <<doc-def result>>, which is an ordered set of items. No item can appear more than once in the result. The items are usually tiddler titles, but certain specialised filters generate other items, such as Node.js command words.
---
;filter
: <$railroad text="""
{ [:whitespace] ("+" | :- | "-") run }
"""/>
A <<doc-def filter>> is a sequence of runs, evaluated from left to right.
Each run receives an <<doc-def "input set">>, which it modifies to produce a result. The first run in a sequence receives `[all[tiddlers]]` as its input, i.e. the set of all non-missing tiddlers. The second run receives the result of the first run as its input, and so on.
|!Run |!Interpretation |!Result |
|`run` |union of sets|input OR run |
|`+run` |intersection of sets |input AND run |
|`-run` |difference of sets|input AND NOT run |
---
;run
: <$railroad text="""
( "[" {step} "]"
|
[:{/"anything but [ ] or whitespace"/}]
)
"""/>
<!-- The following has been removed from the diagram until issue #1346 is addressed:
'"' [:{/'anything but "'/}] '"'
|
"'" [:{/"anything but '"/}] '"'
|
-->
The lower option, e.g. matching `HelloThere`, is short for `[title[HelloThere]]`.
A <<doc-def run>> is a sequence of steps, evaluated from left to right.
The run's result is basically the intersection of the step results. In other words, the run's result contains the items that are found in <<doc-em all>> of the step results.
However, a few operators (known as <<doc-def selectors>>) ignore any preceding steps in the same run, and completely replace the result so far. Examples of this are <<doc-clink "commands" "FilterOperator: commands">> and <<doc-clink "title" "FilterOperator: title">>, but not <<doc-clink "field:title" "FilterOperator: field">>.
---
;step
: <$railroad text="""
[:"!"] [:method] parameter
"""/>
If the method is omitted, it defaults to `title`.
---
;method
: <$railroad text="""
operator [:":" suffix]
"""/>
The operator is drawn from a list of [[predefined names|FilterOperators]].
The suffix is additional information, usually the name of a [[field|TiddlerFields]], that extends the meaning of certain operators.
An unrecognised operator name is is treated as the suffix to the <<doc-clink "field" "FilterOperator: field">> operator.
---
;parameter
: <$railroad text="""
( "[" [:{/"anything but ]"/}] "]"
|
"{" [:{/"anything but }"/}] "}"
|
"<" [:{/"anything but >"/}] ">"
)
"""/>
* `[`...`]` encloses a literal parameter
* `{`...`}` encloses a TextReference parameter
* `<`...`>` encloses a [[variable|Variables]] parameter
---
;whitespace
: <$railroad text="""
{( "space" | "tab" | "linefeed" | "return" | "vertical tab" | "formfeed" )}
"""/>

View File

@ -1,12 +1,14 @@
created: 20140410101941871
modified: 20141009180223576
modified: 20150124183957000
tags: Learning Filters
title: Introduction to filter notation
type: text/vnd.tiddlywiki
: (This explains the basics of writing a [[filter|Filters]] to select a set of tiddlers. For a more technical summary, see [[Filter Syntax]].)
<<.preamble """This explains the basics of writing a [[filter|Filters]] to select a set of tiddlers. For a more technical presentation, see [[Filter Syntax]].""">>
The simplest case is where you already know exactly which tiddlers you want. Type each title in double square brackets, with a space or linebreak between each one and the next:
<$macrocall $name=".note" _="""Filters do nothing if you just type them into a tiddler on their own. They need a context. An easy way to experiment with filters is to type them into the <<.advancedsearch-tab Filter>> tab of [[Advanced Search|$:/AdvancedSearch]]."""/>
The simplest case is where you already know exactly which tiddlers you want. Type each title in double square brackets, with a space between each one and the next:
```
[[Recipe book]] [[ScrambledEggs]] [[Mom's apple pie]]
@ -22,22 +24,22 @@ You can omit the square brackets when a title doesn't contain any spaces:
The double square brackets are actually a shorthand for this:
```
[title[Scrambled eggs]]
[title[ScrambledEggs]]
```
… which gives us the <<doc-def "general model">> for any filter:
... which gives us the <<.def "general model">> for any filter:
```
[method[parameter]]
[operator[parameter]]
```
For instance, here's how to select all the tiddlers that have been tagged <<doc-tag Recipe>>:
For instance, here's how to select all the tiddlers that have been tagged <<.tag Recipe>>:
```
[tag[Recipe]]
```
We can reverse the meaning by adding an exclamation mark `!` just before the method. For example, we can select any tiddlers that do <<doc-em not>> have the <<doc-tag Recipe>> tag:
We can reverse the meaning by adding an exclamation mark `!` just before the operator. For example, we can select any tiddlers that do <<.em not>> have the <<.tag Recipe>> tag:
```
[!tag[Recipe]]
@ -49,9 +51,9 @@ Tiddlers can be filtered by other fields than just title and tags:
[field:serving[4]]
```
That example will select any tiddlers that have <<doc-field-value 4>> in their <<doc-field serving>> field.
That example will select any tiddlers that have <<.value 4>> in their <<.field serving>> field.
As the word "serving" isn't a standard filter method (and isn't likely to become one), you can safely omit the `field:` prefix:
As the word "serving" isn't a standard filter operator (and isn't likely to become one), you can safely omit the `field:` prefix:
```
[serving[4]]
@ -59,7 +61,7 @@ As the word "serving" isn't a standard filter method (and isn't likely to become
!Combinations
The filters we've looked at so far have involved just one step each. But you can <<doc-def run>> several steps together like this:
The filters we've looked at so far have involved just one step each. But you can <<.def run>> several steps together like this:
```
[tag[Vegetarian]!tag[soup]serving[4]]
@ -67,9 +69,9 @@ The filters we've looked at so far have involved just one step each. But you can
Notice how the entire run is contained in a single pair of square brackets.
A tiddler has to match <<doc-em all>> of the steps in a run. So the example above retrieves vegetarian recipes (other than soups) for 4 people.
A tiddler has to match <<.em all>> of the steps in a run. So the example above retrieves vegetarian recipes (other than soups) for 4 people.
A <<doc-em sequence>> of runs will select the tiddlers that match <<doc-em any>> of the runs. We can use this to find recipes that serve either 3, 4 or 5 people:
A sequence of separate runs will select the tiddlers that match <<.em any>> of the runs. We can use this to find recipes that serve either 3, 4 or 5 people:
```
[serving[3]] [serving[4]] [serving[5]]
@ -78,7 +80,7 @@ A <<doc-em sequence>> of runs will select the tiddlers that match <<doc-em any>>
If we want to ignore vegetarian recipes that serve 4, we can say this:
```
[serving[3]] [serving[4]!tag[vegetarian]] [serving[5]]
[serving[3]] [serving[4]!tag[Vegetarian]] [serving[5]]
```
By default, each run considers every tiddler in the wiki. But we can use a `+` sign to force a run to consider only the tiddlers that were selected by the preceding runs:
@ -87,9 +89,9 @@ By default, each run considers every tiddler in the wiki. But we can use a `+` s
[serving[3]] [serving[4]] [serving[5]] +[tag[Vegetarian]] +[sort[title]]
```
This selects recipes for 3, 4 or 5 people, then filters <<doc-em those>> to remove the vegetarian ones, and finally sorts any that are left into alphabetical order of title.
This selects recipes for 3, 4 or 5 people, then filters <<.em those>> to remove the vegetarian ones, and finally sorts any that are left into alphabetical order of title.
In a similar way, we can use a `-` sign to <<doc-em remove>> a run's tiddlers from the result so far. Here we select all vegetarian recipes apart from two:
In a similar way, we can use a `-` sign to <<.em remove>> a run's tiddlers from the result so far. Here we select all vegetarian recipes apart from two:
```
[tag[Vegetarian]] -[title[ScrambledEggs]] -BeansOnToast
@ -99,7 +101,7 @@ In a similar way, we can use a `-` sign to <<doc-em remove>> a run's tiddlers fr
The parameter of each step we've seen so far has been in square brackets, meaning that ~TiddlyWiki treats it literally. But two other kinds of bracket are possible:
<<doc-def "Curly brackets">> `{}` mean that the parameter is a TextReference, and that its value is to be looked up in a specified tiddler. For example, if we have a tiddler called <<tid Preference>> whose text happens to be the word <<doc-field-value Vegetarian>>, we can say
<<.def "Curly brackets">> `{}` mean that the parameter is a TextReference, and that its value is to be looked up in a specified tiddler. For example, if we have a tiddler called <<.tid Preference>> whose text happens to be the word <<.value Vegetarian>>, we can say
```
[tag{Preference}]
@ -107,8 +109,8 @@ The parameter of each step we've seen so far has been in square brackets, meanin
as an alternative to `[tag[Vegetarian]]`. This allows the preference to change over time.
<<doc-def "Angle brackets">> `<>` mean that the parameter is the name of a [[variable|Variables]] whose value is to be used instead. Here we use the built-in <<doc-clink currentTiddler "WidgetVariable: currentTiddler">> variable in a filter that selects any tiddlers whose text contains the title of the current one:
<<.def "Angle brackets">> `<>` mean that the parameter is the name of a [[variable|Variables]] whose value is to be used instead. Here we use the built-in <<.clink currentTiddler "WidgetVariable: currentTiddler">> variable in a filter that selects any tiddlers whose text contains the title of the current one:
```
[search<currentTiddler>]
```
```

View File

@ -0,0 +1,16 @@
created: 20140410103123179
modified: 20150124172110000
tags: [[Filter Operators]] [[String Operators]]
title: addprefix Operator
type: text/vnd.tiddlywiki
caption: addprefix
purpose: extend each input title with a prefix
<$macrocall $name=".operator-def"
input="a [[selection of titles|Title Selection]]"
parameter="a string of characters"
paramName="s"
output="the input, but with <<.place s>> added to the start of each title"
/>
<<.operator-examples "addprefix">>

View File

@ -0,0 +1,16 @@
created: 20140828133830424
modified: 20150124172115000
tags: [[Filter Operators]] [[String Operators]]
title: addsuffix Operator
type: text/vnd.tiddlywiki
caption: addsuffix
purpose: extend each input title with a suffix
<$macrocall $name=".operator-def"
input="a [[selection of titles|Title Selection]]"
parameter="a string of characters"
paramName="s"
output="the input, but with <<.place s>> added to the end of each title"
/>
<<.operator-examples "addsuffix">>

View File

@ -0,0 +1,18 @@
created: 20140512103123179
modified: 20150124204353000
tags: [[Filter Operators]] [[Order Operators]]
title: after Operator
type: text/vnd.tiddlywiki
caption: after
purpose: find which input title follows a specified one
<$macrocall $name=".operator-def"
input="a [[selection of titles|Title Selection]]"
parameter="one of those titles"
paramName="t"
output="the title that immediately follows <<.place t>> in the input"
/>
If <<.place t>> is not present in the input, or is the last title there, then the output is empty.
<<.operator-examples "after">>

View File

@ -0,0 +1,34 @@
created: 20140410103123179
modified: 20150124200847000
tags: [[Filter Operators]] [[Common Operators]] [[Absolute Operators]]
title: all Operator
type: text/vnd.tiddlywiki
caption: all
purpose: find all titles of a fundamental category
<$macrocall $name=".operator-def"
input="ignored, unless the parameter is empty"
parameter="zero or more categories -- see below"
output="the titles that belong to all the specified categories"
/>
The parameter specifies zero or more fundamental categories using the following syntax:
<$railroad text="""
[{: ("current" | "missing" |: "orphans" | "shadows" | "tiddlers" ) +"+" }]
"""/>
|!Category |!Members |!Sorted |
|^`current` |just the [[current tiddler|CurrentTiddler]] |^-- |
|^`missing` |all non-existent tiddlers to which there is at least one [[hard link|Hard and Soft Links]] |^no |
|^`orphans` |all tiddlers to which there are <<.em no>> hard links |^by title |
|^`shadows` |all the [[shadow tiddlers|ShadowTiddlers]] that exist, including any that have been overridden with non-shadow tiddlers |^no |
|^`tiddlers` |all the non-shadow tiddlers that exist |no |
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]].
The <<.olink is>> operator is similar, but its scope is restricted to its input.
<<.operator-examples "all">>

View File

@ -0,0 +1,17 @@
created: 20140410103123179
modified: 20150124200946000
tags: [[Filter Operators]]
title: backlinks Operator
type: text/vnd.tiddlywiki
caption: backlinks
purpose: find the titles that link to each input title
<$macrocall $name=".operator-def"
input="a [[selection of titles|Title Selection]]"
parameter="none"
output="any non-[[system|SystemTiddlers]] titles that contain [[hard links|Hard and Soft Links]] to the input titles"
/>
Each input title is processed in turn. The corresponding tiddler's list of backlinks is generated, sorted alphabetically by title, and then [[dominantly appended|Dominant Append]] to the operator's overall output.
<<.operator-examples "backlinks">>

View File

@ -0,0 +1,18 @@
created: 20140512103123179
modified: 20150124164952000
tags: [[Filter Operators]] [[Order Operators]]
caption: before
title: before Operator
type: text/vnd.tiddlywiki
purpose: find which input title precedes a specified one
<$macrocall $name=".operator-def"
input="a [[selection of titles|Title Selection]]"
parameter="one of those titles"
paramName="t"
output="the title that immediately precedes <<.place t>> in the input"
/>
If <<.place t>> is not present in the input, or is the first title there, then the output is empty.
<<.operator-examples "before">>

View File

@ -0,0 +1,9 @@
created: 20140410103123179
modified: 20150124200504000
tags: [[Filter Operators]] [[Order Operators]]
title: bf Operator
type: text/vnd.tiddlywiki
caption: bf
purpose: same as <<.op rest>>
<<.op bf>> is a synonym for <<.olink rest>>, also known as <<.olink butfirst>>.

View File

@ -0,0 +1,9 @@
created: 20140410103123179
modified: 20150124200507000
tags: [[Filter Operators]] [[Order Operators]]
title: butfirst Operator
type: text/vnd.tiddlywiki
caption: butfirst
purpose: same as <<.op rest>>
<<.op butfirst>> is a synonym for <<.olink rest>>, also known as <<.olink bf>>.

View File

@ -0,0 +1,16 @@
created: 20140410103123179
modified: 20150124172210000
tags: [[Filter Operators]] [[Order Operators]]
title: butlast Operator
type: text/vnd.tiddlywiki
caption: butlast
purpose: discard the last <<.place n>> input titles
<$macrocall $name=".operator-def"
input="a [[selection of titles|Title Selection]]"
parameter="an integer, defaulting to 1"
paramName="n"
output="all but the last <<.place n>> input titles"
/>
<<.operator-examples "butlast">>

View File

@ -0,0 +1,15 @@
created: 20140410103123179
modified: 20150124155303000
tags: [[Filter Operators]] [[Special Operators]] [[Absolute Operators]]
title: commands Operator
type: text/vnd.tiddlywiki
caption: commands
purpose: select the titles of all the Node.js commands
<$macrocall $name=".operator-def"
input="ignored"
parameter="none"
output="the [[command words|Commands]] that can be given to [[TiddlyWiki on Node.js]]"
/>
<<.operator-examples "commands">>

View File

@ -0,0 +1,20 @@
created: 20140410103123179
modified: 20150124164957000
tags: [[Filter Operators]] [[Group Operators]]
title: each Operator
type: text/vnd.tiddlywiki
caption: each
purpose: select one of each group of input titles by field
<$macrocall $name=".operator-def"
input="a [[selection of titles|Title Selection]]"
parameter="the name of a [[field|TiddlerFields]]"
paramName="f"
output="a selection containing the first input title encountered for each distinct value of field <<.place f>>"
/>
Each input title is processed in turn. The value of field <<.place f>> in the corresponding tiddler is examined, and as long as the value has not been encountered before, the title is appended to the output set.
If a tiddler doesn't contain field <<.place f>>, or contains it but with an empty value, then it contributes nothing to the output.
<<.operator-examples "each">>

View File

@ -0,0 +1,20 @@
created: 20140410103123179
modified: 20150124214554000
tags: [[Filter Operators]] [[Group Operators]] [[Date Operators]]
title: eachday Operator
type: text/vnd.tiddlywiki
caption: eachday
purpose: select one of each group of input titles by date
<$macrocall $name=".operator-def"
input="a [[selection of titles|Title Selection]]"
parameter="the name of a [[date field|Date Fields]]"
paramName="f"
output="a selection containing the first input title encountered for each distinct value (ignoring times of day) of field <<.place f>>"
/>
Each input title is processed in turn. The value of field <<.place f>> in the corresponding tiddler is examined, and as long as this indicates a date that has not been encountered before, the title is appended to the output set.
If a tiddler doesn't contain field <<.place f>>, it contributes nothing to the output.
<<.operator-examples "eachday">>

View File

@ -0,0 +1,17 @@
created: 20150111145738451
modified: 20150124165002000
tags: [[Filter Operators]] [[Special Operators]]
title: editiondescription Operator
type: text/vnd.tiddlywiki
caption: editiondescription
purpose: select the descriptions of the input editions
<$macrocall $name=".operator-def"
input="a [[selection|Title Selection]] of edition names"
parameter="none"
output="the description string of each edition in the input"
/>
Each input title is processed in turn, ignoring any that is not the name of a ~TiddlyWiki edition.
<<.node-only-operator>>

View File

@ -0,0 +1,15 @@
created: 20150111145738451
modified: 20150124150912000
tags: [[Filter Operators]] [[Special Operators]] [[Absolute Operators]]
title: editions Operator
type: text/vnd.tiddlywiki
caption: editions
purpose: select the names of all the ~TiddlyWiki editions
<$macrocall $name=".operator-def"
input="ignored"
parameter="none"
output="the name of each ~TiddlyWiki edition, in alphabetical order"
/>
<<.node-only-operator>>

View File

@ -0,0 +1,7 @@
created: 20150118132851000
modified: 20150118183116000
tags: [[addprefix Operator]] [[Operator Examples]]
title: addprefix Operator (Examples)
type: text/vnd.tiddlywiki
<<.operator-example 1 "Cat Garden [[Favourite Armchair]] +[addprefix[My ]]">>

View File

@ -0,0 +1,7 @@
created: 20150118134542000
modified: 20150118183121000
tags: [[addsuffix Operator]] [[Operator Examples]]
title: addsuffix Operator (Examples)
type: text/vnd.tiddlywiki
<<.operator-example 1 "[[London]addsuffix[ Underground]]">>

View File

@ -0,0 +1,10 @@
created: 20150118134611000
modified: 20150118183126000
tags: [[after Operator]] [[Operator Examples]]
title: after Operator (Examples)
type: text/vnd.tiddlywiki
<<.using-days-of-week>> The [[Thursday]] tiddler shows a further example.
<<.operator-example 1 "[list[Days of the Week]after[Monday]]">>
<<.operator-example 2 "[list[Days of the Week]after[Sunday]]">>

View File

@ -0,0 +1,14 @@
created: 20150118134646000
modified: 20150118183130000
tags: [[all Operator]] [[Operator Examples]]
title: all Operator (Examples)
type: text/vnd.tiddlywiki
<<.operator-example 1 "[all[shadows]]">>
<<.operator-example 2 "[all[shadows+tiddlers]]">>
<<.operator-example 3 "[all[tiddlers+shadows]]">>
<<.operator-example 4 "[all[orphans+missing+current]]">>
<<.operator-example 5 "[all[current]]">>
<<.operator-example 6 "[all[current]tag[Operator Examples]]">>
<<.operator-example 7 "[all[current]tag[Recipes]]">>
<<.operator-example 8 "Monday Thursday +[all[]]">>

View File

@ -0,0 +1,9 @@
created: 20150118134611000
modified: 20150118183135000
tags: [[backlinks Operator]] [[Operator Examples]]
title: backlinks Operator (Examples)
type: text/vnd.tiddlywiki
<<.operator-example 1 "[[HelloThere]backlinks[]]">>
<<.operator-example 2 "[tag[TableOfContents]backlinks[]]" "tiddlers that link to tiddlers tagged [[TableOfContents]]">>
<<.operator-example 3 "[all[current]backlinks[]]" "tiddlers that link to this one">>

View File

@ -0,0 +1,10 @@
created: 20150118134611000
modified: 20150118183139000
tags: [[before Operator]] [[Operator Examples]]
title: before Operator (Examples)
type: text/vnd.tiddlywiki
<<.using-days-of-week>> The [[Thursday]] tiddler shows a further example.
<<.operator-example 1 "[list[Days of the Week]before[Saturday]]">>
<<.operator-example 2 "[list[Days of the Week]before[Monday]]">>

View File

@ -0,0 +1,11 @@
created: 20150118134611000
modified: 20150118183143000
tags: [[butlast Operator]] [[Operator Examples]]
title: butlast Operator (Examples)
type: text/vnd.tiddlywiki
<<.using-days-of-week>>
<<.operator-example 1 "[list[Days of the Week]butlast[]]">>
<<.operator-example 2 "[list[Days of the Week]butlast[2]]">>
<<.operator-example 3 "A B C D E F G H I J K L M +[butlast[7]]">>

View File

@ -0,0 +1,7 @@
created: 20150118134611000
modified: 20150118183148000
tags: [[commands Operator]] [[Operator Examples]]
title: commands Operator (Examples)
type: text/vnd.tiddlywiki
<<.operator-example 1 "[commands[]]">>

View File

@ -0,0 +1,10 @@
created: 20150118134611000
modified: 20150118183152000
tags: [[each Operator]] [[Operator Examples]]
title: each Operator (Examples)
type: text/vnd.tiddlywiki
<<.operator-example 1 "[each[color]]">>
<<.operator-example 2 "[sort[title]each[type]]" "the alphabetically first tiddler of each type">>
For an example of using the <<.op each>> operator to generate a two-tier list of groups and members, see [[GroupedLists]].

View File

@ -0,0 +1,9 @@
created: 20150118134611000
modified: 20150118183156000
tags: [[eachday Operator]] [[Operator Examples]]
title: eachday Operator (Examples)
type: text/vnd.tiddlywiki
<<.operator-example 1 "[eachday[created]]" "the first tiddler created on each day">>
For an example of using the <<.op eachday>> operator to generate a two-tier list of groups and members, see [[GroupedLists]].

Some files were not shown because too many files have changed in this diff Show More