summaryrefslogtreecommitdiff
path: root/pod/buildtoc
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-11-27 23:02:54 +0100
committerNicholas Clark <nick@ccl4.org>2011-11-28 12:44:04 +0100
commit60f0ee9d24765f343ab818204b006e2c6ddeba05 (patch)
tree01431197c3bb03117266e26e7bdc4a5090ac7dc3 /pod/buildtoc
parente08f19f5d0717ead6e0fc25b4a866d9192e3deb1 (diff)
downloadperl-60f0ee9d24765f343ab818204b006e2c6ddeba05.tar.gz
pod/buildtoc now generates pod/roffitall
roffitall remains a shell script, identical apart from a dynamically generated list of man pages (and removal of the comment from 2000 that this should be done).
Diffstat (limited to 'pod/buildtoc')
-rw-r--r--pod/buildtoc85
1 files changed, 69 insertions, 16 deletions
diff --git a/pod/buildtoc b/pod/buildtoc
index b3a13c48fa..4024d070a6 100644
--- a/pod/buildtoc
+++ b/pod/buildtoc
@@ -77,6 +77,7 @@ for (@modpods) {
# further still, and used *only* to create pod/perltoc.pod by printing direct
my $OUT;
+my $roffitall;
($_= <<"EOPOD2B") =~ s/^\t//gm and $OUT .= $_;
@@ -100,6 +101,7 @@ EOPOD2B
# All the things in the master list that happen to be pod filenames
foreach (grep {defined $_ && @$_ == 5 && !$_->[0]{toc_omit}} @{$state->{master}}) {
+ $roffitall .= " \$mandir/$_->[4].1 \\\n";
podset($_->[4], $_->[2], $_->[1] ne $_->[4]);
}
@@ -113,7 +115,8 @@ foreach my $type (qw(PRAGMA MODULE)) {
EOPOD2B
foreach my $name (sort keys %{$Found{$type}}) {
- podset($name, $Found{$type}{$name});
+ $roffitall .= " \$libdir/$name.3 \\\n"
+ if podset($name, $Found{$type}{$name});
}
}
@@ -152,6 +155,70 @@ $OUT =~ s/([^\n]+)/wrap('', '', $1)/ge;
write_or_die('pod/perltoc.pod', $OUT);
+write_or_die('pod/roffitall', <<'EOH' . $roffitall . <<'EOT');
+#!/bin/sh
+#
+# Usage: roffitall [-nroff|-psroff|-groff]
+#
+# Authors: Tom Christiansen, Raphael Manfredi
+
+me=roffitall
+tmp=.
+
+if test -f ../config.sh; then
+ . ../config.sh
+fi
+
+mandir=$installman1dir
+libdir=$installman3dir
+
+test -d $mandir || mandir=/usr/new/man/man1
+test -d $libdir || libdir=/usr/new/man/man3
+
+case "$1" in
+-nroff) cmd="nroff -man"; ext='txt';;
+-psroff) cmd="psroff -t"; ext='ps';;
+-groff) cmd="groff -man"; ext='ps';;
+*)
+ echo "Usage: roffitall [-nroff|-psroff|-groff]" >&2
+ exit 1
+ ;;
+esac
+
+toroff=`
+ echo \
+EOH
+ | perl -ne 'map { -r && print "$_ " } split'`
+
+ # Bypass internal shell buffer limit -- can't use case
+ if perl -e '$a = shift; exit($a =~ m|/|)' $toroff; then
+ echo "$me: empty file list -- did you run install?" >&2
+ exit 1
+ fi
+
+ #psroff -t -man -rC1 -rD1 -rF1 > $tmp/PerlDoc.ps 2>$tmp/PerlTOC.raw
+ #nroff -man -rC1 -rD1 -rF1 > $tmp/PerlDoc.txt 2>$tmp/PerlTOC.nr.raw
+
+ # First, create the raw data
+ run="$cmd -rC1 -rD1 -rF1 >$tmp/PerlDoc.$ext 2>$tmp/PerlTOC.$ext.raw"
+ echo "$me: running $run"
+ eval $run $toroff
+
+ #Now create the TOC
+ echo "$me: parsing TOC"
+ perl rofftoc $tmp/PerlTOC.$ext.raw > $tmp/PerlTOC.tmp.man
+ run="$cmd $tmp/PerlTOC.tmp.man >$tmp/PerlTOC.$ext"
+ echo "$me: running $run"
+ eval $run
+
+ # Finally, recreate the Doc, without the blank page 0
+ run="$cmd -rC1 -rD1 >$tmp/PerlDoc.$ext 2>$tmp/PerlTOC.$ext.raw"
+ echo "$me: running $run"
+ eval $run $toroff
+ rm -f $tmp/PerlTOC.tmp.man $tmp/PerlTOC.$ext.raw
+ echo "$me: leaving you with $tmp/PerlDoc.$ext and $tmp/PerlTOC.$ext"
+EOT
+
exit(0);
# Below are all the auxiliary routines for generating perltoc.pod
@@ -221,6 +288,7 @@ sub podset {
}
$OUT .= $_;
}
+ return 1;
}
sub unhead1 {
@@ -245,18 +313,3 @@ sub unitem {
}
$initem = 0;
}
-
-# Code added in commit 416302502f485afa, but never used.
-# Probably roffitall should become something that buildtoc generates, instead
-# of something that we ship in the distribution.
-
-sub generate_roffitall {
- (map ({"\t\$maindir/$_.1\t\\"}sort keys %{$state->{pods}}),
- "\t\t\\",
- map ({"\t\$maindir/$_.1\t\\"}sort keys %{$state->{aux}}),
- "\t\t\\",
- map ({"\t\$libdir/$_.3\t\\"}sort keys %{$Found{PRAGMA}}),
- "\t\t\\",
- map ({"\t\$libdir/$_.3\t\\"}sort keys %{$Found{MODULE}}),
- )
-}