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

cvs@template-toolkit.org cvs@template-toolkit.org
Tue, 16 Dec 2003 12:41:51 +0000


cvs         03/12/16 12:41:51

  Modified:    lib/Template/TT3 Scanner.pm
  Log:
  * changed scanner to expect tag scan() and document text() methods to
    return back the $document reference.
  
  Revision  Changes    Path
  1.6       +7 -8      TT3/lib/Template/TT3/Scanner.pm
  
  Index: Scanner.pm
  ===================================================================
  RCS file: /template-toolkit/TT3/lib/Template/TT3/Scanner.pm,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Scanner.pm	2003/12/15 17:31:28	1.5
  +++ Scanner.pm	2003/12/16 12:41:51	1.6
  @@ -18,7 +18,7 @@
   #   modify it under the same terms as Perl itself.
   #
   # REVISION
  -#   $Id: Scanner.pm,v 1.5 2003/12/15 17:31:28 abw Exp $
  +#   $Id: Scanner.pm,v 1.6 2003/12/16 12:41:51 abw Exp $
   #
   #========================================================================
   
  @@ -30,7 +30,7 @@
   use vars qw( $VERSION $DEBUG $ERROR $WARNING $TAGS );
   use base qw( Template::TT3::Base );
   
  -$VERSION = sprintf("%d.%02d", q$Revision: 1.5 $ =~ /(\d+)\.(\d+)/);
  +$VERSION = sprintf("%d.%02d", q$Revision: 1.6 $ =~ /(\d+)\.(\d+)/);
   $DEBUG   = 0 unless defined $DEBUG;
   $ERROR   = '';
   $TAGS    = [ ];
  @@ -188,7 +188,7 @@
               if (defined $pretext && length $pretext) {
                   # count newlines and notify document
                   $self->{ size } = ($pretext =~ tr/\n//);
  -                $document->text(\$pretext) 
  +                $document = $document->text(\$pretext) 
                       || return $self->error($document->error());
                   $self->{ line } += delete $self->{ size };
               }
  @@ -241,12 +241,11 @@
                                   + ( $end     =~ tr/\n// );
   
                   # call tag scan() method to handle tag content
  -                $tag->scan(\$content, $document, $start, $end)
  +                $document = $tag->scan(\$content, $document, $start, $end)
                       || return $self->error($tag->error());
   
                   # update document position 
                   $self->{ line } += delete $self->{ size };
  -#                $self->{ size }  = 0;
               }
               else {
                   # an open tag that has a start but no pre-defined end token.
  @@ -261,7 +260,7 @@
                   my $start_pos = pos($$textref) || 0;
   
                   # call tag scan() method to scan forwards
  -                $tag->scan($textref, $document, $start)
  +                $document = $tag->scan($textref, $document, $start)
                       || return $self->error($tag->error());
       
                   # count any newlines consumed between start and end positions
  @@ -282,7 +281,7 @@
       if ($$textref =~ / \G (.+) /sx) {
           my $text = $1;
           $self->{ size } = ($text =~ tr/\n//);
  -        $document->text(\$text) 
  +        $document = $document->text(\$text) 
               || return $self->error($document->error());
           $self->{ line } += delete $self->{ size };
       }
  @@ -351,7 +350,7 @@
   
   =head1 VERSION
   
  -$Revision: 1.5 $
  +$Revision: 1.6 $
   
   =head1 COPYRIGHT