From d7c9aa41eb942973e048a59eb753c4f58a0616bd Mon Sep 17 00:00:00 2001 From: Stephen L Johnson Date: Thu, 14 Sep 2000 17:19:32 +0000 Subject: [PATCH] added program into CVS --- pod/builddoc | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100755 pod/builddoc diff --git a/pod/builddoc b/pod/builddoc new file mode 100755 index 0000000..0d88c1d --- /dev/null +++ b/pod/builddoc @@ -0,0 +1,94 @@ +#!/usr/bin/perl + +# builddoc - build Spong documentation in various formatted +# +# This utility is designed to build the Spong documentation from all of +# the POD document sources. It will build various formats: html, text and man +# + +# $Id: builddoc,v 1.1 2000/09/14 17:19:32 sljohnson Exp $ + +use File::Basename; +use Getopt::Long; + +@suffixlist = ('.pm','.pl','.pod'); + +Getopt::Long::Configure("pass_through"); + +if (! GetOptions("dir:s" => \$dstdir, "type:s" =>$doctype )) { + print STDERR "Incorrect Usage\n"; + usage(); +} + +if (! defined $doctype && ! defined $ARGV[0] ) { + print STDERR "You have to specify documentation type: html, text, man , etc\n\n"; + usage(); +} + +$doctype = $ARGV[0] unless defined $doctype; + +if ($doctype eq "html" || $doctype eq "dist" ) { $suffix = ".html"; } +elsif ($doctype eq "text") { $suffix = ".txt"; } +elsif ($doctype eq "man") { $suffix = ".man"; } +else { + print STDERR "Invalid documentation type. Must be: html, text, man\n"; + usage(); +} + +$files = `find ../ -type f -print \| egrep '*.pod\$\|*.pm\$\|plugins' \| grep -v CVS`; +@files = split /\s+/,$files; + +system "rm -f pod2html-*" if $doctype eq "html"; + +# Don't try this at home. I use this option to build the documentation for +# Spong distributions. I have some customized programs which do this. +# Write me at sjohnson@monsters.org if you want to know what I use. +if ($doctype eq "dist") { + # Make sure that CWD is in a known sane place + chomp($cwd = `pwd`); + $mydir = dirname($cwd . "/" . $0); + chdir $mydir; + + $files =~ s/\s+/ /g; # Make the whitepace into spaces + + $cmd = "mpod2html -dir ../www/docs/ -tocname spongtoc -idxname spongindex" + . " $files 1> /tmp/pod.out 2>&1"; + system $cmd; + exit 0; +} + +foreach $file ( @files ) { + + print "$file\n"; + + $basename = basename($file,@suffixlist); + + $outfile = $basename . $suffix; + $outfile = $dstdir . "/" . $outfile if $dstdir; + + if ($doctype eq "html") { + $cmd = "pod2html --recurse --podroot=../ --podpath=pod:src " . + "--infile=$file --outfile=$outfile 2>/dev/null"; + } elsif ($doctype eq "text") { + $cmd = "pod2text <$file >$outfile 2>/dev/null"; + } elsif ($doctype eq "man") { + $cmd = "pod2man --center 'Spong 2.7' --release '2.7' $file >$outfile " . + "2>/dev/null"; + } + + system $cmd; +} + +sub usage { + + print <