[Templates-cvs] cvs commit: Template2/lib/Template Parser.pm
cvs@template-toolkit.org
cvs@template-toolkit.org
cvs 06/01/30 15:31:04
Modified: lib/Template Parser.pm
Log:
* applied Barrie Slaymaker's patch to fix broken line counting with pre_chomp
Revision Changes Path
2.83 +7 -11 Template2/lib/Template/Parser.pm
Index: Parser.pm
===================================================================
RCS file: /template-toolkit/Template2/lib/Template/Parser.pm,v
retrieving revision 2.82
retrieving revision 2.83
diff -u -r2.82 -r2.83
--- Parser.pm 2004/01/30 19:32:27 2.82
+++ Parser.pm 2006/01/30 15:31:04 2.83
@@ -31,7 +31,7 @@
#
#----------------------------------------------------------------------------
#
-# $Id: Parser.pm,v 2.82 2004/01/30 19:32:27 abw Exp $
+# $Id: Parser.pm,v 2.83 2006/01/30 15:31:04 abw Exp $
#
#============================================================================
@@ -54,7 +54,7 @@
use constant ERROR => 2;
use constant ABORT => 3;
-$VERSION = sprintf("%d.%02d", q$Revision: 2.82 $ =~ /(\d+)\.(\d+)/);
+$VERSION = sprintf("%d.%02d", q$Revision: 2.83 $ =~ /(\d+)\.(\d+)/);
$DEBUG = 0 unless defined $DEBUG;
$ERROR = '';
@@ -319,14 +319,10 @@
}
else {
$chomp = ($1 && $1 eq '+') ? 0 : ($1 || $prechomp);
-# my $space = $prechomp == &Template::Constants::CHOMP_COLLAPSE
- my $space = $prechomp == CHOMP_COLLAPSE
- ? ' ' : '';
+ my $space = $prechomp == CHOMP_COLLAPSE ? ' ' : '';
# chomp off whitespace and newline preceding directive
- $chomp and $pre =~ s/(\n|^)([ \t]*)\Z/($1||$2) ? $space : ''/me
- and $1 eq "\n"
- and $prelines++;
+ $chomp and $pre =~ s/(\n|^)([ \t]*)\Z/($1||$2) ? $space : ''/me;
}
# remove trailing whitespace and check for a '-' chomp flag
@@ -350,8 +346,8 @@
push(@tokens, $interp
? [ $pre, $line, 'ITEXT' ]
: ('TEXT', $pre) );
- $line += $prelines;
}
+ $line += $prelines;
# and now the directive, along with line number information
if (length $dir) {
@@ -1413,8 +1409,8 @@
=head1 VERSION
-2.81, distributed as part of the
-Template Toolkit version 2.13, released on 30 January 2004.
+2.82, distributed as part of the
+Template Toolkit version 2.15, released on 27 January 2006.