[Po4a-devel][CVS] po4a/lib/Locale/Po4a Sgml.pm,1.29,1.30

Martin Quinson po4a-devel@lists.alioth.debian.org
Sat, 07 Aug 2004 03:02:08 +0000


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

Modified Files:
	Sgml.pm 
Log Message:
Refrain to indent verbatim tags

Index: Sgml.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Sgml.pm,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- Sgml.pm	2 Aug 2004 09:45:48 -0000	1.29
+++ Sgml.pm	7 Aug 2004 03:02:06 -0000	1.30
@@ -383,7 +383,7 @@
 	                                    "table tbody textobject tgroup thead tip toc ".
 	                                    "variablelist varlistentry videoobject ".
 	                                    "warning",
-			     "verbatim"  => "address programlisting literallayout refentry screen",
+			     "verbatim"  => "address programlisting literallayout refentrytitle screen",
 			     "ignore"    => "action affiliation anchor application author authorinitials ".
 	                                    "command citation citerefentry citetitle classname co computeroutput constant corpauthor ".
 	                                    "database ".
@@ -607,7 +607,7 @@
 
 
 	    # debug
-	    print STDERR "Seen $tag, open level=".(scalar @open)."\n"
+	    print STDERR "Seen $tag, open level=".(scalar @open).", verb=$verb\n"
 		if ($debug{'tag'});
 
 	    if ($event->data->name() eq 'FOOTNOTE') {
@@ -643,13 +643,15 @@
 		    if (scalar @open);
 	    }
 
+	    $verb++ if $verbatim{$event->data->name()};
 	    if ($indent{$event->data->name()}) {
-		$self->pushline((" " x $indent).$tag."\n");
+		# push the indenting space only if not in verb before that tag
+		# push tailing "\n" only if not in verbose afterward
+		$self->pushline( ($verb>1?"": (" " x $indent)).$tag.($verb?"":"\n"));
 		$indent ++ unless $empty{$event->data->name()} ;
 	    }  else {
 		$buffer .= $tag;
 	    }
-	    $verb++ if $verbatim{$event->data->name()};
 	} # end of type eq 'start_element'
 	
 	elsif ($event->type eq 'end_element') {
@@ -659,7 +661,7 @@
 		           : 
 		       '</'.lc($event->data->name()).'>');
 
-	    print STDERR "Seen $tag, level=".(scalar @open)."\n"
+	    print STDERR "Seen $tag, level=".(scalar @open).", verb=$verb\n"
 		if ($debug{'tag'});
 
 	    $lastchar = ">";
@@ -692,7 +694,9 @@
 
 	    if ($indent{$event->data->name()}) {
 		$indent -- ;
-		$self->pushline((" " x $indent).$tag."\n");
+		# add indenting space only when not in verbatim
+		# add the tailing \n only if out of verbatim after that tag
+		$self->pushline(($verb?"":(" " x $indent)).$tag.($verb>1?"":"\n"));
 	    }  else {
 		$buffer .= $tag;
 	    }