]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
texi2pod.pl: If multiple @c man sections with the same tag appear...
authorZack Weinberg <zack@wolery.stanford.edu>
Thu, 7 Dec 2000 22:11:12 +0000 (22:11 +0000)
committerZack Weinberg <zack@gcc.gnu.org>
Thu, 7 Dec 2000 22:11:12 +0000 (22:11 +0000)
* texi2pod.pl: If multiple @c man sections with the same tag
appear, concatenate them in the final output.  When skipping,
ignore block commands that can't cause skipping, and honor
those that can.  Ensure that verbatim blocks are separate
paragraphs.

From-SVN: r38117

contrib/ChangeLog
contrib/texi2pod.pl

index b85f838d491fcbea38204c723889e244fcec0bba..771c2556076296aa96c81374f4a542eb1021934c 100644 (file)
@@ -1,3 +1,11 @@
+2000-12-07  Zack Weinberg  <zack@wolery.stanford.edu>
+
+       * texi2pod.pl: If multiple @c man sections with the same tag
+       appear, concatenate them in the final output.  When skipping,
+       ignore block commands that can't cause skipping, and honor
+       those that can.  Ensure that verbatim blocks are separate
+       paragraphs.
+
 2000-12-07  Joseph S. Myers  <jsm28@cam.ac.uk>
 
        * gcc_update: Don't touch tradcif.c or java/parse.h.
index 70c253c8143278864613f95fd200519ebd983d98..0d5139aab40585c3f9f9e8af038c5588c4ef086d 100755 (executable)
@@ -65,7 +65,8 @@ while(<STDIN>)
     # would require rev'ing all other Texinfo translators.
     /^\@c man begin ([A-Z]+)/ and $sect = $1, $output = 1, next;
     /^\@c man end/ and do {
-       $sects{$sect} = postprocess($section);
+       $sects{$sect} = "" unless exists $sects{$sect};
+       $sects{$sect} .= postprocess($section);
        $section = "";
        $output = 0;
        next;
@@ -79,22 +80,57 @@ while(<STDIN>)
     # End-block handler goes up here because it needs to operate even
     # if we are skipping.
     /^\@end\s+([a-z]+)/ and do {
-       die "\@end $1 without \@$1 at line $.\n" unless defined $endw;
-       die "\@$endw ended by \@end $1 at line $.\n" unless $1 eq $endw;
+       # Ignore @end foo, where foo is not an operation which may
+       # cause us to skip, if we are presently skipping.
+       my $ended = $1;
+       next if $skipping && $ended !~ /^(?:ifset|ifclear|ignore|menu)$/;
+
+       die "\@end $ended without \@$ended at line $.\n" unless defined $endw;
+       die "\@$endw ended by \@end $ended at line $.\n" unless $ended eq $endw;
 
        $endw = pop @endwstack;
 
-       if ($1 =~ /example$/) {
-           $shift = "";
-           next;
-       } elsif ($1 =~ /^(if|ignore|menu)/) {
+       if ($ended =~ /^(?:ifset|ifclear|ignore|menu)$/) {
            $skipping = pop @skstack;
            next;
-       } else {
+       } elsif ($ended =~ /^(?:example|smallexample)$/) {
+           $shift = "";
+           $_ = "";    # need a paragraph break
+       } elsif ($ended =~ /^(?:itemize|enumerate|table)$/) {
            $_ = "\n=back\n";
            $ic = pop @icstack;
+       } else {
+           die "unknown command \@end $ended at line $.\n";
        }
     };
+
+    # We must handle commands which can cause skipping even while we
+    # are skipping, otherwise we will not process nested conditionals
+    # correctly.
+    /^\@ifset\s+([a-zA-Z0-9_-]+)/ and do {
+       push @endwstack, $endw;
+       push @skstack, $skipping;
+       $endw = "ifset";
+       $skipping = 1 unless exists $defs{$1};
+       next;
+    };
+
+    /^\@ifclear\s+([a-zA-Z0-9_-]+)/ and do {
+       push @endwstack, $endw;
+       push @skstack, $skipping;
+       $endw = "ifclear";
+       $skipping = 1 if exists $defs{$1};
+       next;
+    };
+
+    /^\@(ignore|menu)\b/ and do {
+       push @endwstack, $endw;
+       push @skstack, $skipping;
+       $endw = $1;
+       $skipping = 1;
+       next;
+    };
+
     next if $skipping;
 
     # Character entities.  First the ones that can be replaced by raw text
@@ -132,30 +168,6 @@ while(<STDIN>)
     /^\@subsection\s+(.+)$/ and $_ = "\n=head3 $1\n";
 
     # Block command handlers:
-    /^\@ifset\s+([a-zA-Z0-9_-]+)/ and do {
-       push @endwstack, $endw;
-       push @skstack, $skipping;
-       $endw = "ifset";
-       $skipping = 1 unless exists $defs{$1};
-       next;
-    };
-
-    /^\@ifclear\s+([a-zA-Z0-9_-]+)/ and do {
-       push @endwstack, $endw;
-       push @skstack, $skipping;
-       $endw = "ifclear";
-       $skipping = 1 if exists $defs{$1};
-       next;
-    };
-
-    /^\@(ignore|menu)\b/ and do {
-       push @endwstack, $endw;
-       push @skstack, $skipping;
-       $endw = $1;
-       $skipping = 1;
-       next;
-    };
-
     /^\@itemize\s+(\@[a-z]+|\*|-)/ and do {
        push @endwstack, $endw;
        push @icstack, $ic;
@@ -192,7 +204,7 @@ while(<STDIN>)
        push @endwstack, $endw;
        $endw = $1;
        $shift = "\t";
-       next;
+       $_ = "";        # need a paragraph break
     };
 
     /^\@itemx?\s*(.+)?$/ and do {