Thanks Jeremy, I will drink this advice deeply, and take more care with my understanding when a result is wikified or not.
Regards Tony On Saturday, November 24, 2018 at 9:52:53 PM UTC+11, Jeremy Ruston wrote: > > Hi Tony, Mohammad, > > A couple of points about this example: > > On 22 Nov 2018, at 06:47, TonyM <[email protected] <javascript:>> > wrote: > > <<currentTiddler>> > <$set name=display-title filter="[all[current]get[caption]] ~[{!!title}]"> > <<display-title>> > <$link to=<<currentTiddler>> tooltip="Open tiddler"><<display-title> > ></$link> > </$set> > > > First, you’re displaying the name of the current tiddler using a macro > invocation <<currentTiddler>>. The problem there is that the text will be > wikified, so if you have a tiddler called “This //is// my tiddler” then the > title will not be displayed as expected. To avoid wikification you can use > <$text text=<<currentTiddler>>/>. > > Second, you’re evaluating the filter using the “filter” attribute of the > set widget. The action of the set widget here is to evaluate the filter, > and then store all of the results in the target variable as a list (ie, > space separate tiddler titles, with double square brackets for quoting > titles that contain spaces). > > That means that if your caption contained, say, “This is the caption”, > then the text that would be assigned to the variable display-title would be > “[[This is the caption]]” (ie including the double square brackets). > > You’re probably better off using the filtered transcluded attribute syntax: > > <$set name=display-title value={{{ [all[current]get[caption]] ~[{!!title}] > }}}> > > Using the triple braces the quote an attribute value causes the string > within the quotes to be evaluated as a filter, and then the first entry (if > any) is returned. Thus, with the example above you’d get the expected text > “This is the caption”, without the double square brackets. > > Best wishes > > Jeremy > -- 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 post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/tiddlywiki. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/b32b4121-ca6c-41e3-b578-10bacc069450%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

