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

Ambrose Li acli at users.sourceforge.net
Sat Feb 14 09:03:06 CET 2004


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

Modified Files:
	text-extract2.pl 
Log Message:
Have to make it know what "closed start tag" notation is; other it spews
out more than a screenful or text for an "unknown token" when such notation
is seen


Index: text-extract2.pl
===================================================================
RCS file: /cvsroot/koha/koha/misc/translator/text-extract2.pl,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -r1.25 -r1.26
*** text-extract2.pl	14 Feb 2004 07:49:37 -0000	1.25
--- text-extract2.pl	14 Feb 2004 08:03:02 -0000	1.26
***************
*** 8,15 ****
  # This script is meant to be a drop-in replacement of text-extract.pl
  
- # FIXME: Strings like "<< Prev" or "Next >>" may confuse *this* filter
- # TODO: Need to detect unclosed tags, empty tags, and other such stuff.
- # (Why? Because Mozilla apparently knows what SGML unclosed tags are :-/ )
- 
  # A grander plan: Code could be written to detect template variables and
  # construct gettext-c-format-string-like meta-strings (e.g., "Results %s
--- 8,11 ----
***************
*** 57,61 ****
     q{(<\/?(?:|(?:"(?:} . $re_directive . q{|[^"])*"|'(?:} . $re_directive . q{|[^'])*'|--(?:[^-]|-[^-])*--|(?:}
     . $re_directive
!    . q{|(?!--)[^"'<>} . $etag . q{]))+))([} . $etag . q{])(.*)};
  }
  BEGIN {
--- 53,57 ----
     q{(<\/?(?:|(?:"(?:} . $re_directive . q{|[^"])*"|'(?:} . $re_directive . q{|[^'])*'|--(?:[^-]|-[^-])*--|(?:}
     . $re_directive
!    . q{|(?!--)[^"'<>} . $etag . q{]))+))([} . $etag . q{]|(?=<))(.*)};
  }
  BEGIN {
***************
*** 169,174 ****
  		}
  	    } elsif ($readahead =~ /^$re_tag_compat/os) {
! 		($kind, $it, $readahead) = (KIND_TAG, "$1$2", $3);
  		$ok_p = 1;
  	    } elsif ($readahead =~ /^<!--(?:(?!-->).)*-->/s) {
  		($kind, $it, $readahead) = (KIND_COMMENT, $&, $');
--- 165,171 ----
  		}
  	    } elsif ($readahead =~ /^$re_tag_compat/os) {
! 		($kind, $it, $readahead) = (KIND_TAG, "$1>", $3);
  		$ok_p = 1;
+ 		warn "Warning: SGML \"closed start tag\" notation near line $lc_0: $1$2\n" if $2 eq '';
  	    } elsif ($readahead =~ /^<!--(?:(?!-->).)*-->/s) {
  		($kind, $it, $readahead) = (KIND_COMMENT, $&, $');





More information about the Koha-cvs mailing list