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/5964a844-4b91-4279-b8ce-8816556a16e7o%40googlegroups.com.

