28.3.1.3 Invoking a macro variable
You invoke a macro variable like this:
where display-format is a C-language style printf() format. See §28.6.3 Displaying expression results in output.
You do not need the enclosing angle brackets when you use a macro variable inside a macro; for example, in an assignment such as <$$myvar = ($$othervar + 2)>.
Suppose you want to use a macro that includes the following:
• an image, but with a different src attribute each time
• a heading, but with different text each time.
Rather than have two almost identical macros, you can use a macro variable for the src attribute and another for the heading, then set their values appropriately for each use.
You could define the macro like this:
<img src="<$$Pic>" alt="Today’s top story" /><h2><$$Head></h2>
<$$Pic=lead000201.jpg><$$Head=No Survivors in Crash><$TopStory>
<$$Pic=lead000202.jpg><$$Head=MS Embraces Linux><$TopStory>
> 28 Working with macros > 28.3 Using macro variables > 28.3.1 Creating and invoking macro variables > 28.3.1.3 Invoking a macro variable