X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=util%2Fprocess_docs.pl;h=e1e741e9b6fcc5b054b8914014e4091b474302ec;hp=49176ad30bc97b0eb7a841f38e78d479909c3e0a;hb=6439e343fa64f06941197d085acd11bd13856596;hpb=102c9e1296b656c4049c1110abc8a52b43bd0dcf diff --git a/util/process_docs.pl b/util/process_docs.pl old mode 100644 new mode 100755 index 49176ad30b..e1e741e9b6 --- a/util/process_docs.pl +++ b/util/process_docs.pl @@ -13,7 +13,9 @@ use File::Spec::Functions; use File::Basename; use File::Copy; use File::Path; -use if $^O ne "VMS", 'File::Glob' => qw/:bsd_glob/; +use FindBin; +use lib "$FindBin::Bin/perl"; +use OpenSSL::Glob; use Getopt::Long; use Pod::Usage; @@ -96,7 +98,7 @@ foreach my $section (sort @{$options{section}}) { my $suffix = { man => ".$podinfo{section}".($options{suffix} // ""), html => ".html" } -> {$options{type}}; my $generate = { man => "pod2man --name=$name --section=$podinfo{section} --center=OpenSSL --release=$config{version} \"$podpath\"", - html => "pod2html \"--podroot=$options{sourcedir}\" --htmldir=$updir --podpath=man1:man3:man5:man7 \"--infile=$podpath\" \"--title=$podname\"" + html => "pod2html \"--podroot=$options{sourcedir}\" --htmldir=$updir --podpath=man1:man3:man5:man7 \"--infile=$podpath\" \"--title=$podname\" --quiet" } -> {$options{type}}; my $output_dir = catdir($options{destdir}, "man$podinfo{section}"); my $output_file = $podname . $suffix; @@ -110,6 +112,32 @@ foreach my $section (sort @{$options{section}}) { @output = `$generate`; map { s|href="http://man\.he\.net/(man\d/[^"]+)(?:\.html)?"|href="../$1.html"|g; } @output if $options{type} eq "html"; + if ($options{type} eq "man") { + # Because some *roff parsers are more strict than others, + # multiple lines in the NAME section must be merged into + # one. + my $in_name = 0; + my $name_line = ""; + my @newoutput = (); + foreach (@output) { + if ($in_name) { + if (/^\.SH "/) { + $in_name = 0; + push @newoutput, $name_line."\n"; + } else { + chomp (my $x = $_); + $name_line .= " " if $name_line; + $name_line .= $x; + next; + } + } + if (/^\.SH +"NAME" *$/) { + $in_name = 1; + } + push @newoutput, $_; + } + @output = @newoutput; + } } print STDERR "DEBUG: Done processing\n" if $options{debug};