Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 555f87ae11
Fetching contributors…

Cannot retrieve contributors at this time

executable file 72 lines (56 sloc) 1.634 kB
package Pod::PseudoPod::DOM::App::ToHTML;
# ABSTRACT: helper functions for bin/ppdom2html
use strict;
use warnings;
use autodie;
use Pod::PseudoPod::DOM;
use Pod::PseudoPod::DOM::Corpus;
use Pod::PseudoPod::DOM::App qw( open_fh );
sub process_files_with_output
{
my ($role, @files) = process_args( @_ );
my @docs;
my %anchors;
my $corpus = Pod::PseudoPod::DOM::Corpus->new;
for my $file (@files)
{
my ($source, $output) = @$file;
my $parser = Pod::PseudoPod::DOM->new(
formatter_role => $role,
formatter_args => { add_body_tags => 1, anchors => \%anchors },
filename => $output,
);
my $HTMLOUT = open_fh( $output, '>' );
$parser->output_fh($HTMLOUT);
$parser->no_errata_section(1); # don't put errors in doc output
$parser->complain_stderr(1); # output errors on STDERR instead
die "Unable to open file ($source)\n" unless -e $source;
$parser->parse_file( open_fh( $source ) );
$corpus->add_document( $parser->get_document, $parser );
}
$corpus->write_documents;
$corpus->write_index;
$corpus->write_toc;
}
sub process_args
{
my @files;
my $role = 'html';
my %roles = ( html => 'HTML', epub => 'EPUB' );
for my $arg (@_)
{
if ($arg =~ /^--(\w+)=(\w+)/)
{
if ($1 eq 'role')
{
$role = exists $roles{$2} ? $roles{$2} : $role;
};
}
else
{
push @files, $arg;
}
}
return "Pod::PseudoPod::DOM::Role::$role", @files;
}
1;
Jump to Line
Something went wrong with that request. Please try again.