[Templates-cvs] cvs commit: TT3/lib/Template/Directive Macro.pm

cvs@template-toolkit.org cvs@template-toolkit.org
Fri, 03 Dec 2004 14:01:10 +0000


cvs         04/12/03 14:01:09

  Modified:    lib/Template/Directive Macro.pm
  Log:
  * fixed up name handling
  
  Revision  Changes    Path
  1.4       +13 -4     TT3/lib/Template/Directive/Macro.pm
  
  Index: Macro.pm
  ===================================================================
  RCS file: /template-toolkit/TT3/lib/Template/Directive/Macro.pm,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Macro.pm	2004/12/01 19:24:11	1.3
  +++ Macro.pm	2004/12/03 14:01:09	1.4
  @@ -15,7 +15,7 @@
   #   modify it under the same terms as Perl itself.
   #
   # REVISION
  -#   $Id: Macro.pm,v 1.3 2004/12/01 19:24:11 abw Exp $
  +#   $Id: Macro.pm,v 1.4 2004/12/03 14:01:09 abw Exp $
   #
   #========================================================================
   
  @@ -26,7 +26,7 @@
   use Template::Directive;
   use base qw( Template::Directive );
   
  -our $VERSION = sprintf("%d.%02d", q$Revision: 1.3 $ =~ /(\d+)\.(\d+)/);
  +our $VERSION = sprintf("%d.%02d", q$Revision: 1.4 $ =~ /(\d+)\.(\d+)/);
   our $DEBUG   = 0 unless defined $DEBUG;
   our $ERROR   = '';
   our $KEYWORD = 'MACRO';
  @@ -70,7 +70,16 @@
           return $handler;
       }
       elsif ($type eq 'blockdef') {
  -        my $name = $expr->[1]->[1];
  +        my $name = $expr->[1];
  +        if ($name->[0] =~ /^path|squote$/) {
  +            $name = $name->[1];
  +        }
  +        elsif ($name->[0] eq 'dquote') {
  +            $name = join('', @{$name->[1]});
  +        }
  +        else {
  +            $name = '???';
  +        }
           $handler->debug("MACRO got blockdef\n") if $DEBUG;
           return $handler->error('named BLOCK (', $name, ') is not permitted in ',
                                  $handler->{ keyword }, 
  @@ -117,7 +126,7 @@
   
   =head1 VERSION
   
  -$Revision: 1.3 $
  +$Revision: 1.4 $
   
   =head1 COPYRIGHT