On Thursday, March 2, 2017 at 3:38:17 PM UTC-8, mauloop wrote:
>
> Here I am, Eric, and thanks for your help. I hope I'll be able to explain
> clearly.
>
<<str "{{$(currentTiddler)$##$(i)$}}">>
>
When <<str ...>> is invoked outside a macro (your initial, successful
implementation), the quoted text parameter, "{{$(currentTiddler)$##$(i)$}}"
is simply passed into the macro, which then expands the $(currentTiddler)$
and $(i)$ references, producing the desired result.
However... when the <<str ...>> syntax is moved inside of another macro
(i.e., the <<table>> macro definition), all $(...)$ references within the
<<table>> macro are expanded as soon as the macro is invoked. This
includes expanding the $(currentTiddler)$ and $(i)$ references within the
quoted text argument to the <<str>> macro. Thus, by the time <<str ...>>
is actually invoked within the <<table>> macro, it's param no longer
contains the literal "$(currentTiddler)$" text to be passed down to the
<<str>> macro handler, but has already been replaced by the value of
$(currentTiddler)$ that was defined when the <<table>> macro was invoked.
To work around this, you can create your own little use-case specific
helper macro as an alternative to the general-purpose <<str>> macro.
Something like this:
\define showIndexValue() {{$(currentTiddler)$##$(i)$}}
Then, instead of
<<str ...>>
you would just write
<<showIndexValue>>
Note that this new macro achieves the same effect as the <<str ...>> usage
(i.e., joining together the title (currentTiddler) and index name (i) and
then retrieving that value using transclusion {{...}}). However, because
<<showIndexValue>> does not use parameter passing, the references to
$(currentTiddler)$ and $(i)$ are left unchanged until <<showIndexValue>> is
actually invoked, rather than when the containing <<table>> macro is first
entered.
I hope this explanation doesn't make your head spin too much!
Let me know how it goes.
enjoy,
-e
Eric Shulman
TiddlyTools: Small Tools for Big Ideas! (tm)
InsideTiddlyWiki: The Missing Manuals
--
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/db8d06d8-8d55-40bb-b554-d261d76c236b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.