Why not just make "separator" a 3rd parameter with a default of "|" ? What 
is the advantage or concern with storing the value in a field of the macro 
tiddler itself?

I think if you want to find the name of the containing tiddler, you will 
have to have the macro hunt for it before it actually runs the content of 
the macro. One way to do this would be to give the macro field a highly 
unique name. For instance mymacroname_separator. That should be easy to 
search for. A more difficult search would be to look for the string 
"\define mymacroname(" in every tiddler marked as a global macro. Either 
way will likely mean some small hit to performance.

-- Mark

On Friday, March 22, 2019 at 7:18:14 AM UTC-7, S. S. wrote:
>
>
> Within a tiddler that contains a global macro, I want to be able to 
> reference a *field* within the tiddler where the macro is defined.
>
> If I share the tiddler with the macro and that person renames the tiddler, 
> the reference breaks. I want to stop this happening.
>
> So I thought of having something like a hypothetical *tv-macro-origin* 
> Variable, so that I can safely reference the tiddler & field the macro is 
> in.
>
> Example - I have a tiddler with fields:
> title: *showSeparatedText Macro*
> tags: *$:/tags/Macro*
> separator: *|*
>
> \define showSeparatedText(in out)
> The original tiddler's separator is: {{showSeparatedText 
> Macro!!separator}}
> <br>
> The hypothetical separator is: {{$(tv-macro-origin)$!!separator}}
> <br>
> This works: $in$ {{showSeparatedText Macro!!separator}} $out$
> <br>
> I want this to work: $in$ {{$(tv-macro-origin)$!!separator}} $out$
> \end
>
>
> In another tiddler I put this code:
>
> <$macrocall $name="showSeparatedText" in="A" out="B"/>
>
> The result:
>
> The original tiddler's separator is: |
> The hypothetical separator is:
> This works: A | B
> I want this to work: A B
>
> I was hoping the recent discussion under : Test for existence of macro 
> <https://groups.google.com/forum/?hl=en#!topic/tiddlywiki/4rEuAWc4EpM> : 
> could have helped, but it doesn't appear to.
>
> Any pointers on how this can be achieved would be appreciated.
>
> Thanks!
>
>
>

-- 
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/252b7550-4bbb-4d3a-8255-57e69b7e2ee1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to