Access current tiddler's field from a macro inserted by template

Here’s what I have:

The macro poster defined in its own tiddler:

\define poster(address)
	<img src=" $address$ "/>
\end

The template templateBook, applied to anything tagged with book. It contains the following two entries. The poster macro does not work, the direct <img> works:

<$list filter="[all[current]tag[book]]">
	
	<<poster {{!!src-poster}} >>

	<img src={{!!src-poster}}>

</$list>

The tiddler Winnie the Pooh, tagged with book, with a URL in the field src-poster pointing to the book’s cover.

Using the poster macro directly in the book tiddler does not work when passing it the src-poster field (which I guess is the heart of the issue).

The issue is with the calling method you used. For <<poster {{!!src-poster}} >> use $macrocall or better use $transclude. There is no need to have separate macro but for any reason you need to have it the do as below:

\procedure poster(address) <$image source=<<address>> />

And the template tiddler should looks like this:

<$list filter="[all[current]tag[book]]">
<$transclude $variable="poster" address={{!!src-poster}} $mode=block/>
</$list>

Macros or procedures defined on one tiddler you want available in another needs a global tag or imported to where it is needed.