| 1 | #!/usr/local/bin/perl
|
|---|
| 2 |
|
|---|
| 3 | use Config;
|
|---|
| 4 | use File::Basename qw(&basename &dirname);
|
|---|
| 5 | use Cwd;
|
|---|
| 6 |
|
|---|
| 7 | # List explicitly here the variables you want Configure to
|
|---|
| 8 | # generate. Metaconfig only looks for shell variables, so you
|
|---|
| 9 | # have to mention them as if they were shell variables, not
|
|---|
| 10 | # %Config entries. Thus you write
|
|---|
| 11 | # $startperl
|
|---|
| 12 | # to ensure Configure will look for $Config{startperl}.
|
|---|
| 13 |
|
|---|
| 14 | # This forces PL files to create target in same directory as PL file.
|
|---|
| 15 | # This is so that make depend always knows where to find PL derivatives.
|
|---|
| 16 | $origdir = cwd;
|
|---|
| 17 | chdir dirname($0);
|
|---|
| 18 | $file = basename($0, '.PL');
|
|---|
| 19 | $file .= '.com' if $^O eq 'VMS';
|
|---|
| 20 |
|
|---|
| 21 | open OUT,">$file" or die "Can't create $file: $!";
|
|---|
| 22 |
|
|---|
| 23 | print "Extracting $file (with variable substitutions)\n";
|
|---|
| 24 |
|
|---|
| 25 | # In this section, perl variables will be expanded during extraction.
|
|---|
| 26 | # You can use $Config{...} to use Configure variables.
|
|---|
| 27 |
|
|---|
| 28 | print OUT <<"!GROK!THIS!";
|
|---|
| 29 | $Config{startperl}
|
|---|
| 30 | eval 'exec $Config{perlpath} -S \$0 \${1+"\$@"}'
|
|---|
| 31 | if \$running_under_some_shell;
|
|---|
| 32 | !GROK!THIS!
|
|---|
| 33 |
|
|---|
| 34 | # In the following, perl variables are not expanded during extraction.
|
|---|
| 35 |
|
|---|
| 36 | print OUT <<'!NO!SUBS!';
|
|---|
| 37 | =pod
|
|---|
| 38 |
|
|---|
| 39 | =head1 NAME
|
|---|
| 40 |
|
|---|
| 41 | pod2html - convert .pod files to .html files
|
|---|
| 42 |
|
|---|
| 43 | =head1 SYNOPSIS
|
|---|
| 44 |
|
|---|
| 45 | pod2html --help --htmlroot=<name> --infile=<name> --outfile=<name>
|
|---|
| 46 | --podpath=<name>:...:<name> --podroot=<name>
|
|---|
| 47 | --libpods=<name>:...:<name> --recurse --norecurse --verbose
|
|---|
| 48 | --index --noindex --title=<name>
|
|---|
| 49 |
|
|---|
| 50 | =head1 DESCRIPTION
|
|---|
| 51 |
|
|---|
| 52 | Converts files from pod format (see L<perlpod>) to HTML format.
|
|---|
| 53 |
|
|---|
| 54 | =head1 ARGUMENTS
|
|---|
| 55 |
|
|---|
| 56 | pod2html takes the following arguments:
|
|---|
| 57 |
|
|---|
| 58 | =over 4
|
|---|
| 59 |
|
|---|
| 60 | =item help
|
|---|
| 61 |
|
|---|
| 62 | --help
|
|---|
| 63 |
|
|---|
| 64 | Displays the usage message.
|
|---|
| 65 |
|
|---|
| 66 | =item htmlroot
|
|---|
| 67 |
|
|---|
| 68 | --htmlroot=name
|
|---|
| 69 |
|
|---|
| 70 | Sets the base URL for the HTML files. When cross-references are made,
|
|---|
| 71 | the HTML root is prepended to the URL.
|
|---|
| 72 |
|
|---|
| 73 | =item infile
|
|---|
| 74 |
|
|---|
| 75 | --infile=name
|
|---|
| 76 |
|
|---|
| 77 | Specify the pod file to convert. Input is taken from STDIN if no
|
|---|
| 78 | infile is specified.
|
|---|
| 79 |
|
|---|
| 80 | =item outfile
|
|---|
| 81 |
|
|---|
| 82 | --outfile=name
|
|---|
| 83 |
|
|---|
| 84 | Specify the HTML file to create. Output goes to STDOUT if no outfile
|
|---|
| 85 | is specified.
|
|---|
| 86 |
|
|---|
| 87 | =item podroot
|
|---|
| 88 |
|
|---|
| 89 | --podroot=name
|
|---|
| 90 |
|
|---|
| 91 | Specify the base directory for finding library pods.
|
|---|
| 92 |
|
|---|
| 93 | =item podpath
|
|---|
| 94 |
|
|---|
| 95 | --podpath=name:...:name
|
|---|
| 96 |
|
|---|
| 97 | Specify which subdirectories of the podroot contain pod files whose
|
|---|
| 98 | HTML converted forms can be linked-to in cross-references.
|
|---|
| 99 |
|
|---|
| 100 | =item libpods
|
|---|
| 101 |
|
|---|
| 102 | --libpods=name:...:name
|
|---|
| 103 |
|
|---|
| 104 | List of page names (eg, "perlfunc") which contain linkable C<=item>s.
|
|---|
| 105 |
|
|---|
| 106 | =item netscape
|
|---|
| 107 |
|
|---|
| 108 | --netscape
|
|---|
| 109 |
|
|---|
| 110 | Use Netscape HTML directives when applicable.
|
|---|
| 111 |
|
|---|
| 112 | =item nonetscape
|
|---|
| 113 |
|
|---|
| 114 | --nonetscape
|
|---|
| 115 |
|
|---|
| 116 | Do not use Netscape HTML directives (default).
|
|---|
| 117 |
|
|---|
| 118 | =item index
|
|---|
| 119 |
|
|---|
| 120 | --index
|
|---|
| 121 |
|
|---|
| 122 | Generate an index at the top of the HTML file (default behaviour).
|
|---|
| 123 |
|
|---|
| 124 | =item noindex
|
|---|
| 125 |
|
|---|
| 126 | --noindex
|
|---|
| 127 |
|
|---|
| 128 | Do not generate an index at the top of the HTML file.
|
|---|
| 129 |
|
|---|
| 130 |
|
|---|
| 131 | =item recurse
|
|---|
| 132 |
|
|---|
| 133 | --recurse
|
|---|
| 134 |
|
|---|
| 135 | Recurse into subdirectories specified in podpath (default behaviour).
|
|---|
| 136 |
|
|---|
| 137 | =item norecurse
|
|---|
| 138 |
|
|---|
| 139 | --norecurse
|
|---|
| 140 |
|
|---|
| 141 | Do not recurse into subdirectories specified in podpath.
|
|---|
| 142 |
|
|---|
| 143 | =item title
|
|---|
| 144 |
|
|---|
| 145 | --title=title
|
|---|
| 146 |
|
|---|
| 147 | Specify the title of the resulting HTML file.
|
|---|
| 148 |
|
|---|
| 149 | =item verbose
|
|---|
| 150 |
|
|---|
| 151 | --verbose
|
|---|
| 152 |
|
|---|
| 153 | Display progress messages.
|
|---|
| 154 |
|
|---|
| 155 | =back
|
|---|
| 156 |
|
|---|
| 157 | =head1 AUTHOR
|
|---|
| 158 |
|
|---|
| 159 | Tom Christiansen, E<lt>[email protected]<gt>.
|
|---|
| 160 |
|
|---|
| 161 | =head1 BUGS
|
|---|
| 162 |
|
|---|
| 163 | See L<Pod::Html> for a list of known bugs in the translator.
|
|---|
| 164 |
|
|---|
| 165 | =head1 SEE ALSO
|
|---|
| 166 |
|
|---|
| 167 | L<perlpod>, L<Pod::Html>
|
|---|
| 168 |
|
|---|
| 169 | =head1 COPYRIGHT
|
|---|
| 170 |
|
|---|
| 171 | This program is distributed under the Artistic License.
|
|---|
| 172 |
|
|---|
| 173 | =cut
|
|---|
| 174 |
|
|---|
| 175 | use Pod::Html;
|
|---|
| 176 |
|
|---|
| 177 | pod2html @ARGV;
|
|---|
| 178 | !NO!SUBS!
|
|---|
| 179 |
|
|---|
| 180 | close OUT or die "Can't close $file: $!";
|
|---|
| 181 | chmod 0755, $file or die "Can't reset permissions for $file: $!\n";
|
|---|
| 182 | exec("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':';
|
|---|
| 183 | chdir $origdir;
|
|---|