Macro to hide/reveal tiddlers based on tiddler value?

37 views
Skip to first unread message

stevesuny

unread,
Apr 21, 2017, 10:38:31 AM4/21/17
to TiddlyWiki
Hi folks, I sense this has been discussed before, but can't quite figure out the search query to bring out this topic in the group.

I am building an "annotator" that allows viewers/writers to add comments to my tiddlers, in a separate tiddler whose name becomes "$user$ annotation of $tiddler-title$". Using a template, I can transclude the text of these annotation tiddlers onto the original tiddlers. But I'd like to create a checkbox that would turn on/off this feature. I thought if I set some tiddler ($:/annotation/visibility) to "yes" or "no" I might be able to write a filter to accomplish this.

But, I don't really know how to do that.

Suggestions?

//steve.

stevesuny

unread,
Apr 21, 2017, 10:48:01 AM4/21/17
to TiddlyWiki
Sometimes, I think the cathartic act of writing a query to the group stimulates the solution!

This is the answer to my own question (I think):

  1. Create a tiddler called "$:/annotations/visible" with field "visible" and value "yes"
  2. Wrap the macro that displays the annotation in a list filter: <$list filter="[title[$:/annotations/visible]field:visible[yes]]">
  3. Change the value of the field to anything other than "yes" to hide the annotations.

//steve.
Reply all
Reply to author
Forward
0 new messages