Mohamad,
I can assure you it is worth it. Remember you can always hard code values
in you tiddlers that name the tiddler. My documentation in the attached is
a wikitext method to do it programaticaly but in many ways it is advanced
tiddlywiki.
best of luck
On Wednesday, 26 May 2021 at 10:15:42 UTC+10 Mohamed Amin wrote:
>
> Appreciate your support TW Tones , I think I'll need sometime to get my
> head around this "Transclusion Monster" :)
>
> Thanks again
>
> On Sunday, May 23, 2021 at 3:06:53 AM UTC+2 TW Tones wrote:
>
>> Mohamed,
>>
>> Perhaps I can publish something another time to go into these two things
>> in the future. However I will once again give some essential information to
>> set you on the path.
>> Most of these things have being covered in the past in the forum however
>> they would be hard to find,
>>
>> 1. Identify a tiddler that has being transcluded see attached
>> 2. There are many ways to show this happening all you need you do is
>> have something that generates a tiddler containing a macro definition and
>> tag it $:/tags/Macro, eg a button can create such a tiddler.
>>
>> Regards
>> Tones
>>
>>
>> On Saturday, 22 May 2021 at 23:33:46 UTC+10 Mohamed Amin wrote:
>>
>>> 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/6eb453ea-0040-463a-b922-3f2a3d278653n%40googlegroups.com.