[TW5] !is[current] does not work called from a widget.

52 views
Skip to first unread message

Danielo Rodríguez

unread,
Apr 2, 2015, 8:03:19 AM4/2/15
to tiddly...@googlegroups.com
Hello,

I'm facing some problems with a plugin that I'm working at. The widget will modify a bunch of tiddlers based on a filter. This tiddler is called from a tiddler that should not be modified. I though that passing a filter like [!is[system]!is[current]] to the widget parameters the tiddler where the widget is placed will not be included in the result. But, it is.

Is this intended or it is a limitation?

Of course the widget is "executing" the filter like this 

this.wiki.filterTiddlers(this.filter)

Jeremy Ruston

unread,
Apr 2, 2015, 9:58:20 AM4/2/15
to TiddlyWikiDev
Hi Danielo

I'm not sure that I've understood correctly, but one observation is that the currentTiddler variable does not necessarily contain the title of the tiddler containing the widget that is accessing it. Perhaps you can explain in a little bit more detail what is going on?

Best wishes

Jeremy


--
You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywikide...@googlegroups.com.
To post to this group, send email to tiddly...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywikidev.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywikidev/1419cfa1-db5b-436f-81b3-e5b6cfb615d9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Jeremy Ruston
mailto:jeremy...@gmail.com

Danielo Rodríguez

unread,
Apr 2, 2015, 11:36:09 AM4/2/15
to tiddly...@googlegroups.com
Hello Jeremy,

The use case is as follows :
The new functionality of the encrypt tiddler widget is to accept a filter that determines wich tiddlers are going to be encrypted. If you provide a filter as I stated above you expect the widget to not encrypt the tiddler where it is, but it does. Seems that the reference to the current tiddler is lost when the filter is compiled.

Jeremy Ruston

unread,
Apr 2, 2015, 12:05:28 PM4/2/15
to TiddlyWikiDev
Hi Danielo

The new functionality of the encrypt tiddler widget is to accept a filter that determines wich tiddlers are going to be encrypted. If you provide a filter as I stated above you expect the widget to not encrypt the tiddler where it is, but it does. Seems that the reference to the current tiddler is lost when the filter is compiled.

It still sounds like you're expecting currentTiddler within a widget to correspond to the title of the tiddler in which the widget is defined. That is not the case.

Are you passing a "widget" parameter to filterTiddlers to specify the currentTiddler value that you want?

Best wishes

Jeremy
 

--
You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywikide...@googlegroups.com.
To post to this group, send email to tiddly...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywikidev.

For more options, visit https://groups.google.com/d/optout.

Danielo Rodríguez

unread,
Apr 3, 2015, 4:25:12 AM4/3/15
to tiddly...@googlegroups.com, jeremy...@gmail.com


El jueves, 2 de abril de 2015, 18:05:28 (UTC+2), Jeremy Ruston escribió:

It still sounds like you're expecting currentTiddler within a widget to correspond to the title of the tiddler in which the widget is defined.

Exactly
 
That is not the case.
:(
 

Are you passing a "widget" parameter to filterTiddlers to specify the currentTiddler value that you want?

No, I didn't know it was even possible! What is the correct way to do it? which part of the widget? I think I can use the "this" property as parameter. 

Jeremy Ruston

unread,
Apr 3, 2015, 7:12:01 AM4/3/15
to Danielo Rodríguez, TiddlyWikiDev
Hi Danielo

You can pass a reference to a widget as the second parameter to filterTiddlers() and then that widget is used as the context for retrieving variable values. As you say, "this" within a JS macro points to the widget that is executing the macro.

Best wishes

Jeremy

Danielo Rodríguez

unread,
Apr 4, 2015, 10:44:43 AM4/4/15
to tiddly...@googlegroups.com
Hello Jeremy,

Is not actually a macro but a widget. But for this case I think is the same. Glad to know that it works with macros also. I'll try it out.
Reply all
Reply to author
Forward
0 new messages