[Po4a-commits] "po4a/lib/Locale/Po4a Xml.pm,1.72,1.73"

Noritada Kobayashi nori1-guest at alioth.debian.org
Mon Mar 10 19:57:17 UTC 2008


Update of /cvsroot/po4a/po4a/lib/Locale/Po4a
In directory alioth:/tmp/cvs-serv23767/lib/Locale/Po4a

Modified Files:
	Xml.pm 
Log Message:
* lib/Locale/Po4a/Xml.pm: Make sure that all comments at a block
in input XML are separately inserted into a corresponding block in
output XML.  The previous behaviour was those comments are merged
into one comment.
* t/data-27/comments-normalized.xml,
t/data-27/general-normalized.xml: Update the test data accordingly.


Index: Xml.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Xml.pm,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -d -r1.72 -r1.73
--- Xml.pm	2 Mar 2008 15:35:18 -0000	1.72
+++ Xml.pm	10 Mar 2008 19:57:14 -0000	1.73
@@ -1194,6 +1194,7 @@
 		    and $f_extract eq \&tag_extract_comment) {
 			# Remove the content of the comments
 			($eof, @text) = $self->extract_tag($type,1);
+			$text[$#text-1] .= "\0";
 			push @comments, @text;
 		} else {
 			my ($tmpeof, @tag) = $self->extract_tag($type,0);
@@ -1438,12 +1439,18 @@
 
 	my $comments;
 	while (@comments) {
-		my ($t,$l) = (shift @comments, shift @comments);
-		$t =~ s/\n$//;
+		my ($comment,$eoc);
+		do {
+			my ($t,$l) = (shift @comments, shift @comments);
+			$t =~ s/\n?(\0)?$//;
+			$eoc = $1;
+			$comment .= "\n" if defined $comment;
+			$comment .= $t;
+		} until ($eoc);
 		$comments .= "\n" if defined $comments;
-		$comments .= $t;
+		$comments .= $comment;
+		$self->pushline("<!--".$comment."-->\n") if defined $comment;
 	}
-	$self->pushline("<!--".$comments."-->\n") if defined $comments;
 	@comments = ();
 
 	if ($self->{options}{'cpp'}) {




More information about the Po4a-commits mailing list