How to work with square bracket in operators

52 views
Skip to first unread message

W Yan

unread,
Nov 25, 2020, 2:58:13 PM11/25/20
to tiddl...@googlegroups.com
For example, {{{ [{!!field}split[[]join[ ]] }}} seems to work find but {{{ [{!!field}split[]]join[ ]] }}} is giving me syntax errors. So [ works but ] doesn't - how should I handle this?

Mohammad

unread,
Nov 25, 2020, 3:57:53 PM11/25/20
to TiddlyWiki
There are some greats resources to learn the syntax, have a look 


Good luck

Eric Shulman

unread,
Nov 25, 2020, 4:15:36 PM11/25/20
to TiddlyWiki
On Wednesday, November 25, 2020 at 11:58:13 AM UTC-8 W Yan wrote:
For example, {{{ [{!!field}split[[]join[ ]] }}} seems to work find but {{{ [{!!field}split[]]join[ ]] }}} is giving me syntax errors. So [ works but ] doesn't - how should I handle this?

The problem is that the first close bracket, "]" is being recognized as the ending delimiter for the split[...] operator.  The result is that the second close bracket is left behind as invalid filter syntax.

A workaround is to define a variable that contains the text of the parameter for the split operator and then use the variable reference in the filter, rather than the literal [...] syntax.

Something like this:

<$vars closebracket="]">
{{{ [{!!field}split<closebracket>join[ ]] }}}
</$vars>

-e

W Yan

unread,
Nov 25, 2020, 5:21:49 PM11/25/20
to tiddl...@googlegroups.com
Very nice resources Mohammad, much appreciated. They seem to be much more thorough than what's explained in official docs, and I learned a lot reading them.
 
Eric, Thank you for the workaround! I've been trying to figure it out myself for couple of days, now tried your solution and it works perfectly.
Reply all
Reply to author
Forward
0 new messages