Hi Tony, Mohammad,

A couple of points about this example:

> On 22 Nov 2018, at 06:47, TonyM <anthony.mus...@gmail.com> 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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
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/1257634E-594C-4A6E-AF06-DCBD4A47D749%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to