Re: [tw5] Re: Parameters into macros

2021-08-14 Thread Saq Imtiaz
Feel free to post here with your filter code (and of the macro) if you get 
stuck.

On Saturday, August 14, 2021 at 7:24:06 PM UTC+2 Stobot wrote:

> Thanks Saq, actually that sounds like an interesting challenge. From a 
> Javascript standpoint all I've done is tweak the macros of others so it may 
> be a bit over my head, but I'll give it a try. 
>
> On Sat, Aug 14, 2021 at 1:04 PM Saq Imtiaz  wrote:
>
>> The first thing that comes to mind is rewriting the macro as a filter 
>> operator.
>>
>>
>>
>> On Saturday, August 14, 2021 at 6:54:22 PM UTC+2 Stobot wrote:
>>
>>> Is there a way to pass dynamic parameters into macros (javascript) other 
>>> than using <$macrocall/>? 
>>>
>>> For instance I use a modified version of (Jed's I think) add-time.js 
>>> that allows you to use a parameter 'days' to feed days to add to current 
>>> date. So, doing something like <> would return the date 
>>> 10 days from now. If it's a static number like 10, things are easy, but if 
>>> it's dynamic (stored in a field) then things get more complicated - I have 
>>> to use the <$macrocall/> instead, which is less convenient but sometimes 
>>> not a problem. 
>>>
>>> It becomes a problem when I need to use this new date in a filter. I 
>>> *am* excited that in pre-release now we can feed *static* values as 
>>> parameters into macros within filters, but the missing piece is still 
>>> dynamic values as parameters - can't do a <$macrocall/> within a filter. 
>>>
>>> If it's a normal macro, right now I'd surround the <$list/> with some 
>>> <$wikify> runs that run the <$macrocall/>'s and wikify it to be fed in as a 
>>> static value. I'm just wondering if there's a better way that I'm not 
>>> thinking about (I end up with LOTS of wikify's which people tell me is not 
>>> great). 
>>>
>>> For instance, doing something like:
>>>  <$vars days={{!!daystoadd}}><$list 
>>> filter="[duedate]"> would work if it was a regular 
>>> macro instead of a javascript macro. But, even though the parameter that 
>>>  can be fed is called days, it's not picked up by the macro call. 
>>>
>>> Hopefully that makes sense - thanks
>>>
>> -- 
>> 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+...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/tiddlywiki/82fd0bc8-0322-4ef8-ba51-0b33342e8626n%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
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/2c8e661b-2c62-4f1e-b613-a536cb7ce005n%40googlegroups.com.


Re: [tw5] Re: Parameters into macros

2021-08-14 Thread Adam Stobbe
Thanks Saq, actually that sounds like an interesting challenge. From a
Javascript standpoint all I've done is tweak the macros of others so it may
be a bit over my head, but I'll give it a try.

On Sat, Aug 14, 2021 at 1:04 PM Saq Imtiaz  wrote:

> The first thing that comes to mind is rewriting the macro as a filter
> operator.
>
>
>
> On Saturday, August 14, 2021 at 6:54:22 PM UTC+2 Stobot wrote:
>
>> Is there a way to pass dynamic parameters into macros (javascript) other
>> than using <$macrocall/>?
>>
>> For instance I use a modified version of (Jed's I think) add-time.js that
>> allows you to use a parameter 'days' to feed days to add to current date.
>> So, doing something like <> would return the date 10 days
>> from now. If it's a static number like 10, things are easy, but if it's
>> dynamic (stored in a field) then things get more complicated - I have to
>> use the <$macrocall/> instead, which is less convenient but sometimes not a
>> problem.
>>
>> It becomes a problem when I need to use this new date in a filter. I *am*
>> excited that in pre-release now we can feed *static* values as parameters
>> into macros within filters, but the missing piece is still dynamic values
>> as parameters - can't do a <$macrocall/> within a filter.
>>
>> If it's a normal macro, right now I'd surround the <$list/> with some
>> <$wikify> runs that run the <$macrocall/>'s and wikify it to be fed in as a
>> static value. I'm just wondering if there's a better way that I'm not
>> thinking about (I end up with LOTS of wikify's which people tell me is not
>> great).
>>
>> For instance, doing something like:
>>  <$vars days={{!!daystoadd}}><$list
>> filter="[duedate]"> would work if it was a regular
>> macro instead of a javascript macro. But, even though the parameter that
>>  can be fed is called days, it's not picked up by the macro call.
>>
>> Hopefully that makes sense - thanks
>>
> --
> 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/82fd0bc8-0322-4ef8-ba51-0b33342e8626n%40googlegroups.com
> 
> .
>

-- 
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/CA%2B%2B2uhHZddcXZBNebeRg4D1wid%2BNnQuO7X6NLg9Mka6f%3Dq%2BQHw%40mail.gmail.com.