Need some help with macros

\define mymacro(tiddler:<<currentTiddler>>)  MACRO:$tiddler$ <$transclude tiddler=<<__tiddler__>> mode="block" />

I am experimenting with macros and I can not make the above one work.

The parameter tiddler seems correctly instanciated with the currentTiddler variable (I have not found in the documentation if it is allowed) as MACRO:$tiddler$ displays the correct value.

On the other hand, <$transclude tiddler=<<__tiddler__>> mode="block" /> is not working and I do not understand why.

This example does not make too much sense, because it you create a macro, that should have currentTiddler as the default value it has to create an endless loop as soon as the tiddler parameter in the macro call is empty.

So it would make more sense if you would describe what you want to achieve instead of some non-working code.

It would be much easier for us to hint a working solution.

Anyway. here is some working code. (The code uses some whitespace to make it more readable. Production code should look different!!)

\define xx(tiddler)
TIDDLER:$tiddler$ 

<hr>

<$transclude tiddler=<<__tiddler__>> mode="block" >
     <$transclude mode="block" />
<$transclude>
\end

<<xx test>>

<<xx>>

It uses a special mechanism of the transclusion-widget. When the tiddler parameter does not exist or is an empty string it uses the body of the transclusion widget as a fallback.

The inner transclusion widget without any tiddler parameter uses currentTiddler as a fallback.

See: https://tiddlywiki.com/#Transclusion