How to get a text reference of a filter output?

83 views
Skip to first unread message

Matt Groth

unread,
Mar 2, 2017, 12:50:10 PM3/2/17
to TiddlyWiki
I'm trying to make a reveal widget that matches a filter when it produces no output. However, the reveal widget requires a text reference as the state to match. How can I use a filter as a text reference?

Jed Carty

unread,
Mar 2, 2017, 1:31:16 PM3/2/17
to TiddlyWiki
You can do this using a list widget instead of a reveal widget.


\define WhatIWantToShow()
revealed content goes here
!!
\end


<$list filter=somefilter emptyMessage=<<WhatIWantToShow>>/>

being able to point a reveal to a variable would be nice, but I don't think there is a way to do that.

Eric Shulman

unread,
Mar 2, 2017, 1:54:02 PM3/2/17
to TiddlyWiki
On Thursday, March 2, 2017 at 10:31:16 AM UTC-8, Jed Carty wrote:
being able to point a reveal to a variable would be nice, but I don't think there is a way to do that.

Normally, the <$reveal> widget uses params "state" and "text" to compare a value stored in a "state" tiddler with some literal "text" value.

There is also a third param, "default" that is used as a fallback value to compare with if the state tiddler is not found or if the state="..." param is not defined.

Thus, if you omit the state="..." param, and use default="..." instead, you can use <$reveal> to compare values stored in variables.

Something like this:
<$reveal text=<<variable>> type="match" default="somevalue">
...
</$reveal>

or

<$reveal text=<<variable>> type="match" default=<<anothervariable>>>
...
</$reveal>

enjoy,
-e
Eric Shulman
TiddlyTools: Small Tools for Big Ideas (tm)
InsideTiddlyWiki: The Missing Manuals

Matt Groth

unread,
Mar 2, 2017, 7:25:54 PM3/2/17
to TiddlyWiki
Thank's Jed and Eric, they both work!

Eric, I'm going to make a PR to add your example to the docs. I never would have figured that out myself.

Best,
Matt
Reply all
Reply to author
Forward
0 new messages