koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] CVS: koha/misc/translator text-extract2.pl,1.3,1.4


From: Ambrose Li
Subject: [Koha-cvs] CVS: koha/misc/translator text-extract2.pl,1.3,1.4
Date: Thu, 12 Feb 2004 01:38:22 -0800

Update of /cvsroot/koha/koha/misc/translator
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11774

Modified Files:
        text-extract2.pl 
Log Message:
Handle attributes which are TMPL_VAR's better. It was choking on
systempreferences.tmpl.


Index: text-extract2.pl
===================================================================
RCS file: /cvsroot/koha/koha/misc/translator/text-extract2.pl,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** text-extract2.pl    12 Feb 2004 09:26:54 -0000      1.3
--- text-extract2.pl    12 Feb 2004 09:38:20 -0000      1.4
***************
*** 8,11 ****
--- 8,13 ----
  # This script is meant to be a drop-in replacement of text-extract.pl
  
+ # FIXME: Strings like "<< Prev" confuses *this* filter
+ 
  use Getopt::Long;
  use strict;
***************
*** 16,20 ****
  
###############################################################################
  
! # Hideous stuff from subst.pl
  # Note: The $re_tag's set $1 (<tag), $2 (>), and $3 (rest of string)
  use vars qw( $re_comment $re_entity_name $re_end_entity $re_etag );
--- 18,29 ----
  
###############################################################################
  
! # Hideous stuff
! use vars qw( $re_directive );
! BEGIN {
!     # $re_directive must not do any backreferences
!     $re_directive = 
q{<(?:(?i)(?:!--\s*)?\/?TMPL_(?:VAR|LOOP|INCLUDE|IF|ELSE|UNLESS)\b(?:\s+(?:[a-zA-Z][-a-zA-Z0-9]*=)?(?:'[^']*'|"[^"]*"|[^\s<>]+))\s*(?:--)?)>};
! }
! 
! # Hideous stuff from subst.pl, slightly modified to use the above hideous 
stuff
  # Note: The $re_tag's set $1 (<tag), $2 (>), and $3 (rest of string)
  use vars qw( $re_comment $re_entity_name $re_end_entity $re_etag );
***************
*** 24,28 ****
     my $etag = $compat? '>': '<>\/';
     # See the file "subst.pl.test1" for how the following mess is derived
!    q{(<\/?(?:|(?:"[^"]*"|'[^']*'|--(?:[^-]|-[^-])*--|(?:[^-"'} . $etag . 
q{]|-[^-]))+))([} . $etag . q{])(.*)};
  }
  BEGIN {
--- 33,38 ----
     my $etag = $compat? '>': '<>\/';
     # See the file "subst.pl.test1" for how the following mess is derived
!    # Unfortunately, inserting $re_directive's has made this even messier
!    q{(<\/?(?:|(?:"(?:} . $re_directive . q{|[^"])*"|'(?:} . $re_directive . 
q{|[^'])*'|--(?:[^-]|-[^-])*--|(?:} . $re_directive . q{|[^-"'} . $etag . 
q{]|-[^-]))+))([} . $etag . q{])(.*)};
  }
  BEGIN {
***************
*** 36,45 ****
  # End of the hideous stuff
  
- use vars qw( $re_directive );
- BEGIN {
-     # $re_directive must not do any backreferences
-     $re_directive = 
q{<(?:!--\s*)?\/?TMPL_(?:VAR|LOOP|INCLUDE|IF|ELSE|UNLESS)\b(?:\s+(?:[a-zA-Z][-a-zA-Z0-9]*=)?(?:'[^']*'|"[^"]*"|[^\s<>]+))\s*(?:--)?>};
- }
- 
  sub KIND_TEXT      () { 'TEXT' }
  sub KIND_CDATA     () { 'CDATA' }
--- 46,49 ----
***************
*** 201,205 ****
        if ($kind eq KIND_TEXT) {
            $t =~ s/\s+$//s;
!           $text{$t} = 1 if $t =~ /\S/s; # FIXME... trailing whitespace
        } elsif ($kind eq KIND_TAG && %$attr) {
            # value [tag=input], meta
--- 205,209 ----
        if ($kind eq KIND_TEXT) {
            $t =~ s/\s+$//s;
!           $text{$t} = 1 if $t =~ /\S/s;
        } elsif ($kind eq KIND_TAG && %$attr) {
            # value [tag=input], meta
***************
*** 209,213 ****
                    next if $a eq 'content' && $tag ne 'meta';
                    next if $a eq 'value' && ($tag ne 'input'
!                       || (ref $attr->{'type'} && $attr->{'type'}->[1] eq 
'hidden'));
                    my($key, $val, $val_orig, $order) = @{$attr->{$a}}; #FIXME
                    $val =~ s/\s+$//s;
--- 213,217 ----
                    next if $a eq 'content' && $tag ne 'meta';
                    next if $a eq 'value' && ($tag ne 'input'
!                       || (ref $attr->{'type'} && $attr->{'type'}->[1] eq 
'hidden')); # FIXME
                    my($key, $val, $val_orig, $order) = @{$attr->{$a}}; #FIXME
                    $val =~ s/\s+$//s;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]