One great feature of Template Toolkit (IMHO) is that not only can you set the
start and end tags according to a set of predefined styles (using the TAG_STYLE
option), but the START_TAG and END_TAG options can be defined as regular
expressions.

So you could write something like...

   my $template = Template->new(
      START_TAG => '(?:<!--|%)',
      END_TAG   => '(?:-->|%)',
      RELATIVE  => 1,
   );

and have it work.  Of course the above would also match tokens like

<!-- something %

as well as 

% something else -->


which may you may be able to work with this caveat.  Otherwise you'd have to
find a way to keep the start and end tags balanced.  

HTH

Quoting jodie ([EMAIL PROTECTED]):
> Hi,
> 
> Is it possible to define multiple START_TAG's and END_TAG so that, for example,  the 
>parser would recognise either <!--  -->  OR  %  %.
> I have tried defining them with the alternation operator (eg.  START_TAG=>'<!--|%' 
>...), with no success.
> 
> The main reason for implementing this is to differentiate plain variables from 
>logic.  Eg.
> 
> <!-- FOREACH person = people -->
>       Name: %person.name%  Age: %person.age% Hobbies:
>       <!-- FOREACH hobby = person.hobbies -->
>             %hobby%
>       <!-- END -->
>       <br>
> <!-- END -->
> 
> 
> The main advantage (for us), is that a designer using a WYSIWYG HTML editor, would 
>see the following:
>     Name: %person.name% Age: %person.age% Hobbies: %hobbie%
> 
> Enabling the designer to apply formatting attributes to the main content, without 
>worrying about (or seeing) the underlying logic. Which is why it is necessary to be 
>able to acheive the <!-- --> style tags.
> 
> I am using TT 2.04.  Is there a way to acheive the desired affect without modifying 
>the source?
> 
> Thanks. 


Reply via email to