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 <<add-time days:10>> 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<addtime>]"></$list></$vars> would work if it was a regular
> macro instead of a javascript macro. But, even though the parameter that
> <addtime> 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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/82fd0bc8-0322-4ef8-ba51-0b33342e8626n%40googlegroups.com.