5.2.0 New Features: Macro Parameters in Filter

Tiddlywiki 5.2.0 supports macro parameters inside Filter

Ref:

Example

The below script shows the use of qualify macro with one input parameter

\define myMacro(stateTid:"")
<$vars stateTid={{{ [<__stateTid__>!is[blank]then<qualify "$:/temp/slider/$(currentTiddler)$/$stateTid$">else<qualify "$:/temp/slider/$(currentTiddler)$">]}}} >

This is <$text text=<<stateTid>> />

</$vars>
\end
\define myMacro(stateTid:"")
<$vars stateTid={{{ [<__stateTid__>!is[blank]then<qualify "$:/temp/slider/$(currentTiddler)$/$stateTid$">else<qualify "$:/temp/slider/$(currentTiddler)$">]}}} >

This is <$text text=<<stateTid>> />

</$vars>
\end

The below examples produces:

<<myMacro>>

<<myMacro sample>>

This is $:/temp/slider/Draft of 'New Tiddler 4'--2130246815

This is $:/temp/slider/Draft of 'New Tiddler 4'/sample--2130246815

Important Note This is a wiki post! So any user here can edit it!
I highly recommend all users share their examples/usecases here and improve the docs!

The last solution proposed in this answer is another example of using macro parameters inside a filter:

2 Likes

I also gained a new respect for this feature over here Simpler Accordion Macro - #16 by TW_Tones because although it only simplifies thing a little it can have a substantial advantage feeding content from various sources into a macro without needing to build the “infrastructure” in the macro to handle the sources.

I am now a big fan of this change.

1 Like