On Monday, July 20, 2020 at 4:19:50 PM UTC-7, steve wrote:
>
> This time I tried a macro with a filter that used goFish in a filter. See
> below.
> Nothing was listed in the outputText.
> Tomorrow I'll look at the literal output text.
>
The problem here is that the input text contains quotes and doubled close
squarebrackets.
The quotes in the inputText interfere with quotes that delimit the
filter="..." syntax in your macro,
and the ]] in the inputText interferes with the brackets that surround the
[[$inputText$]] in the filter.
To avoid all that, instead of passing the text into your macro as a
parameter,
pass the name of the tiddler you want to process, and then fetch the text of
that tiddler inside your filter, like this:
\define formatTid.highlightText(source targetString)
<$set name="outputText" filter=
"[{$source$}splitregexp[\b$targetString$\b]join[@@color:blue;$targetString$@@]]"
select="0">
| ''outputText''|@@white-space:pre;<<showOutput>>@@|
\end
\define showOutput()
\rules only styleinline
$(outputText)$
\end
<$macrocall $name="formatTid.highlightText" source="highlightTest.sentence"
targetString="goFish"/>
enjoy,
-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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/9594f1e7-9a9b-40ae-9d5e-ed7f9f2483cao%40googlegroups.com.