LetWidget with filter attribute value that has spaces

60 views
Skip to first unread message

andres....@gmail.com

unread,
Feb 6, 2022, 10:48:22 AM2/6/22
to TiddlyWiki
So, given the following LetWidget example:

<$let n={{{ [[foo]][[bar]] }}}></$let>

Since that filter returns a list of tiddlers, I would get n=foo and bar gets assigned as its own attribute (pretty sure).

I am using a SetWidget to solve my problem, but wondering if there is some way of enclosing a let attribute value such that a filter result containing spaces is preserved in whole.

Thanks for reading!

PMario

unread,
Feb 7, 2022, 2:43:28 AM2/7/22
to TiddlyWiki
Try this

```
<$set name=n filter=" [[foo]][[bar]]">

{{{ [enlist<n>] }}}

<<n>>

</$set>
```

PMario

unread,
Feb 7, 2022, 2:44:55 AM2/7/22
to TiddlyWiki
That's a better example

```
<$set name=n filter=" [[foo]][[bar bas]]">

{{{ [enlist<n>] }}}

<$text text=<<n>>/>

</$set>
```

andres....@gmail.com

unread,
Feb 7, 2022, 8:28:54 AM2/7/22
to TiddlyWiki
Thank you. I did solve it already with a SetWidget. I was hoping for a solution that would use the LetWidget as is.
Essentially I am wondering if the LetWidget is limited to filter results with only one returned title.

andres....@gmail.com

unread,
Feb 7, 2022, 8:57:46 AM2/7/22
to TiddlyWiki
> Essentially I am wondering if the LetWidget is limited to filter results with only one returned title.
Or if there is something that I could learn about writing the expressions or how to quote it. There is always a new way to skin a cat in tiddlywiki! :D!

PMario

unread,
Feb 7, 2022, 8:59:16 AM2/7/22
to TiddlyWiki
On Monday, February 7, 2022 at 2:28:54 PM UTC+1 andres....@gmail.com wrote:
Thank you. I did solve it already with a SetWidget. I was hoping for a solution that would use the LetWidget as is.

If {{{xx}}} is used and there are several results it will always only apply the first result. That's by design.

So the following code will all have the same result: n=foo

```
<$let n={{{ [[foo]][[bar]] }}}>
<<n>>
</$let>

<$vars n={{{ [[foo]][[bar]] }}}>
<<n>>
</$vars>

<$set name=n value={{{ [[foo]][[bar]] }}}>
<<n>>
</$set>
```

 
Essentially I am wondering if the LetWidget is limited to filter results with only one returned title.

No. As written above it's how {{{..filter..}}} is resolved. It doesn't matter which widget you use. You have to use the `<$set name=n filter="..."` or `<$list filter="..."`, to get several results.

-mario

andres....@gmail.com

unread,
Feb 7, 2022, 10:27:17 AM2/7/22
to TiddlyWiki
Thank you so much for your help, Mario! This conversation did kick a cog into gear in my head and I realized that the filtered transclusion was returning a list and that is distinct from a string with spaces. so I added a +[join[ ]] to my expression and that got me the result I wanted.
Which, for the use case where I first encountered this, that actually worked perfectly.

<$let n={{{ [[foo]][[bar]] }}}>
<<n>>
</$let>
<!-- foo -->

<$let n={{{ [[foo]][[bar]] +[join[ ]] }}}>
<<n>>
</$let>
<!-- foo bar -->

PMario

unread,
Feb 7, 2022, 10:35:12 AM2/7/22
to TiddlyWiki
On Monday, February 7, 2022 at 4:27:17 PM UTC+1 andres....@gmail.com wrote:
Thank you so much for your help, Mario!

You are welcome!
 
This conversation did kick a cog into gear in my head and I realized that the filtered transclusion was returning a list and that is distinct from a string with spaces. so I added a +[join[ ]] to my expression and that got me the result I wanted.

You are right. I could have thought about this myself ... ;)

Thanks for sharing your solution, so others may find it in the future.
-mario

Télumire

unread,
Feb 7, 2022, 10:43:17 AM2/7/22
to TiddlyWiki
You might also want to throw in a format:titlelist[] just before the join[ ] if you want to get the titles back later on.

andres....@gmail.com

unread,
Feb 7, 2022, 9:21:24 PM2/7/22
to TiddlyWiki
Télumire,

I don't need it now, no. But super useful to know for the instances where I will need it. Thank you!
Reply all
Reply to author
Forward
0 new messages