Filters on default tiddlers

50 views
Skip to first unread message

Scott Kingery

unread,
May 16, 2020, 4:39:48 PM5/16/20
to TiddlyWiki
I can't seem to get the syntax for this correct...

What I want to do is put something in my all my footers using $:/tags/ViewTemplate but I only want to do it if the tiddler is not a default tiddler. I think I need a nested list. Something like:

<$list filter={{$:/DefaultTiddlers}}>
...do things here only if the title of the current tiddler isn't in the list of defaults...
</$list>

This code works fine but I don't want to hard code the name of the default tiddler:
<$list filter="[is[current]!title[Home]]">
This tiddler is not Home
</$list>

Thanks,
Scott

Mark S.

unread,
May 16, 2020, 5:22:14 PM5/16/20
to TiddlyWiki

I think this will do it:

<$list filter="[<currentTiddler>] -[{$:/DefaultTiddlers}splitregexp[\n]!is[blank]]">

...do things here only if the title of the current tiddler isn't in the list of defaults...
</$list>

Eric Shulman

unread,
May 16, 2020, 5:43:45 PM5/16/20
to TiddlyWiki
On Saturday, May 16, 2020 at 2:22:14 PM UTC-7, Mark S. wrote:
I think this will do it:
<$list filter="[<currentTiddler>] -[{$:/DefaultTiddlers}splitregexp[\n]!is[blank]]">
...do things here only if the title of the current tiddler isn't in the list of defaults...
</$list>
 
While $:/DefaultTiddlers is most often just a list of literal titles, the contents are actually a filter definition and might be something like this:
SomeTitle SomeOtherTitle [tag[startup]] -NotThisTitle

Your solution will only work if:
* each item is on a separate line (i.e., using \n)
* each item is a literal title

Here's a syntax that works for any definition of $:/DefaultTiddlers:
<$list filter="[<currentTiddler>!subfilter{$:/DefaultTiddlers}]">
  this is not a default tiddler
</$list>


enjoy,
-e

Scott Kingery

unread,
May 16, 2020, 6:18:12 PM5/16/20
to TiddlyWiki
Thanks, Eric and Mark! Exactly what I needed and I learned a bit about the subfilter and more about DefaultTiddlers.
Reply all
Reply to author
Forward
0 new messages