Use rman (http://sourceforge.net/projects/polyglotman/) to generate
HTML web pages; html2man cut a bunch of them off for no reason. Tweak up the html generation process a bit and add some docs at the top of the script to remind me how to use this script when I come back to it again in 6 months... This commit was SVN r23877.
Этот коммит содержится в:
родитель
69a64e5905
Коммит
dcb8f4b633
37
contrib/dist/make-html-man-pages.pl
поставляемый
37
contrib/dist/make-html-man-pages.pl
поставляемый
@ -5,6 +5,17 @@
|
|||||||
# Script to generate PHP-ized files of Open MPI tarball-installed man
|
# Script to generate PHP-ized files of Open MPI tarball-installed man
|
||||||
# pages.
|
# pages.
|
||||||
#
|
#
|
||||||
|
# Usage: ./make-html-man-pages.pl \
|
||||||
|
# --mandir <top-level-man-dir> \
|
||||||
|
# --version <version-string> \
|
||||||
|
# --outdir <outdir>
|
||||||
|
#
|
||||||
|
# If outdir is not specified, it is assumed to be ".". mandir and
|
||||||
|
# version must be specified. mandir is typically a directory that
|
||||||
|
# ends in "/man" -- it is the directory that .so roff redirects use as
|
||||||
|
# a base (e.g., MPI_Win_c2f.3 is ".so man3/MPI_Comm_f2c.3" -- so
|
||||||
|
# specify a mandir that makes that work).
|
||||||
|
#
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use File::Find;
|
use File::Find;
|
||||||
@ -13,6 +24,7 @@ use Cwd;
|
|||||||
|
|
||||||
my $mandir;
|
my $mandir;
|
||||||
my $version;
|
my $version;
|
||||||
|
my $outdir_base = ".";
|
||||||
|
|
||||||
# Read command line arguments
|
# Read command line arguments
|
||||||
while (@ARGV) {
|
while (@ARGV) {
|
||||||
@ -21,20 +33,25 @@ while (@ARGV) {
|
|||||||
shift @ARGV;
|
shift @ARGV;
|
||||||
$mandir = $ARGV[0];
|
$mandir = $ARGV[0];
|
||||||
print "Found mandir: $mandir\n";
|
print "Found mandir: $mandir\n";
|
||||||
shift @ARGV;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
elsif ($a eq "--version" && $#ARGV >= 1) {
|
elsif ($a eq "--version" && $#ARGV >= 1) {
|
||||||
shift @ARGV;
|
shift @ARGV;
|
||||||
$version = $ARGV[0];
|
$version = $ARGV[0];
|
||||||
print "Found version: $version\n";
|
print "Found version: $version\n";
|
||||||
shift @ARGV;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
elsif ($a eq "--outdir" && $#ARGV >= 1) {
|
||||||
|
shift @ARGV;
|
||||||
|
$outdir_base = $ARGV[0];
|
||||||
|
print "Found outdir: $outdir_base\n";
|
||||||
|
}
|
||||||
|
shift @ARGV;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check that we have what we need
|
# Check that we have what we need
|
||||||
if (!defined($mandir) || !defined($version)) {
|
if (!defined($mandir) || !defined($version)) {
|
||||||
print "Usage: $0 --mandir dir --version version\n";
|
print "Usage: $0 --mandir dir --version version [--outdir outdir]\n";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,7 +81,8 @@ foreach my $file (@files) {
|
|||||||
my $section = $2;
|
my $section = $2;
|
||||||
|
|
||||||
my $outfile = "$pwd/man$section/$b.php";
|
my $outfile = "$pwd/man$section/$b.php";
|
||||||
my $outdir = dirname($outfile);
|
# my $outdir = dirname($outfile);
|
||||||
|
my $outdir = "$outdir_base/man$section";
|
||||||
$dirs{$outdir} = "";
|
$dirs{$outdir} = "";
|
||||||
push(@{$outfiles->{$section}}, {
|
push(@{$outfiles->{$section}}, {
|
||||||
name => $name,
|
name => $name,
|
||||||
@ -76,9 +94,10 @@ foreach my $file (@files) {
|
|||||||
|
|
||||||
print "*** Generating: $name ($section)\n";
|
print "*** Generating: $name ($section)\n";
|
||||||
|
|
||||||
# Run the groff command and send the output to the file
|
# man2html clips many of our man pages -- it just stops halfway
|
||||||
# open(CMD, "groff -mandoc -T html $file|") || die("Can't open command");
|
# through the file. Weird.
|
||||||
open(CMD, "man $file | man2html -bare -botm 4 -topm 4|") || die("Can't open command");
|
#print "man $file | man2html -bare -botm 4 -topm 4\n";
|
||||||
|
open(CMD, "rman -f HTML -r off -p $file|") || die("Can't open command");
|
||||||
my $text;
|
my $text;
|
||||||
$text .= $_
|
$text .= $_
|
||||||
while (<CMD>);
|
while (<CMD>);
|
||||||
@ -191,7 +210,7 @@ foreach my $dir (keys(%dirs)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Now write out a top-level data-<version>.inc file
|
# Now write out a top-level data-<version>.inc file
|
||||||
my $file = "$pwd/data-$version.inc";
|
my $file = "$outdir_base/data-$version.inc";
|
||||||
print "Writing $file...\n";
|
print "Writing $file...\n";
|
||||||
open(FILE, ">$file") || die "Can't open $file";
|
open(FILE, ">$file") || die "Can't open $file";
|
||||||
print FILE '<?php
|
print FILE '<?php
|
||||||
@ -222,7 +241,7 @@ close(FILE);
|
|||||||
|
|
||||||
# Print the top-level engine file for this version (it will use the
|
# Print the top-level engine file for this version (it will use the
|
||||||
# data-<version>.inc file).
|
# data-<version>.inc file).
|
||||||
open(FILE, ">index.php") || die "Can't open index.php";
|
open(FILE, ">$outdir_base/index.php") || die "Can't open $outdir_base/index.php";
|
||||||
print FILE '<?php
|
print FILE '<?php
|
||||||
$topdir = "../..";
|
$topdir = "../..";
|
||||||
include_once("data-' . $version . '.inc");
|
include_once("data-' . $version . '.inc");
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user