Continuing from my earlier journey, I’m now in need of transforming my procedure into a global one and calling it with passed parameters.
My current approach is the following global procedure which is called from person tiddlers where their title is the person’s name:
\procedure g-create-link-person-gift()
<$action-createtiddler
$basetitle="GiftLink"
link-gift={{!!temp-gift}}
link-person={{!!title}}
tags=`link [[$(theTags)$]]`>
</$action-createtiddler>
<$action-deletefield
$field="temp-gift"/>
\end g-create-link-person-gift
which is called from a button inside a person as follows:
<$set name="theTags" value="todo">
<$button
disabled=<<giftSelectionEmpty>>
actions=<<g-create-link-person-gift>> >
To Gift
</$button>
</$set>
It relies on “local” {{!!field}} references from person, and theTags which is also “locally” defined and is substituted to fill in the tags parameter.
I’d like to transition to something more reusable, with clearly defined parameters like (caution: the below are not correct):
\procedure g-create-link-person-gift(theLink, thePerson, theTags)
<$action-createtiddler
$basetitle="GiftLink"
link-gift=<<theLink>>
link-person=<<thePerson>>
tags="link <<theTags>>" >
</$action-createtiddler>
<$action-deletefield
$field="temp-gift"/>
\end g-create-link-person-gift
and called with something like:
<$button
disabled=<<giftSelectionEmpty>>
actions=<<g-create-link-person-gift( {{!!title}}, {{!!temp-gift}}, "todo" )>> >
To Gift
</$button>
I’m stumped on the required syntax to pass & call the 3 parameters. I’ve seen suggestions about using $transclude instead of <<macro>> for increased flexibility but I don’t understand how to apply that to $button's parameters.