Force brackets on input titles with format:titlelist or add the raw flag to the join operator?

I was doing some tests to see if it was possible to circumvent filter deduplication to be able to join titles and filter runs in a single string without the need for adding a = for every input title, when I came across the enlist-input:raw[] operator. I though I would be able to use this to convert a string of text into an un-duplicated list and then use a :map filter run to run each title with a subfilter[] operator, but it turns out that the enlist input remove the brackets when it turns a string into a title, which prevent the subfilter operator from working.

I tried to fix that with the format:titlelist[] operator, but it only add brackets to title with spaces.
Therefore, I think it would be great to have a flag to force that on every titles (except those already in brackets), that way the following would be possible :

{{{ 
'
A

[[1]add[1]]

A
'

+[enlist-input:raw[]format:titlelist[]]:map[subfilter<currentTiddler>] 

}}}

Expected output :

A
2
A

Currently :

A
Filter error: Syntax error in filter expression
A

This is because enlist-input will remove the brackets of the filter “[[1]add[1]]” and thus the subfilter operator fail.

To fix that, I think the syntax of format:titlelist[] needs a flag to always add brackets when there is no brackets, something like format:titlelist:all[] maybe, or format:titlelist:raw[] .

Another option would be to extend the syntax of the join[] operator to allows duplicate input titles, something like +[join:raw[]].

What do you think ?

1 Like

This seems to work. I did add subfilter to your filter expression. enlist has no subfilter function. It only enlists tiddler titles.

{{{ 
'
[[A AA]]

[subfilter[1]add[1]]

A

A
'

+[enlist-input:raw[]format:titlelist[]]:map[subfilter<currentTiddler>] 

}}}

[title[1]add[1]] also works, this is because when a title begins with [[ it is interpreted as a title and then trimmed, thus filters run that beginning with double brackets (like [[1]add[1]]) will fails.

If format:titlelist[] was applied on every title input then it would keep the bracket for the subfilter operator inside of the map filter run (I think ?)

It would be equivalent to this :

{{{ 
'
[[A]]

[[[[1]add[1]]]] --> apply brackets anyway

[[A]]
'

+[enlist-input:raw[]]
:map[subfilter<currentTiddler>] 
}}}

The join operator does not remove duplicates. For example:

=a =a =b =c +[join[]]

Yes but if we do not use = signs, duplicates input are removed (default behavior) :

{{{ [[a]] [[a]] [[a]] +[join[]] }}}

a

This is not a big deal for short runs but it decrease readability. I think it would also make sense that we could use a :raw flag, since it’s available on the enlist-input operator :

{{{ [[a]] [[a]] [[a]] +[join:raw[]] }}}

aaa

This would be very usefull for creating dynamic inline css without worrying that some values could be erased by the dedup.

E.g :

<div style={{{ color:[<color>];background:[<color>] +[join:raw[]] }}}>..</div>

But maybe it’s not available because it would break something ?

The deduplication happens in your preceding filter runs and therefore modifying join[] would not achieve anything.

I see, there is no way to prevent that without changing the way the filters are run … then the next best thing is to be able to use enlist-input:raw + format:titlelist as described in my previous post I guess ? That way we can disable the deduplication without the need to use “=”.