Escape characters in filter operands?

109 views
Skip to first unread message

Mat

unread,
Jan 20, 2017, 2:12:07 AM1/20/17
to TiddlyWiki
Mission: Take out the text from a tiddler and split after a specified string. This works fine:

{{{ [[sometiddler]get[text]splitbefore[tidtitle]] }}}

...but what to do if the tidtitle is instead [[tid title]], i.e surrounded by brackets? How escape the brackets in operator arguments so they don't interfere with the filter?

Merely introducing "\" as escape character does not work, i.e:

{{{ [[sometiddler]get[text]splitbefore[\[\[tid title\]\]]] }}}


Note, it seems mainly to be the closing double brackets of the link that cause problems. The following works but feels kinda hacky:

{{{ [[sometiddler]get[text]splitbefore[[[tid title]] }}}


I realize it is solvable with some external macro - i.e first testing the argument to see if it has brackets, then shave it, then return it - but I'm hoping there is a more ready made solution given the general need of escaping characters in filter operands.

Thanks!

<:-)

Tobias Beer

unread,
Jan 20, 2017, 2:27:18 AM1/20/17
to tiddl...@googlegroups.com
Hi Mat,

No escaping is needed. Variables are your friend...

\define test() foo [[bar baz]] mumble frotz

<$vars this="[[bar baz]]">
{{{ [<test>splitbefore<this>] }}}
</$vars>

Best wishes,

Tobias.

Mat

unread,
Jan 20, 2017, 2:56:45 AM1/20/17
to TiddlyWiki
Ah! That should suffice -Thanks!

<:-)

Reply all
Reply to author
Forward
0 new messages