Have bin/mk-manpages and bin/mk-newmanpages add a description comment
authorRichard Levitte <levitte@openssl.org>
Thu, 3 Jan 2019 16:17:32 +0000 (17:17 +0100)
committerRichard Levitte <levitte@openssl.org>
Thu, 3 Jan 2019 17:16:45 +0000 (18:16 +0100)
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/web/pull/102)

bin/mk-manpages
bin/mk-newmanpages

index 00d9d0e08c8e499c846389e6f4baacbc6967a088..0096ec212245610eb4952b0dccbb3e49183896a4 100755 (executable)
@@ -58,7 +58,8 @@ sub main {
             my $title = $basename;
             my %data = $class->getdata( $filename );
             my $out =
-              $class->genhtml( $release, $sect, $filename, $title, $basename );
+                $class->genhtml( $release, $sect, $filename, $title, $basename,
+                                 $data{description});
             my $outfile = File::Spec->catfile( $wwwdir, "man$release", $sect,
                 "$basename.html" );
             open( my $fh, ">", $outfile )
@@ -80,8 +81,8 @@ sub main {
 
 # Generate a manpage
 sub genhtml {
-    my ( $class, $release, $section, $filename, $title, $file ) = @_;
-    my $header = $class->htmlHeader($title);
+    my ( $class, $release, $section, $filename, $title, $file, $desc ) = @_;
+    my $header = $class->htmlHeader( $title, $desc );
     my $footer = $class->htmlFooter( $release, $section, $file );
 
     open( my $fh, $filename ) || $class->die("Can't open $filename: $!");
@@ -109,7 +110,8 @@ sub genhtml {
 
 # Return diverse data from a manpage if available, currently:
 # {
-#    names       => [ ... ]             # list of all the names
+#    names       => [ ... ]             # list of all OTHER names
+#    description => "text"              # the short description from NAME
 # }
 sub getdata {
     my ( $class, $infile ) = @_;
@@ -126,7 +128,8 @@ sub getdata {
             }
             elsif ($foundname) {
                 if (/ - /) {
-                    s/ - .*//;
+                    $data{description} = $';
+                    $_ = $`;
                     s/,\s+/,/g;
                     s/\s+,/,/g;
                     s/^\s+//g;
@@ -224,10 +227,11 @@ sub process_options {
 }
 
 sub htmlHeader {
-    my ( $class, $title ) = @_;
+    my ( $class, $title, $desc ) = @_;
     return <<EOFH;
 <!DOCTYPE html>
 <html lang="en">
+<!-- OSSL: description: $desc -->
 <!--#include virtual="/inc/head.shtml" -->
 <body>
   <!--#include virtual="/inc/banner.shtml" -->
index 0dcb097ec466183c0955d4d19c57879164298efa..f8a3ffdb7e76d561924a1a8aa31d45790586b333 100755 (executable)
@@ -43,7 +43,8 @@ sub main {
             my $title = $basename;
             my %data = $class->getdata( $filename );
             my $out =
-              $class->genhtml( $release, $sect, $filename, $title, $basename );
+                $class->genhtml( $release, $sect, $filename, $title, $basename,
+                                 $data{description});
             my $outfile = File::Spec->catfile( $wwwdir, "man$release", $sect,
                 "$basename.html" );
             open( my $fh, ">", $outfile )
@@ -65,8 +66,8 @@ sub main {
 
 # Generate a manpage
 sub genhtml {
-    my ( $class, $release, $section, $filename, $title, $file ) = @_;
-    my $header = $class->htmlHeader($title);
+    my ( $class, $release, $section, $filename, $title, $file, $desc ) = @_;
+    my $header = $class->htmlHeader( $title, $desc );
     my $footer = $class->htmlFooter( $release, $section, $file );
 
     open( my $fh, $filename ) || $class->die("Can't open $filename: $!");
@@ -88,7 +89,8 @@ sub genhtml {
 
 # Return diverse data from a manpage if available, currently:
 # {
-#    names       => [ ... ]             # list of all the names
+#    names       => [ ... ]             # list of all OTHER names
+#    description => "text"              # the short description from NAME
 # }
 sub getdata {
     my ( $class, $infile ) = @_;
@@ -105,13 +107,14 @@ sub getdata {
             }
             elsif ($foundname) {
                 if (/ - /) {
-                    s/ - .*//;
+                    $data{description} = $';
+                    $_ = $`;
                     s/,\s+/,/g;
                     s/\s+,/,/g;
                     s/^\s+//g;
                     s/\s+$//g;
                     s/\s/_/g;
-                    push @words, split ',';
+                    push @{$data{names}}, split ',';
                 }
             }
             if (/^=head1\s+NAME\s*$/) {
@@ -203,10 +206,11 @@ sub process_options {
 }
 
 sub htmlHeader {
-    my ( $class, $title ) = @_;
+    my ( $class, $title, $desc ) = @_;
     return <<EOFH;
 <!DOCTYPE html>
 <html lang="en">
+<!-- OSSL: description: $desc -->
 <!--#include virtual="/inc/head.shtml" -->
 <body>
   <!--#include virtual="/inc/banner.shtml" -->