\define smac1(a) This is $a$\define smac2(b) and I it is really $b$.
\define myMac(x,y)<<smac1 $x$>> <<smac2 $y$>>\end
<<myMac "TW" "lovely">>
title: My Invocation tiddler
tags: RandomTag
\define myMac(x,y)
<<smac1 $x$>> <<smac2 $y$>>
\end
<<myMac "TW" "lovely">>
The case is how can I have myMac available globally (can be invoked from any tiddlers) but smac1 and smac2 remain private!
\define myMac(x,y)
<$importvariables filter="[tag[MyMacroFunctions]]">
<<smac1 $x$>> <<smac2 $y$>>
</$importvariables>
\end
<$importvariables filter="smacFunctions">On Sunday, July 1, 2018 at 7:22:20 AM UTC-7, Mohammad wrote:The case is how can I have myMac available globally (can be invoked from any tiddlers) but smac1 and smac2 remain private!1) put myMac() in a tiddler tagged with $:/tags/Macro2) put smac1() and smac2() in another tiddler (e.g., "smacFunctions") tagged with "MyMacroFunctions"in the definition of myMac(), write:
\define myMac(x,y)
<$includevariables filter="[tag[MyMacroFunctions]]">
<<smac1 $x$>> <<smac2 $y$>>
</$includevariables>
\end
The <$includevariables> widget pulls in all the variables (i.e., macro definitions) contained in the tiddlers matching the specified filter.
Note that, if you only want to include variables from one specific tiddler, then you don't need to use a tag... you can just specify the name of the tiddler as the filter:
<$includevariables filter="smacFunctions">enjoy,-e
I use the TW 5.1.18-prerelease, it seems instead of $includevariables I have to use $importvariables