Tony!

On Sunday, August 4, 2019 at 5:18:44 PM UTC+4:30, TonyM wrote:
>
> Mohammad,
>
> Give this example of yours I currently use another pattern for something 
> similar. So I thought It a good time to share.
>
> \define display(template)
> <$set name=template value="$template$" emptyValue=
> "$:/plugins/kookma/timelines/templates/gilan" variable=null>
>
> <$transclude tiddler=<<templateTiddler>> mode=block/>
>
> </$set>
> \end
> Not tested
>

The above code is more readable and maintainable! emptyValue is quite clear 
that template parameter has not been passed! So, I think this is more 
semantic than the what I proposed through list!

>
> Some points
>
>    - Use emptyValue to set the value of a variable for which no parameter 
>    was supplied
>    - See how I use the same name as the parameter when making the variable
>    - Use with variable=null because you do not need it and the containing 
>    tiddler remains the currentTiddler
>
> I am still at a lost to know how to do the equivalent of the following 
> with the transclude widget
>
> {{tiddlername}}
> Vs
> {{||tiddlername}}
>
> Other ideas
>
>    - I almost always write my macros to operate on <<currentTiddler>> so 
>    they are more reusable.
>    - I like an idea I think you suggested to pass as a parameter a macro 
>    name you then execute
>
> I also like to develop macros that you pass a filter to, code snipit;
>
> \define display(filter)
> <$set name=filter value="$filter$" emptyValue="a default filter">
> <$set name=input value={{{ $filter$ }}} emptyValue="a default">
>
> <$list filter=<<filter>> ....
>
> </$list>
>
> <$transclude tiddler=<<templateTiddler>> mode=block/>
>
> </$set></$set>
> \end
> <<display"afilter">>
>
> Once again this makes such macros much more reusable.
>
>
> Regards
> Tony
>
>
> On Sunday, August 4, 2019 at 10:05:37 PM UTC+10, Mohammad wrote:
>>
>> Thanks Tony! That's quite true!
>>
>> Also,
>>
>>  This if-then-else gives a huge flexibility! One example
>>
>> <$list 
>> filter="[<__template__>match[default]then[$:/plugins/kookma/timelines/templates/gilan]else[$template$]]"
>>  variable=templateTiddler>
>> <$tiddler tiddler=<<currentTiddler>> >
>> <$transclude tiddler=<<templateTiddler>> mode=block/>
>> </$tiddler>
>> </$list>
>>
>>
>> The above code uses a default template when user has not sent any 
>> template and uses the user supplied one if he/she has sent a template!
>>
>> This is part of my under development plugin named: *timelines*
>>
>> I really appreciate this fruitful thread and discussion!
>>
>> Cheers
>> Mohammad
>>
>>
>> On Sunday, August 4, 2019 at 4:27:09 PM UTC+4:30, TonyM wrote:
>>>
>>> Mohammad
>>>
>>> So with that clarification, I would suggest the methods in the case 
>>> example I gave addresses many.
>>>
>>> Most branching is about selective display and nesting.
>>>
>>> Are you looking for something else?
>>>
>>> Regards tony
>>>
>>>

-- 
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/e48e2839-29a5-4a4f-8bd6-044f43f13a70%40googlegroups.com.

Reply via email to