Folks,

I am currently working on a comprehensive cheat sheet here based on various 
contributors work, Mohammad's useful reference was in part based on an 
earlier version by Tobias.

I would appreciate feedback and I will update this resource.

I just added the use of 
<__parmname__>

 in filters but need to test it further.

Regards
Tony


On Saturday, 10 October 2020 02:39:26 UTC+11, Atronoush wrote:
>
> Have you looked at TW-Scripts? https://kookma.github.io/TW-Scripts/
> Have you searched for syntax?
> See https://kookma.github.io/TW-Scripts/#Shorthand%20Syntax%20Summary
>
> It is a great resource for the TW community made by the TW community!
>
> --Atro
>
> On Fri, Oct 9, 2020 at 3:08 PM Jean-Pierre Rivière <[email protected] 
> <javascript:>> wrote:
>
>> As a final word, here are united 4 macros doing exactly the same thing. 
>> The interesting spot is the little differences in the way to use the syntax 
>> of accessing a variable or a parameter. Notably, see the use of <__myVar__> 
>> when the official doc just speaks of <<__myVar__>> (which is not helping). 
>> Most of these macros were given by Atronoush and Eric. I thought it would 
>> be nice to have them united for reference.
>>
>> \define compter(tagg) <$count filter="[tag[critère $tagg$]]"/> tagged
>>
>> \define compteux(rTag)
>> <$vars cTag={{{ [<__rTag__>addprefix[critère ]] }}}>
>> pour <<cTag>>, <$count filter="[tag<cTag>]"/> tagged
>> </$vars>
>> \end
>>
>> \define comptard(rTag) <$count filter="[<__rTag__>addprefix[critère 
>> ]tagging[]]"/> tagged
>>
>> \define comptine(rTag) <$count filter="[[critère $rTag$]tagging[]]"/> 
>> tagged
>>
>> <<compteux 1.2>> :: <<compter 1.2>> %% <<comptard 1.2>> ~/~ <<comptine 
>> 1.2>>
>>
>>
>> Le vendredi 9 octobre 2020 à 11:55:10 UTC+2, Jean-Pierre Rivière a écrit :
>>
>>> 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] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/tiddlywiki/3441b993-2e81-4e5a-8adc-bff042c9c9bfn%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/tiddlywiki/3441b993-2e81-4e5a-8adc-bff042c9c9bfn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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/e8801e71-217b-49dd-98af-c25070657851o%40googlegroups.com.

Reply via email to