Thank you Mark, this is most clear and straightforward.

So I've introduced an auxmacro to be sure what I get is what I want:

\define auxdemo(dico, index) <$macrocall $name=spacedemo dico=$dico$ 
index=$index$/>

ÇThat way, it will be easier to write my macro. No more ugly surprise. And 
yes it is usefull' because sometimes you cannot use the macrocall widget if 
one of your parameter needs to be a macrocall widget too! In fact, this and 
the impossibility to use a macro as parameter of a macro are annoying in 
the long run, a grammatical distraction from your programming goal to 
achieve one's useful purpose.


Le mardi 6 avril 2021 à 16:39:02 UTC+2, Mark S. a écrit :

> Macros with << >> syntax do simple text substitution. They look like 
> "functions", but they are really just text substituters (new word).
>
> Sometimes AFTER the substitution things will get rendered. So in your 
> expression
>
> !!! space demo for "$index$" in "$dico$" [[$dico$]] (not 
> [[$dico$|$index$]])
>
> only the first $dico$ gets rendered. That happens AFTER the substitution. 
> The second and 3rd $dico$ are inserted literally, because they are inside 
> more wikitext (the links).
>
> Widgets, on the other hand, convert parameters before handling them. So 
> you might get the result you expect with:
>
> <$macrocall $name=spaceDemo dico={{!!dico}} index={{!!index}} />
>
> On Tuesday, April 6, 2021 at 6:19:36 AM UTC-7 jn.pierr...@gmail.com wrote:
>
>> I wanted to check if having space within a dictionary name or an index 
>> name was a go or a no-go for tw. So I wrote a macro to check it up (BTW, 
>> the answer is: no, it doesn't matter).
>>
>> OK, now for what I want to say here, the macro will only print its 
>> arguments as is and as a wiki link.
>>
>>
>> \define spaceDemo(dico index)
>> !!! space demo for "$index$" in "$dico$" [[$dico$]] (not 
>> [[$dico$|$index$]])
>> \end
>>
>> and now the invocation was
>>
>> <<spaceDemo dico:"mon autre dico" index:"ma citation">>
>> <<spaceDemo dico:"mon autre dico" index:"ma-citation">>
>> <<spaceDemo dico:"mon-autre-dico" index:"ma citation">>
>> <<spaceDemo dico:"mon-autre-dico" index:"ma-citation">>
>>
>> and I got what I thought I would get, like
>>
>> space demo for "ma citation" in "mon autre dico" mon autre dico (not mon 
>> autre dico)
>>
>> witg tge first link pointing to "mon autre dico" and the second to "ma 
>> citation".
>>
>> But then I added two fields within thi tidder calling the macro:
>> * a "dico" field containing "mon autre dico"
>> * an "index" field containing "ma citation"
>>
>> and I called the macro thus:
>>
>> <<spaceDemo dico:{{!!dico}} index:{{!!index}}>>
>>
>> and then, surprise!, I got:
>>
>> space demo for "ma citation" in "mon autre dico" {{!!dico}} (not 
>> {{!!dico}})
>>
>> with the first link to the litteral "{{!dico}}" and the second to 
>> "{{!!index}}".
>>
>> I would have thought the argument transmitted would have been interpreted 
>> before calling the macro. And why then this differences of treatment? What 
>> is the mechanism responsible of this?
>>
>> Practical interest, BTW: with" [[$arg$]]" you can see 
>> how really was written the argument "arg" when the macro was called.
>>
>> Regards,
>>
>>
>>
>>
>>
>>
>>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/e7107979-4a2e-4192-be4a-8add241acdb0n%40googlegroups.com.

Reply via email to