| 1 |
#!/usr/bin/perl |
| 2 |
|
| 3 |
###################################################################### |
| 4 |
# |
| 5 |
# A sample PseudoPod to HTML converter script that uses |
| 6 |
# Pod::PseudoPod::HTML. |
| 7 |
# |
| 8 |
# usage: |
| 9 |
# |
| 10 |
# $ ppod2html filename1.pod filename2.pod |
| 11 |
# |
| 12 |
# Will produce one html file for each pod file passed in. |
| 13 |
# |
| 14 |
# filename1.html |
| 15 |
# filename2.html |
| 16 |
# |
| 17 |
###################################################################### |
| 18 |
|
| 19 |
use strict; |
| 20 |
use Pod::PseudoPod::HTML; |
| 21 |
use File::Basename; |
| 22 |
|
| 23 |
foreach my $file (@ARGV) { |
| 24 |
my $parser = Pod::PseudoPod::HTML->new(); |
| 25 |
|
| 26 |
# HTML output goes to the current working |
| 27 |
# directory not the source directory. |
| 28 |
my $outfile = fileparse( $file, qr{\..*} ) . '.html'; |
| 29 |
|
| 30 |
open HTMLOUT, ">$outfile" or die "Can't write to $outfile: $!"; |
| 31 |
$parser->output_fh(*HTMLOUT); |
| 32 |
|
| 33 |
$parser->add_body_tags(1); # output a complete html document |
| 34 |
$parser->add_css_tags(1); # add css tags for cleaner display |
| 35 |
|
| 36 |
$parser->no_errata_section(1); # don't put errors in doc output |
| 37 |
$parser->complain_stderr(1); # output errors on STDERR instead |
| 38 |
|
| 39 |
if (-e $file) { |
| 40 |
$parser->parse_file($file); |
| 41 |
} else { |
| 42 |
die "Unable to open file\n"; |
| 43 |
} |
| 44 |
close HTMLOUT; |
| 45 |
} |
| 46 |
|
| 47 |
exit; |