From 160bb77967b2d8056281bad4bf39b3e0dfbc8ec5 Mon Sep 17 00:00:00 2001 From: Christopher Hall Date: Tue, 25 Jan 2011 15:58:57 +1300 Subject: [PATCH] fix for reverse scoping bug --- installer/html-template-to-template-toolkit.pl | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/installer/html-template-to-template-toolkit.pl b/installer/html-template-to-template-toolkit.pl index 89583be92a..8ae13f677b 100755 --- a/installer/html-template-to-template-toolkit.pl +++ b/installer/html-template-to-template-toolkit.pl @@ -27,6 +27,9 @@ EOH my $tmpl_in_dir = 'koha-tmpl'; my $tmpl_out_dir = 'koha-tt'; +# variables NOT to scope, in other words, variables that need to remain global (case sensitive) +my @globals = ("themelang"); + # Arguments: my $KOHA_ROOT; my $tmpl_extn_match = "tmpl|inc|xsl"; # Type match defaults to *.tmpl plus *.inc if not specified @@ -128,7 +131,13 @@ foreach my $file (@template_files) { $input_tmpl =~ s/<[!-]*\s*TMPL_INCLUDE\s+NAME\s?=\s?"(.*?\.inc)"\s*-*>/[% INCLUDE '$1' %]/ig; $input_tmpl =~ s/<[!-]*\s*TMPL_INCLUDE\s+NAME\s?=\s?"(.*?)"\s*-*>/[% INCLUDE $1 %]/ig; - if ($input_tmpl =~ m/<[!-]*\s*TMPL_LOOP/i ){ + #reverse scoping bug fix + for my $tag (@globals){ + next unless $cur_scope[-1]; + $input_tmpl =~ s/$cur_scope[-1]$tag/$tag/g; + } + + if ($input_tmpl =~ m/<[!-]*\s*TMPL_LOOP/i ){ $for_loop_found = 1; } -- 2.39.5