Yes, both of you helped me, in different ways. The use of __ was not very 
well explained. Here, I have a working example in full, coupled within a 
filter, and that's a real gem for me.

And yes, the macro is not mean for black magic! Ony pouring text. That's 
simple but so easy to forget!!! Repeating again and again until it's an 
habit :-)

But I have a problem with the macro text substitution and the wiki parsing. 
But this I will tell in an other subject, because this one has been fully 
answered!

Mega thanks to our experts!

Le mardi 6 octobre 2020 à 19:18:31 UTC+2, Eric Shulman a écrit :

> On Tuesday, October 6, 2020 at 8:28:05 AM UTC-7, Jean-Pierre Rivière wrote:
>
>> I have to filter tiddler with tags names of the form "criterion 2.4", 
>> "criterion 10.1", etc...
>> I have devised a simple macro:
>> \define countCrit(crit) <$count filter="[tag[$crit$]]"/>
>> which is call like <<countCrit "criterion 4.2">>
>>
> But repeating "criterion" is tedious and could make error...
>>
>
> Macros do ONLY two things:
> 1) replace $param$ with values passed in as parameters
> 2) replace $(variable)$ with values defined outside the macro as variables
>
> They do *NOT* actually parse or interpret the syntax inside the macro.  
> They simply treat the entire macro content as a text string, and then use a 
> "string replace" action to insert the values where they belong.
>
> Thus, if you have a macro like this:
> \define countCrit(crit) <$count filter="[tag[critère $crit$]]" />
>
> and you invoke it using
> <<countCrit 4.2>>
> the resulting syntax that is produced by the macro,*before any parsing 
> occurs*, will be:
> <$count filter="[tag[critère 4.2]]" />
> which is just what you want.
>
> No fancy use of inline filters or other methods needed to assemble the 
> desired value.
>
> 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/cb8984d2-51f2-4f51-8e48-ddc6bd28be64n%40googlegroups.com.

Reply via email to