Added to TW-Scripts

On Thursday, April 2, 2020 at 4:27:39 AM UTC+4:30, Eric Shulman wrote:
>
> I did not now when you import a macro, then you cannot use it like 
>> $(path)$
>>
>
> A macro only does two kinds of processing:
> * replace occurrences of $foo$ with the value passed in as a parameter
> * replace occurrences of $(foo)$ with the value of a variable defined 
> *outside* the macro
>
> It then returns the contents of the macro, with the replacements, which 
> can then be further parsed in the calling context.
> Thus, in your example, using the "\import aa" pragma inside your macro 
> doesn't work as you want because $(path)$ is not defined *outside* the 
> macro definition.
>
> The following, however, DOES work...
>
> in bb, write:
> \define mymac_inner(file)
> <$vars fullpath="$(path)$/$file$">
> some code go here!
> <<fullpath>> is wrong!
> </$vars>
> \end
>
> \define mymac(file)
> \import aa
> <<mymac_inner $file$>>
> \end
>
> Using the above, you can then call <<mymac readme>> from another tiddler, 
> and get the results you expect.
>
> enjoy,
> -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 view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/f9362616-65b6-453a-b63e-b3dddf458729%40googlegroups.com.

Reply via email to