[Koha-cvs] CVS: koha/misc/translator text-extract2.pl,1.26,1.27
Ambrose Li
acli at users.sourceforge.net
Sat Feb 14 09:49:23 CET 2004
Update of /cvsroot/koha/koha/misc/translator
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31574
Modified Files:
text-extract2.pl
Log Message:
Don't complain about strange attribute syntax if what we see is a
reasonable templating control flow directive (if, else, unless).
Index: text-extract2.pl
===================================================================
RCS file: /cvsroot/koha/koha/misc/translator/text-extract2.pl,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -r1.26 -r1.27
*** text-extract2.pl 14 Feb 2004 08:03:02 -0000 1.26
--- text-extract2.pl 14 Feb 2004 08:49:21 -0000 1.27
***************
*** 29,33 ****
# Hideous stuff
use vars qw( $re_directive $re_tmpl_var $re_tmpl_var_escaped $re_tmpl_include );
! use vars qw( $re_tmpl_endif_endloop );
BEGIN {
# $re_directive must not do any backreferences
--- 29,33 ----
# Hideous stuff
use vars qw( $re_directive $re_tmpl_var $re_tmpl_var_escaped $re_tmpl_include );
! use vars qw( $re_directive_control $re_tmpl_endif_endloop );
BEGIN {
# $re_directive must not do any backreferences
***************
*** 38,41 ****
--- 38,43 ----
# TMPL_VAR ESCAPE=1/HTML/URL
$re_tmpl_var_escaped = q{<(?:(?i)(?:!--\s*)?TMPL_(?:VAR|INCLUDE)(?:\s+(?:[a-zA-Z][-a-zA-Z0-9]*=)?(?:'[^']*'|"[^"]*"|[^\s<>]+))\s+ESCAPE=(?:1|HTML|URL)(?:\s+(?:[a-zA-Z][-a-zA-Z0-9]*=)?(?:'[^']*'|"[^"]*"|[^\s<>]+))*\s*(?:--)?)>};
+ # Any control flow directive
+ $re_directive_control = q{<(?:(?i)(?:!--\s*)?\/?TMPL_(?:LOOP|IF|ELSE|UNLESS)(?:\s+(?:[a-zA-Z][-a-zA-Z0-9]*=)?(?:'[^']*'|"[^"]*"|[^\s<>]+))*\s*(?:--)?)>};
# /LOOP or /IF or /UNLESS
$re_tmpl_endif_endloop = q{<(?:(?i)(?:!--\s*)?\/TMPL_(?:LOOP|IF|UNLESS)(?:\s+(?:[a-zA-Z][-a-zA-Z0-9]*=)?(?:'[^']*'|"[^"]*"|[^\s<>]+))*\s*(?:--)?)>};
***************
*** 96,100 ****
|| $s =~ /^<\S+(.*)\S$/s; # SGML-style tags
! for (my $i = 0; $s =~ /^\s+(?:([a-zA-Z][-a-zA-Z0-9]*)\s*=\s*)?('((?:$re_directive|[^'])*)'|"((?:$re_directive|[^"])*)"|((?:$re_directive|[^\s<>])+))/os;) {
my($key, $val, $val_orig, $rest)
= ($1, (defined $3? $3: defined $4? $4: $5), $2, $');
--- 98,102 ----
|| $s =~ /^<\S+(.*)\S$/s; # SGML-style tags
! for (my $i = 0; $s =~ /^(?:$re_directive_control)?\s+(?:$re_directive_control)?(?:([a-zA-Z][-a-zA-Z0-9]*)\s*=\s*)?('((?:$re_directive|[^'])*)'|"((?:$re_directive|[^"])*)"|((?:$re_directive|[^\s<>])+))/os;) {
my($key, $val, $val_orig, $rest)
= ($1, (defined $3? $3: defined $4? $4: $5), $2, $');
More information about the Koha-cvs
mailing list