X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=doc%2Ftexi2pod.pl;h=0eb5e8d9fe64f197e9fa2319ce866750968599d3;hb=c57fe49da8feda7d2e6c266978250a15a83e0484;hp=5964449a9ef7b4f05a8b15ed58f720cdae7940f9;hpb=acbdbf815ae8c84a4b4c7687a9af63cf04e12492;p=ffmpeg diff --git a/doc/texi2pod.pl b/doc/texi2pod.pl index 5964449a9ef..0eb5e8d9fe6 100755 --- a/doc/texi2pod.pl +++ b/doc/texi2pod.pl @@ -26,6 +26,7 @@ $output = 0; $skipping = 0; %sects = (); +@sects_sequence = (); $section = ""; @icstack = (); @endwstack = (); @@ -99,15 +100,21 @@ while(<$inf>) { next; }; + /^\@include\s+(.+)$/ and do { + push @instack, $inf; + $inf = gensym(); + + # Try cwd and $ibase. + open($inf, "<" . $1) + or open($inf, "<" . $ibase . "/" . $1) + or die "cannot open $1 or $ibase/$1: $!\n"; + next; + }; + # Look for blocks surrounded by @c man begin SECTION ... @c man end. # This really oughta be @ifman ... @end ifman and the like, but such # would require rev'ing all other Texinfo translators. - /^\@c\s+man\s+begin\s+([A-Z]+)\s+([A-Za-z0-9-]+)/ and do { - $output = 1 if exists $defs{$2}; - $sect = $1; - next; - }; - /^\@c\s+man\s+begin\s+([A-Z]+)/ and $sect = $1, $output = 1, next; + /^\@c\s+man\s+begin\s+([A-Za-z ]+)/ and $sect = $1, push (@sects_sequence, $sect), $output = 1, next; /^\@c\s+man\s+end/ and do { $sects{$sect} = "" unless exists $sects{$sect}; $sects{$sect} .= postprocess($section); @@ -224,21 +231,12 @@ while(<$inf>) { # Single line command handlers. - /^\@include\s+(.+)$/ and do { - push @instack, $inf; - $inf = gensym(); - - # Try cwd and $ibase. - open($inf, "<" . $1) - or open($inf, "<" . $ibase . "/" . $1) - or die "cannot open $1 or $ibase/$1: $!\n"; - next; - }; - - /^\@(?:section|unnumbered|unnumberedsec|center)\s+(.+)$/ + /^\@(?:section|unnumbered|unnumberedsec|center|heading)\s+(.+)$/ and $_ = "\n=head2 $1\n"; - /^\@subsection\s+(.+)$/ + /^\@(?:subsection|subheading)\s+(.+)$/ and $_ = "\n=head3 $1\n"; + /^\@(?:subsubsection|subsubheading)\s+(.+)$/ + and $_ = "\n=head4 $1\n"; # Block command handlers: /^\@itemize\s*(\@[a-z]+|\*|-)?/ and do { @@ -303,8 +301,8 @@ die "No filename or title\n" unless defined $fn && defined $tl; $sects{NAME} = "$fn \- $tl\n"; $sects{FOOTNOTES} .= "=back\n" if exists $sects{FOOTNOTES}; -for $sect (qw(NAME SYNOPSIS DESCRIPTION OPTIONS EXAMPLES ENVIRONMENT FILES - BUGS NOTES FOOTNOTES SEEALSO AUTHOR COPYRIGHT)) { +unshift @sects_sequence, "NAME"; +for $sect (@sects_sequence) { if(exists $sects{$sect}) { $head = $sect; $head =~ s/SEEALSO/SEE ALSO/; @@ -350,9 +348,11 @@ sub postprocess # @* is also impossible in .pod; we discard it and any newline that # follows it. Similarly, our macro @gol must be discarded. + s/\@anchor{(?:[^\}]*)\}//g; s/\(?\@xref\{(?:[^\}]*)\}(?:[^.<]|(?:<[^<>]*>))*\.\)?//g; s/\s+\(\@pxref\{(?:[^\}]*)\}\)//g; s/;\s+\@pxref\{(?:[^\}]*)\}//g; + s/\@ref\{([^\}]*)\}/$1/g; s/\@noindent\s*//g; s/\@refill//g; s/\@gol//g;