Filter and spaces

If you get your filter with the $set widget, you can have nice things like

 «$set name=askTest select=0 filter="
[<dataCrit>!is[blank]then[no]else[yes]]
=[<dataThemeCompatibleWithDataCrit>!is[blank]then[no]else[yes]]
=[<actionValue>prefix[critère ]!is[blank]then[no]else[no]]
=[<actionValueIsIncompatibleWithDataCrit>!is[blank]then[yes]else[no]]
+[dump:s[yes or no]match[yes]first[]!is[blank]dump:s[any yes?]else[no]dump:s[decision for askTest]]
">

but if you like the more concise a={{{ filter }}} approach, beware! You can’t do that as the space are restricted to only a single space. Now that means:

 <$let askTest={{{ [<dataCrit>!is[blank]then[no]else[yes]] =[<dataThemeCompatibleWithDataCrit>!is[blank]then[no]else[yes]] =[<actionValue>prefix[critère ]!is[blank]then[no]else[no]] =[<actionValueIsIncompatibleWithDataCrit>!is[blank]then[yes]else[no]] +[dump:s[yes or no]match[yes]first[]!is[blank]dump:s[any yes?]else[no]dump:s[decision for askTest]] }}}
>

which is a big mess. (This is a real-life example.)

Any hope for a more relaxed triple-curvy-braces notation?

@jypre do you mean you can use line-breaks inside a <$set> widget but not inside {{{ ... }}} filters ?

As of TW5.2.2 (the current stable release version), you can now use line breaks within filtered transcluded attributes. (see https://tiddlywiki.com/#Release%205.2.2)

In addition, you should take note that there is an important semantic difference between <$set name=askText filter="..."> and <$let askText={{{ ... }}}.

When using the $set widget with a filter, if the filter produces multiple results, the entire list of results is assigned to the variable as a space-separated list with doubled square brackets around items that contain spaces.

In contrast, when using $letwith a filtered transclusion as the parameter, only the first filtered result is assigned to the variable and that value doesn’t include brackets, even if it contains spaces.

For example, on https://tiddlywiki.com

  • <$set name="mylist" filter="[tag[HelloThere]]">
    results in
    [[A Gentle Guide to TiddlyWiki]] [[Discover TiddlyWiki]] [[Some of the things you can do with TiddlyWiki]] [[Ten reasons to switch to TiddlyWiki]] Examples [[What happened to the original TiddlyWiki?]]

  • but, <$let mylist={{{ [tag[HelloThere]] }}}>
    results in just
    A Gentle Guide to TiddlyWiki

-e

2 Likes

Many thanks @EricShulman!

I am already on v5.2.2 and yes I did notice the difference. Where I need a bag of results, I have kept the $set widget. This does not happen often.

Indeed you’re right, it dos function OK on 5.2.2. I must have changged something else when I thouhght to have spotted the problem yesterday. Late coding is not always such a good idea…