[Koha-cvs] CVS: koha/misc/translator TmplTokenizer.pm,1.29,1.30

Ambrose C. LI acli at users.sourceforge.net
Wed Feb 25 09:16:27 CET 2004


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

Modified Files:
	TmplTokenizer.pm 
Log Message:
This should now handle spurious "strange attribute syntax" much more sanely.


Index: TmplTokenizer.pm
===================================================================
RCS file: /cvsroot/koha/koha/misc/translator/TmplTokenizer.pm,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -r1.29 -r1.30
*** TmplTokenizer.pm	25 Feb 2004 06:56:42 -0000	1.29
--- TmplTokenizer.pm	25 Feb 2004 08:16:24 -0000	1.30
***************
*** 259,264 ****
      my($s, $lc) = @_;
      my %attr;
!     $s = $1 if $s =~ /^<\S+(.*)\/\S$/s	# XML-style self-closing tags
! 	    || $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;) {
--- 259,264 ----
      my($s, $lc) = @_;
      my %attr;
!     $s = $1 if $s =~ /^<(?:(?!$re_directive_control)\S)+(.*)\/\S$/s	# XML-style self-closing tags
! 	    || $s =~ /^<(?:(?!$re_directive_control)\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;) {
***************
*** 431,438 ****
  		$this->_set_cdata_close( "</$1\\s*>" );
  		$this->_set_pcdata_mode( 0 );
! 	    } elsif ($it->string =~ /^<(title)\b/is) {
! 		$this->_set_cdata_mode( 1 );
! 		$this->_set_cdata_close( "</$1\\s*>" );
! 		$this->_set_pcdata_mode( 1 );
  	    }
  	    $it->set_attributes( $this->_extract_attributes($it->string, $it->line_number) );
--- 431,438 ----
  		$this->_set_cdata_close( "</$1\\s*>" );
  		$this->_set_pcdata_mode( 0 );
! #	    } elsif ($it->string =~ /^<(title)\b/is) {
! #		$this->_set_cdata_mode( 1 );
! #		$this->_set_cdata_close( "</$1\\s*>" );
! #		$this->_set_pcdata_mode( 1 );
  	    }
  	    $it->set_attributes( $this->_extract_attributes($it->string, $it->line_number) );
***************
*** 466,470 ****
  		    if $check =~ /$re_tag_compat/s;
  	}
! 	$it = TmplToken->new( $it, TmplTokenType::CDATA, $this->line_number )
  		if defined $it;
  	$this->_set_pcdata_mode, 0;
--- 466,475 ----
  		    if $check =~ /$re_tag_compat/s;
  	}
! 	# PCDATA should be treated as text, not CDATA
! 	# Actually it should be treated as TEXT_PARAMETRIZED :-(
! 	$it = TmplToken->new( $it,
! 			($this->pcdata_mode_p?
! 			    TmplTokenType::TEXT: TmplTokenType::CDATA),
! 			$this->line_number )
  		if defined $it;
  	$this->_set_pcdata_mode, 0;
***************
*** 856,859 ****
--- 861,868 ----
  turned on using the set_cformat(1) method call.
  
+ =head1 BUGS
+ 
+ There is no code to save the tag name anywhere in the scanned token.
+ 
  =head1 HISTORY
  





More information about the Koha-cvs mailing list