Thanks a lot TW Tones for your detailed answer, it's really helpful and
thoughtful.
BUT you already opened my eyes on VERY interesting points :
1. Identify a tiddler that has being transcluded
2. The macro is itself generated automatically
Appreciate your help to know where to start learning about those points.
Thanks again
On Saturday, May 22, 2021 at 4:08:52 AM UTC+2 TW Tones wrote:
> Mohamed,
>
> *The easiest way is to set values in the macro itself.*
>
> eg in a tiddler "MacroDef
> \define themacroname()
> <$set name=macro-name value="themaconame">
> <$set name=macro-tiddler value="MacroDef">
> <$link /> <<macxro-name>> in <<macro-tiddler>><br>
> Do macro stuff here
> </$set></$set>
> \end
>
>
>
> Then in another tiddler
> <<themacroname>>
>
> So within the macro its name and tiddler are available as a variable.
>
> *Alternatively; the following method makes use of macro parameters;*
>
> \define themacroname(macro-name:"themacroname" macro-tiddler:"MacroDef" )
> <$link /> <<__macro-name__>> in <<__macro-tiddler__>><br>
> <hr><!-- OR -->
> <$link /> $macro-name$ in $macro-tiddler$ <br>
> Do macro stuff here
> \end
>
>
> - <<__macroParameter__>> Parameter-as-variable access to a parameter
> defined in the macro parameters list as it it were a variable.
> - This method also Allows the $parameter$ substitution that allows you
> to do things like tooltip="My $parameter$" in a button, which is a form
> of
> concatenation.
>
>
> Notes
>
> - There are other special ways available to identify a tiddler that
> has being transcluded, but the transclude tiddler can also set set a
> variable or two.
> - This will cover most requirements except where the macro is itself
> generated automatically, ie when putting in static values is insufficient.
> - Another trick is a macro that you give a macroname as its parameter,
> that it then uses to call the macro, thus the macro name is available.
> - Given a macroname you can also search for "\define macroname(" in
> all tiddlers to find one or more places where it is defined.
>
> Tones
>
>
> On Saturday, 22 May 2021 at 10:29:13 UTC+10 Mohamed Amin wrote:
>
>> Hi,
>>
>> As I know, using "currentTiddler" inside a Macro will get the "Caller
>> Tiddler" title.
>> Is there a way to let a Macro to access its own tiddler?
>>
>> For example:
>> If I've a Macro name "myMacro01" which is defined in a tiddler called
>> "Macro01_Tdlr".
>> Now, if I call this macro from a tiddler called "XYZ" , then the
>> "currentTiddler" value will be "XYZ".
>> Is there a way to let the macro get its own tiddler name (Macro01_Tdlr)?
>>
>> A use case:
>> I'm thinking to have a series of Macros, each is defined in its own
>> Tiddler.
>> then I'll use the fields in each "Macro Tiddler" to control the behavior
>> of the macro (the Macro will need to access the fields inside its own
>> tiddler)
>>
>> any idea?
>>
>> Thanks in advance
>>
>>
--
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/663406e7-d3e7-43a8-9468-fa7c0d1694e1n%40googlegroups.com.