[Koha-cvs] CVS: koha/misc/translator TmplTokenizer.pm,1.18,1.19

Ambrose C. LI acli at users.sourceforge.net
Sun Feb 22 08:00:19 CET 2004


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

Modified Files:
	TmplTokenizer.pm 
Log Message:
Ugly hack to get rid of the close tag in pathetic "foo %s</h1>"-like strings


Index: TmplTokenizer.pm
===================================================================
RCS file: /cvsroot/koha/koha/misc/translator/TmplTokenizer.pm,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -r1.18 -r1.19
*** TmplTokenizer.pm	22 Feb 2004 06:46:15 -0000	1.18
--- TmplTokenizer.pm	22 Feb 2004 07:00:16 -0000	1.19
***************
*** 486,489 ****
--- 486,503 ----
  		push @{$this->{_queue}}, pop @structure;
  	    }
+ 	    # FIXME: If the last token is a close tag but there are no tags
+ 	    # FIXME: before it, drop the close tag back into the queue. This
+ 	    # FIXME: is an ugly hack to get rid of "foo %s</h1>" type mess.
+ 	    if (@structure >= 2
+ 		    && $structure[$#structure]->type == TmplTokenType::TAG
+ 		    && $structure[$#structure]->string =~ /^<\//) {
+ 		my $has_other_tags_p = 0;
+ 		for (my $i = 0; $i < $#structure; $i += 1) {
+ 		    $has_other_tags_p = 1
+ 			    if $structure[$i]->type == TmplTokenType::TAG;
+ 		last if $has_other_tags_p;
+ 		}
+ 		push @{$this->{_queue}}, pop @structure unless $has_other_tags_p
+ 	    }
  	    if (@structure < 2) {
  		# Nothing to do





More information about the Koha-cvs mailing list