On Thursday, September 23, 2021 at 3:57:35 PM UTC-7 [email protected] wrote:
> How might I make this searching tiddler more robust in the presence of
> "tags with spaces", since I also use spaces to delimit tags in the
> `edit-text`?
>
The problem is the use of
`<$set name="tagList" filter="[enlist{$:/temp/tagSearch}sort[]join[,]]">`
Let’s say you entered “foo [[bar baz]]” (i.e., two tags, “foo” and “bar
baz”).
Then, you might expect the results of the above $set widget to be “foo,bar
baz”. However, because this string contains a space, the $set widget
*automatically
encloses the output in double square brackets*. Thus, the actual result is
“[[foo,bar baz]]”. Then, when you use `match<tagList>` later on, it expects
those square brackets to be part of the literal string match.
The solution is to use $vars with a “filtered transclusion” for the value,
instead of $set, like this:
`<$vars tagList={{{ [enlist{$:/temp/tagSearch}sort[]join[,]] }}}>`
Then, tagList will be “foo,bar baz”, as you intended.
Alternatively, you *can* use $set, by adding “select=0” as an extra
parameter, like this:
`<$set name="tagList" filter="[enlist{$:/temp/tagSearch}sort[]join[,]]"
select=0>`
This tells the $set widget to only return the first list item (i.e.,
item #0), without adding any square brackets.
-e
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/4bc9490a-758e-4882-b3fe-112cb45c3bbdn%40googlegroups.com.