Hi Sylvain

> On 29 May 2019, at 11:35, SylvainComte <[email protected]> wrote:
> 
> 
> Also, dealing with the toc macro, I noticed a <<__variable__>> notation that 
> I didn't met before and which seems to stand for $(variable)$. Is this 
> documented anywhere? are there differences?


The double underscore syntax for referencing macro parameters was introduced in 
v5.1.16:

https://tiddlywiki.com#Macro%20Definitions%20in%20WikiText

Adding double underscores to a parameter name allows one to refer to the 
parameter as a variable, instead of the value being inserted via textual 
substitution. That makes it much easier to deal with issues where a parameter 
contains e.g. a double quote.

The old way:

\define mymacro(text)
<$text text="$text$"/>
\end

<<mymacro Text>> --> this works

<<mymacro 'Te"xt'>> --> this doesn't work because of the double quote

The new way:

\define mymacro(text)
<$text text=<<__text__>>/>
\end

<<mymacro Text>> --> this works

<<mymacro 'Te"xt'>> --> this now works too

There are still situations where textual substitution is required, but it’s 
generally better to use the new double underscore syntax when possible, just to 
avoid these troubling edge cases where things stop working in the presence of 
innocuous characters.

Best wishes

Jeremy

-- 
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/189A97F5-4AEB-4432-ADA0-F4223564BB7A%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to