Pod-L10N

 view release on metacpan or  search on metacpan

lib/Pod/L10N/Html.pm  view on Meta::CPAN


Its API is fully compatible with L<Pod::Html>.

If input files support L<Pod::L10N::Format> extended format,
Pod::L10N::Html do some more works to print translated text pretty well.

=head1 ADDITIONAL FEATURES

Additional features from L<Pod::Html> 1.33 are:

=over

=item *

Support L<Pod::L10N::Format> extended format.

=back

=head1 FUNCTIONS

=head2 pod2htmll10n

    pod2htmll10n("pod2htmll10n",
             "--podpath=lib:ext:pod:vms",
             "--podroot=/usr/src/perl",
             "--htmlroot=/perl/nmanual",
             "--recurse",
             "--infile=foo.pod",
             "--outfile=/perl/nmanual/foo.html");

See L<Pod::Html> for details.

=head1 ENVIRONMENT

Uses C<$Config{pod2html}> to setup default options.

=head1 AUTHOR

C<Pod::L10N::Html> is based on L<Pod::Html> Version 1.33 written by
Marc Green, E<lt>marcgreen@cpan.orgE<gt>. 

Modification to C<Pod::L10N::Html> is written by SHIRAKATA Kentaro,
E<lt>argrath@cpan.orgE<gt>.

=head1 SEE ALSO

L<perlpod>, L<Pod::Html>, L<Pod::L10N::Format>

=head1 COPYRIGHT

This program is distributed under the Artistic License.

=cut

sub new {
    my $class = shift;
    return bless {}, $class;
}

sub pod2htmll10n {
    local(@ARGV) = @_;
    local $_;

    my $self = Pod::L10N::Html->new();
    $self->init_globals();

    my $opts = process_command_line;
    $self->process_options($opts);

    $self->refine_globals();

    # load or generate/cache %Pages
    unless ($self->get_cache()) {
        # generate %Pages
        #%Pages = $self->generate_cache(\%Pages);
        $self->generate_cache($self->{Pages});
    }
    my $input   = $self->identify_input();

    my ($lcontent, $lencoding) = arrange($self->{Podfile});
    if(!defined $lencoding){
        $lencoding = 'utf-8';
    }
    $self->{Lcontent} = $lcontent;
    $self->{Lencoding} = $lencoding;

    my $podtree = $self->parse_input_for_podtree($input);
    $self->set_Title_from_podtree($podtree);

    # set options for the HTML generator
    my     $parser = Pod::L10N::Html::LocalPodLinks->new();
    $parser->codes_in_verbatim(0);
    $parser->anchor_items(1); # the old Pod::Html always did
    $parser->backlink($self->{Backlink}); # linkify =head1 directives
    $parser->force_title($self->{Title});
    $parser->htmldir($self->{Htmldir});
    $parser->htmlfileurl($self->{Htmlfileurl});
    $parser->htmlroot($self->{Htmlroot});
    $parser->index($self->{Doindex});
    # still need as parse twice
    $parser->no_errata_section(!$self->{Poderrors}); # note the inverse
    $parser->output_string(\$self->{output}); # written to file later
    #$parser->pages(\%Pages);
    $parser->pages($self->{Pages});
    $parser->quiet($self->{Quiet});
    $parser->verbose($self->{Verbose});

#    $parser->html_charset('UTF-8');
    $parser->html_encode_chars('&<>">');
#    $parser->html_header_tags('');

    $parser = $self->refine_parser($parser);
    $self->feed_tree_to_parser($parser, $podtree);
    $self->write_file();
}

sub init_globals {
    my $self = shift;
    $self->{Cachedir} = ".";            # The directory to which directory caches
                                        #   will be written.



( run in 2.842 seconds using v1.01-cache-2.11-cpan-b301d465b3d )