Mark,

One compelling use of the subfilter is to access a list and apply it to 
another;

\define system-tags() text title modified modifier created creator tags 
list list-after list-before caption type

<$list filter="[fields[]!subfilter<system-tags>]">

</$list>

The advantage being you can create global macros to use as a list.

That list can be used directly
<$list filter="[subfilter<system-tags>]">

</$list>

So this is in fact a way to do *"named" filters* for use as needed.

So you can use this method to create logically named filters.

\define chapters() [tag[TableOfContents]]

<$list filter="[subfilter<chapters>]">

</$list>

Also I will point out that the pre-release includes a new 
operator https://tiddlywiki.com/prerelease/#filter%20Operator

One of the key advantages of the subfilter is that it can use a macro which 
defines a "full filter" that can be used on its own;
<$list filter=<<chapters>> >

</$list>
But also have it become part of another filter as in my first example this 
demands the subfilter operator.

So we could have am alternate name for subfilter "named filters".

Regards
Tones




On Tuesday, 27 October 2020 09:53:30 UTC+11, Mark S. wrote:
>
> subfilter doesn't do "map" or any of those neat things. It just allows a 
> variable that you may have constructed outside the main filter to be used 
> as an additional filter. Personally I haven't found it to be that useful.
>
> [[tag[HelloThere]subfilter<variable-with-filter-that-does-other-things>]
>
>
>
>> [subfilter[one two three]addsuffix[!]]
>>
>>
> Is same as 
>
> "one two three +[addsuffix[!]]"
>  
> so the result is
>
> one!
> two!
> three!
>
> It doesn't filter out all tiddlers -- it generates three "tiddlers" (one, 
> two, three).
>
> The problem with splitregexp is that it splits ALL the tiddlers it 
> receives and puts out all the pieces. 
>
> With the split tool in https://github.com/Jermolene/TiddlyWiki5/pull/2963 
> you could do this in one list statement.
>
> Anyway, here's some code that does sort of what you want, but for 
> TiddlyWiki.com :
>
> \define my-splitting-headache()
> <$set name="chrome" value="[tag[HelloThere]]">
> <$list filter="[subfilter<chrome>]" >
> <$list filter="[<currentTiddler>splitregexp[\W]!is[blank]first[]]"/>
> </$list>
> </$set>
> \end
>
> <$wikify text=<<my-splitting-headache>> name=headache>
> <$list filter="[<headache>sort[]]" />
> </$wikify>
>
>
>
> Note that there are two listed lists inside a macro. These lists find all 
> your tiddlers defined by <chrome>, split them one by one, and the result is 
> returned.
>
> The macro is invoked by the Wikify widget, so that the combined results 
> are rendered and turned back into a single list. Those results are in 
> turned sorted by the final list widget.
>  
> HTH
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/6265ae8a-1827-464a-93ab-ebf09b002102o%40googlegroups.com.

Reply via email to