From 287478fcb4eec6fdb91a3e94ea04cc451b6c77a4 Mon Sep 17 00:00:00 2001 From: Christopher Hall Date: Tue, 7 Dec 2010 14:15:07 +1300 Subject: [PATCH] fixed loop variable patterns to handle scope --- installer/html-template-to-template-toolkit.pl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/installer/html-template-to-template-toolkit.pl b/installer/html-template-to-template-toolkit.pl index a7e580b9cb..7cc2dbe172 100755 --- a/installer/html-template-to-template-toolkit.pl +++ b/installer/html-template-to-template-toolkit.pl @@ -155,11 +155,11 @@ foreach my $file (@template_files) { $input_tmpl =~ s/\seq\s/ == /ig; $input_tmpl =~ s/HTML/html/ig; $input_tmpl =~ s/URL/url/ig; - $input_tmpl =~ s/\(.*?__first__\s*\)/(loop.first)/ig; - $input_tmpl =~ s/\(.*?__last__\s*\)/(loop.last)/ig; - $input_tmpl =~ s/\(.*?__odd__\s*\)/(loop.odd)/ig; - $input_tmpl =~ s/\(.*?__even__\s*\)/(loop.even)/ig; - $input_tmpl =~ s/\(.*?__counter__\s*\)/(loop.count)/ig; #loop.count gives the range (0..max) whereas loop.index gives the range (1..max+1), __counter__ is unknown + $input_tmpl =~ s/\w*__first__/loop.first/ig; + $input_tmpl =~ s/\w*__last__/loop.last/ig; + $input_tmpl =~ s/\w*__odd__/loop.odd/ig; + $input_tmpl =~ s/\w*__even__/loop.even/ig; + $input_tmpl =~ s/\w*__counter__/loop.count/ig; #loop.count gives the range (0..max) whereas loop.index gives the range (1..max+1), __counter__ is unknown #hack to get around lack of javascript filter $input_tmpl =~ s/\|JS/|replace("'", "\\'") |replace('"', '\\"') |replace('\\n', '\\\\n') |replace('\\r', '\\\\r')/ig; -- 2.39.2