diff --git a/editions/tw5.com/tiddlers/releasenotes/5.4.0/#9595.tid b/editions/tw5.com/tiddlers/releasenotes/5.4.0/#9595.tid new file mode 100644 index 000000000..bcff55860 --- /dev/null +++ b/editions/tw5.com/tiddlers/releasenotes/5.4.0/#9595.tid @@ -0,0 +1,34 @@ +title: $:/changenotes/5.4.0/#9595 +description: Easier avoidance of deduplication in filters +release: 5.4.0 +tags: $:/tags/ChangeNote +change-type: enhancement +change-category: filters +github-links: https://github.com/TiddlyWiki/TiddlyWiki5/pull/9595 +github-contributors: Jermolene + +Resolves a long-standing issue with filters where there has been no easy way to avoid deduplication of results during filter evaluation. There are two distinct new capabilities. + +First, there is a new filter pragma `::defaultprefix` that sets the default filter run prefix for the remainder of the filter expression. Filter pragmas are a new concept akin to wikitext pragmas, allowing special instructions to be embedded in filter expressions. + +The `::defaultprefix` pragma takes as its first parameter the desired default filter run prefix, followed by any number of filter operations to which it applies. The default prefix `all` can be used to disable deduplication for the subsequent operations (`or` is the default prefix that performs deduplication). + +For example: + +``` +::defaultprefix:all 1 2 2 1 4 +[join[ ]] +``` + +Returns `1 2 2 1 4`. + +Contrast to the result without the pragma which returns `2 1 4`: + +``` +1 2 2 1 4 +[join[ ]] +``` + +Second, there is a new parameter to the `subfilter` and `filter` operators to specify the default filter run prefix to use when the filter is evaluated. This overrides any default set with the `::defaultprefix` pragma. + +``` +[subfilter:all] +```