On Monday, February 25, 2019 at 11:18:49 PM UTC-8, S. S. wrote:
>
> I'm having a problem understanding WHY example 2. BREAKS down.
> I did not even know how to give this post an appropriate title!
> I would appreciate if someone could explain it to me.
>

OK... Let's see if this helps:

TiddlyWiki macro definitions are NOT functions in the traditional 
programming sense.  Although input "parameters" can be passed to them, and 
they "return" something as a result, they don't actually "run" any of the 
"code" they contain.  When a macro is invoked, it does two things (and ONLY 
two things):

1) replace all occurrences of $paramname$ with the corresponding value that 
was passed as an input parameter
2) replace all occurrences of $(variablename)$ with the current value of 
the variable (assuming it is defined in the context of the "caller" of the 
macro)

That is ALL it does.  After doing the replacements, the resulting content 
is "returned".  If the macro call is being used as a widget parameter, then 
the result is simply passed along to the widget for further processing.  
However, if the macro call is embedded directly in wiki content, then it is 
rendered.

In light of the above, when you invoke the following:
2. BREAKS: <$macrocall $name="test" list-tids=<<get-related-tiddlers>> field
="list" />
the value of the "list-tids" parameter is simply passed along to the widget 
and will NOT be the contents of the list field, but rather will literally 
be:
<$view tiddler=SomeTiddlerName field="list" mode="block"/>

In contrast, when you use <$wikify> on the macro, you are forcing it to be 
rendered and then capturing that result in the variable 
"GOT-related-tiddlers".  Thus, the <$view> widget contained in the macro 
DOES get processed, and the result is then available to pass along to the 
"list-tids" param.

Also, I wonder if this use case was the primary reason for making the 
> $wikify widget? If not, what was?
>

I would say it was a convincing reason, though perhaps not the only one.

hope this helps,
-e

-- 
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/1cb21b2c-a74e-4916-8710-714e0f030b19%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to