mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-24 02:27:19 +00:00
Slightly fewer inaccuracies in the filter docs
This commit is contained in:
parent
3c4ba61057
commit
247ef94682
@ -3,35 +3,38 @@ tags: docs concepts
|
|||||||
|
|
||||||
TiddlyWiki has a special syntax for expressing filters. They can be used to select tiddlers for an operation, or to filter a set of tiddlers to add or remove members.
|
TiddlyWiki has a special syntax for expressing filters. They can be used to select tiddlers for an operation, or to filter a set of tiddlers to add or remove members.
|
||||||
|
|
||||||
|
! Examples
|
||||||
|
|
||||||
The mechanism is easiest to understand by first presenting some example filter strings:
|
The mechanism is easiest to understand by first presenting some example filter strings:
|
||||||
|
|
||||||
|
{{table-condensed{
|
||||||
|!Filter |!Results |
|
|!Filter |!Results |
|
||||||
|`HelloThere` |The single tiddler titled `HelloThere` (if it exists) |
|
|`HelloThere` |The single tiddler titled `HelloThere` (if it exists) |
|
||||||
|`[[A Title With Several Words]]` |The single tiddler titled `A Title With Several Words` (if it exists) |
|
|`[[A Title With Several Words]]` |The single tiddler titled `A Title With Several Words` (if it exists) |
|
||||||
|`[title[MyTiddler]]` |The single tiddler titled `MyTiddler` (if it exists) |
|
|`[title[MyTiddler]]` |The single tiddler titled `MyTiddler` (if it exists) |
|
||||||
|`HelloThere Introduction` |The tiddlers titled `HelloThere` and `Introduction` (if they exist) |
|
|`HelloThere Introduction` |The tiddlers titled `HelloThere` and `Introduction` (if they exist) |
|
||||||
|`[tag[important]]` |Any tiddlers with the tag `important` |
|
|`[tag[important]]` |All tiddlers with the tag `important` |
|
||||||
|`[!tag[important]]` |Any tiddlers not with the tag `important` |
|
|`[!tag[important]]` |All tiddlers not with the tag `important` |
|
||||||
|`[tag[important]sort[title]]` |Any tiddlers with the tag `important` sorted by title |
|
|`[tag[important]sort[title]]` |All tiddlers with the tag `important` sorted by title |
|
||||||
|`[tag[important]!sort[title]]` |Any tiddlers with the tag `important` reverse sorted by title |
|
|`[tag[important]!sort[title]]` |All tiddlers with the tag `important` reverse sorted by title |
|
||||||
|`[[one][two][three]tag[tom]]` |Any of the tiddlers called `one`, `two` or `three` that exist and are tagged with `tom` |
|
|`[[one]] [[two]] [[three]] +[tag[tom]]` |Any of the tiddlers called `one`, `two` or `three` that exist and are tagged with `tom` |
|
||||||
|`[[one][two][three]] [tag[tom]]` |Any of the tiddlers called `one`, `two` or `three` that exist, along with all of the source tiddlers that are tagged with `tom` |
|
|`[[one]] [[two]] [[three]] [tag[tom]]` |Any of the tiddlers called `one`, `two` or `three` that exist, along with all of the source tiddlers that are tagged with `tom` |
|
||||||
|`[tag[tom]] [tag[harry]] -[[one][two][three]]` |All tiddlers tagged either `tom` or `harry`, but excluding `one`, `two` and `three` |
|
|`[tag[tom]] [tag[harry]] -[[one][two][three]]` |All tiddlers tagged either `tom` or `harry`, but excluding `one`, `two` and `three` |
|
||||||
|`[[MyTiddler]tags[]]` |all tiddlers being used as tags on the tiddler `MyTiddler` |
|
|`[[MyTiddler]tags[]]` |All tiddlers being used as tags on the tiddler `MyTiddler` |
|
||||||
|`[[MyTiddler]tagging[]]` |all tiddlers being tagged with `MyTiddler` |
|
|`[[MyTiddler]tagging[]]` |All tiddlers being tagged with `MyTiddler` |
|
||||||
|
}}}
|
||||||
|
|
||||||
|
! Operators
|
||||||
! Explanation
|
|
||||||
|
|
||||||
A filter string consists of one or more filter operations, each comprising one or more filter operators with associated operands.
|
A filter string consists of one or more filter operations, each comprising one or more filter operators with associated operands.
|
||||||
|
|
||||||
The operators look like `[operator[operand]]`, where `operator` is one of:
|
The operations look like `[operator[operand]]`, where `operator` is one of:
|
||||||
|
|
||||||
* ''title'': selects the tiddler with the title given in the operand
|
* ''title'': selects the tiddler with the title given in the operand
|
||||||
* ''is'': tests whether a tiddler is a member of the system defined set named in the operand (see below)
|
* ''is'': tests whether a tiddler is a member of the system defined set named in the operand (see below)
|
||||||
* ''has'': tests whether a tiddler has a specified field
|
* ''has'': tests whether a tiddler has a specified field
|
||||||
* ''sort'': sorts the tiddlers by a given field
|
* ''sort'': sorts the tiddlers by a given field
|
||||||
* ''sort-case-sensitive'': sorts the tiddlers by a given field with case sensitivity (ie, "a" and "A" are sorted differently)
|
* ''sort-case-sensitive'': a case sensitive sort of the current tiddlers
|
||||||
* ''prefix'': tests whether a tiddlers title starts with a particular prefix
|
* ''prefix'': tests whether a tiddlers title starts with a particular prefix
|
||||||
* ''limit'': limits the number of subresults
|
* ''limit'': limits the number of subresults
|
||||||
* ''tag'': tests whether a given tag is (`[tag[mytag]]`) or is not (`[!tag[mytag]]`) present on the tiddler
|
* ''tag'': tests whether a given tag is (`[tag[mytag]]`) or is not (`[!tag[mytag]]`) present on the tiddler
|
||||||
@ -48,15 +51,19 @@ The operands available with the `is` operator are:
|
|||||||
* ''shadow'': selects all shadow tiddlers
|
* ''shadow'': selects all shadow tiddlers
|
||||||
* ''current'': selects the current ContextTiddler
|
* ''current'': selects the current ContextTiddler
|
||||||
|
|
||||||
Operators are combined into logically ANDed expressions by bashing them together and merging the square brackets:
|
! Runs
|
||||||
|
|
||||||
|
Operators are combined into runs that function as logically ANDed expressions by bashing them together and merging the square brackets:
|
||||||
|
|
||||||
{{{
|
{{{
|
||||||
[tag[one]] [tag[two]] ---> [tag[one]tag[two]]
|
[tag[one]] [tag[two]] ---> [tag[one]tag[two]]
|
||||||
}}}
|
}}}
|
||||||
|
|
||||||
Operations can be preceded with `-` to negate their action, removing the selected tiddlers from the results. For example, `[tag[Tommy]] -HelloThere -[[Another One]]` selects all tiddlers tagged with `Tommy` except those titled `HelloThere` or `Another One`.
|
Operation runs can be preceded with `-` to negate their action, removing the selected tiddlers from the results. For example, `[tag[Tommy]] -HelloThere -[[Another One]]` selects all tiddlers tagged with `Tommy` except those titled `HelloThere` or `Another One`.
|
||||||
|
|
||||||
Operations can be preceded with `+` in order to make them apply to all of the current results, rather than the original source. For example, `[tag[Jeremy]] [tag[Tommy]] +[sort[title]]` selects the tiddlers tagged `Tommy` or `Jeremy`, and sorts them by the `title` field.
|
Operation runs can be preceded with `+` in order to make them apply to all of the accumulated results, rather than the original source. For example, `[tag[Jeremy]] [tag[Tommy]] +[sort[title]]` selects the tiddlers tagged `Tommy` or `Jeremy`, and sorts them by the `title` field.
|
||||||
|
|
||||||
|
! Processing model
|
||||||
|
|
||||||
Filters are processed with the following elements:
|
Filters are processed with the following elements:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user