Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Filters doc and add "Learn more about how to use Filters" link to every operator reference tiddler #6533

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 14 additions & 10 deletions editions/tw5.com/tiddlers/concepts/Filters.tid
@@ -1,23 +1,27 @@
created: 20130827080000000
modified: 20150221225414000
list: [[Introduction to filter notation]] [[Filter Syntax]]
modified: 20220316120141494
tags: Reference Concepts
title: Filters
type: text/vnd.tiddlywiki
list: [[Introduction to filter notation]] [[Filter Syntax]]

\define openAdvancedSearch()
<$action-setfield $tiddler="$:/state/tab--1498284803" text="$:/core/ui/AdvancedSearch/Filter"/>
<$action-setfield $tiddler="$:/temp/advancedsearch/input" text="[tag[Filters]]"/>
\end

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 <<.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 start with the letter H:
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>>:

<<wikitext-example-without-html """<<list-links "[tag[Filters]]">>""" >>

> `<<list-links "[prefix[H]]">>`
A filter 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.

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.
''Find out more:''

[[Advanced Search|$:/AdvancedSearch]] has a <<.advancedsearch-tab Filter>> tab that makes it easy to experiment with filters.
* <$linkcatcher message="tm-navigate" actions=<<openAdvancedSearch>> >[[Advanced Search|$:/AdvancedSearch]]</$linkcatcher> -- 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 detailed technical rules
* [[Filter Operators]] -- the available methods of filtering
* [[Filtered Transclusions|Transclusion in WikiText]] -- If you want to use filter results in your text
9 changes: 6 additions & 3 deletions editions/tw5.com/tiddlers/system/operator-template.tid
@@ -1,8 +1,8 @@
created: 20150203173506000
modified: 20150203181725000
title: $:/editions/tw5.com/operator-template
tags: $:/tags/ViewTemplate
list-before: $:/core/ui/ViewTemplate/body
modified: 20220316121232243
tags: $:/tags/ViewTemplate
title: $:/editions/tw5.com/operator-template

\define .op-place()
<$macrocall $name=".if"
Expand Down Expand Up @@ -71,6 +71,9 @@ list-before: $:/core/ui/ViewTemplate/body
</$set>
<!-- -->
</table>

[[Learn more about how to use Filters|Filters]]

<$list filter="[all[current]has[from-version]]" variable="listItem">
<$macrocall $name=".from-version" version={{!!from-version}}/>
</$list>
Expand Down