Skip to content

Commit

Permalink
When producing man-pages, ensure NAME section is one line only
Browse files Browse the repository at this point in the history
There are *roff parsers that are strict about the NAME section being
one line only.  The man(7) on Debian GNU/Linux suggests that this is
appropriate, so we compensate our multi-line NAME sections by fixing
the *roff output.

Noted by Eric S. Raymond

Related to openssl#6264

Reviewed-by: Rich Salz <[email protected]>
(Merged from openssl#6268)
  • Loading branch information
levitte committed May 16, 2018
1 parent 653162c commit 8d483b2
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions util/process_docs.pl
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,32 @@
@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};

Expand Down

0 comments on commit 8d483b2

Please sign in to comment.