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

cvs@template-toolkit.org cvs@template-toolkit.org
Tue, 16 Dec 2003 13:34:39 +0000


cvs         03/12/16 13:34:39

  Modified:    lib/Template/TT3/Tag Directive.pm
  Log:
  * added parse() method and call to it from scan()
  
  Revision  Changes    Path
  1.5       +12 -8     TT3/lib/Template/TT3/Tag/Directive.pm
  
  Index: Directive.pm
  ===================================================================
  RCS file: /template-toolkit/TT3/lib/Template/TT3/Tag/Directive.pm,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Directive.pm	2003/12/16 12:42:23	1.4
  +++ Directive.pm	2003/12/16 13:34:38	1.5
  @@ -17,7 +17,7 @@
   #   modify it under the same terms as Perl itself.
   #
   # REVISION
  -#   $Id: Directive.pm,v 1.4 2003/12/16 12:42:23 abw Exp $
  +#   $Id: Directive.pm,v 1.5 2003/12/16 13:34:38 abw Exp $
   #
   #========================================================================
   
  @@ -30,7 +30,7 @@
   use vars qw( $VERSION $DEBUG $ERROR $WARNING $TAG );
   use base qw( Template::TT3::Tag );
   
  -$VERSION = sprintf("%d.%02d", q$Revision: 1.4 $ =~ /(\d+)\.(\d+)/);
  +$VERSION = sprintf("%d.%02d", q$Revision: 1.5 $ =~ /(\d+)\.(\d+)/);
   $DEBUG   = 0 unless defined $DEBUG;
   $ERROR   = '';
   $TAG     = {
  @@ -72,13 +72,10 @@
       $$textref =~ s/ \s* ([-=+])? $ //sx;
       $flag = $1 || '';
   
  -    # - - - - - - - - - - - - - - - - - - - - - - - - - -   
  -    # here's where we do something interesting...
  +    # parse ye olde content
       unless ($comment) {
  -        $document = $document->tag($textref)
  -            || $self->error($document->error());
  +        $document = $self->parse($textref, $document) || return;
       }
  -    # - - - - - - - - - - - - - - - - - - - - - - - - - -   
   
       # examine closing flag and post_chomp options
       if ($flag eq '+') {
  @@ -97,6 +94,13 @@
   }
   
   
  +sub parse {
  +    my ($self, $content, $document) = @_;
  +    return $document->tag($content)
  +        || $self->error($document->error());
  +}
  +
  +
   1;
   __END__
   
  @@ -126,7 +130,7 @@
   
   =head1 VERSION
   
  -$Revision: 1.4 $
  +$Revision: 1.5 $
   
   =head1 COPYRIGHT