On Tuesday, August 18, 2020 at 2:05:26 AM UTC-7, harut...@gmail.com wrote: > > [all[current]backlinks[]] > doesn't return the backlinks wrote inside a macrocall, like this one: > <$macrocall $name="remembercz" text="[[example backlink]]"/> > To fix that issue I wanted to create a filter that searches for titles > written inside [[]], so that it works inside macrocalls aswell. > The problem is that you can't use [[]] brackets inside a macro definition, > so my first attempt to accomplish this didn't work: > \define text-pattern() [[$(currentTiddler)$]] > <$list filter="[all[current]backlinks[]] [regexp:title<text-pattern>]"></ > $list> > > ..a filter that searches for the string "[[example backlink]]"... >
There are several problems with the above approach: 1) The filter doesn't search the *content* of the tiddler. Rather, it is searching in the *title* of the tiddler. 2) The square brackets are actually regexp syntax. 3) The regexp filter doesn't return the matching text. Rather, it returns the title of the tiddler in which the match was found. Try this instead: \define start() "[[ \define end() ]]" <$list filter="[{!!text}split<start>splitbefore<end>removesuffix<end>]"> <$link><<currentTiddler>></$link><br> </$list> <$macrocall $name="remembercz" text="[[example backlink]]"/> 1) The start and end macros only find quoted links that have doubled-square brackets around them 2) The filter isolates the text in between the start and end values and then outputs that text as a link -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 tiddlywiki+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/7a550a7a-8cb8-4ab4-a1cb-a217dbebfc6ao%40googlegroups.com.