[Omaha.pm] Template Toolkit MACRO

Jay Hannah jay at jays.net
Thu Dec 15 16:51:15 PST 2005


Dave Cross wrote:
> Jay Hannah wrote:
> 
>> Hey Dave --
>>
>> I'm hoping you can help me with an apparent MACRO problem in the Perl 
>> Mongers bin/build script.
>>
>> When I run the script, it runs for all source files creating all the 
>> destination files, but then this source:
>>
>> Select a continent:
>> [% link_to("/groups/africa.html", "Africa") %],
>> [% link_to("/groups/asia.html", "Asia") %],
>> [% link_to("/groups/central_america.html", "Central America") %],
>> [% link_to("/groups/europe.html", "Europe") %],
>> [% link_to("/groups/non_geographical.html", "Non-geographical") %],
>> [% link_to("/groups/north_america.html", "North America") %],
>> [% link_to("/groups/oceania.html", "Oceania") %],
>> [% link_to("/groups/south_america.html", "South America") %].
>>
>> Turns into this output:
>>
>> Select a continent:
>> , , , , , , , .
> 
> 
> Jay,
> 
> The problem wasn't the MACRO, it was the WRAPPER. Previously bin/build 
> used PRE_PROCESS and POST_PROCESS instead of WRAPPER but I changed it 
> recently as I thought it was tidier. Unfortunately it was the side 
> effect that the MACROs defined in the WRAPPER template weren't defined 
> at the point at which they were used.
> 
> I've fixed this by creating a new template (lib/macro) which contains 
> all of the macros (or, at least, all the ones I could find) which is 
> PRE_PROCESSed before each template. Thereby ensuring that the MACROs are 
> correctly defined.
> 
> If you update your svn repository, then it should all start to work.
> 
> Sorry for causing problems.

No worries. Thanks for the help! Once I study the changes hopefully I'll be able to figure that out all by my lonesome next time.

j
hoping my line wrap is fixed like I think it is -grin-


More information about the Omaha-pm mailing list