[Po4a-commits] po4a/lib/Locale/Po4a Sgml.pm,1.38,1.39

Martin Quinson po4a-devel@lists.alioth.debian.org
Sun, 07 Nov 2004 15:35:05 +0000


Update of /cvsroot/po4a/po4a/lib/Locale/Po4a
In directory haydn:/tmp/cvs-serv24621

Modified Files:
	Sgml.pm 
Log Message:
Eat the comments in prologs since they can contain '>' or '<' preventing me to find the closing '>' of the prolog

Index: Sgml.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Sgml.pm,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- Sgml.pm	12 Oct 2004 12:35:28 -0000	1.38
+++ Sgml.pm	7 Nov 2004 15:35:02 -0000	1.39
@@ -327,6 +327,13 @@
 	$pos += length($prolog);
 	$lvl=1;
 	while ($lvl != 0) {
+	    # Eat comments in the prolog, since it may be some '>' or '<' in them
+	    if ($origfile =~ m/^.{$pos}?(<!--.*?-->)/s) {
+		print "Found a comment in the prolog: $1\n" if ($debug{'generic'});
+		$pos += length($1);
+		next;
+	    }
+	    # Search the closing '>'
 	    my ($c)=substr($origfile,$pos,1);
 	    $lvl++ if ($c eq '<');
 	    $lvl-- if ($c eq '>');