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

Ambrose Li acli at users.sourceforge.net
Fri Feb 13 02:14:20 CET 2004


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

Modified Files:
	text-extract2.pl 
Log Message:
Don't issue warnings for unquoted attributes containing [^-\.a-zA-Z0-9]
unless --pedantic-warnings is given. These don't seem to cause any trouble,
even in Mozilla's standards compliant mode.


Index: text-extract2.pl
===================================================================
RCS file: /cvsroot/koha/koha/misc/translator/text-extract2.pl,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** text-extract2.pl	13 Feb 2004 01:03:18 -0000	1.12
--- text-extract2.pl	13 Feb 2004 01:14:18 -0000	1.13
***************
*** 24,27 ****
--- 24,28 ----
  use vars qw( $input );
  use vars qw( $debug_dump_only_p );
+ use vars qw( $pedantic_p );
  
  ###############################################################################
***************
*** 43,47 ****
     # See the file "subst.pl.test1" for how the following mess is derived
     # Unfortunately, inserting $re_directive's has made this even messier
-    # FIXME: The following is somehow wrong. Paul's 1st report shouldn't happen.
     q{(<\/?(?:|(?:"(?:} . $re_directive . q{|[^"])*"|'(?:} . $re_directive . q{|[^'])*'|--(?:[^-]|-[^-])*--|(?:} . $re_directive . q{|[^-"'} . $etag . q{]|-[^-]))+))([} . $etag . q{])(.*)};
  }
--- 44,47 ----
***************
*** 82,86 ****
  	warn "Warning: Attribute should be quoted"
  		. (defined $lc? " in line $lc": '') . ": $val_orig\n"
! 		if $val =~ /[^-\.A-Za-z0-9]/s && $val_orig !~ /^['"]/;
      }
      if ($s =~ /\S/s) { # should never happen
--- 82,87 ----
  	warn "Warning: Attribute should be quoted"
  		. (defined $lc? " in line $lc": '') . ": $val_orig\n"
! 		if $pedantic_p
! 		&& $val =~ /[^-\.A-Za-z0-9]/s && $val_orig !~ /^['"]/;
      }
      if ($s =~ /\S/s) { # should never happen
***************
*** 249,255 ****
  ###############################################################################
  
  GetOptions(
!     'f|file=s' => \$input,
!     'debug-dump-only-p' => \$debug_dump_only_p,
  ) || exit(-1);
  
--- 250,274 ----
  ###############################################################################
  
+ sub usage ($) {
+     my($exitcode) = @_;
+     my $h = $exitcode? *STDERR: *STDOUT;
+     print $h <<EOF;
+ Usage: $0 [OPTIONS]
+ Extract strings from HTML file.
+ 
+       --debug-dump-only     Do not extract strings; but display scanned tokens
+   -f, --file=FILE           Extract from the specified FILE
+       --pedantic-warnings   Issue warnings even for detected problems which
+ 			    are likely to be harmless
+       --help                Display this help and exit
+ EOF
+     exit($exitcode);
+ }
+ 
  GetOptions(
!     'f|file=s'		=> \$input,
!     'debug-dump-only'	=> \$debug_dump_only_p,
!     'pedantic-warnings'	=> sub { $pedantic_p = 1 },
!     'help'		=> sub { usage(0) },
  ) || exit(-1);
  





More information about the Koha-cvs mailing list