App-MakeEPUB

 view release on metacpan or  search on metacpan

lib/App/MakeEPUB.pm  view on Meta::CPAN

} # _tocncf_navPoints_from_array()

1; # Magic true value required at end of module
__END__

=head1 NAME

App::MakeEPUB - Create an EPUB ebook

=head1 VERSION

This document describes App::MakeEPUB version v0.3.2

=head1 SYNOPSIS

    use App::MakeEPUB;

    my $epub = App::MakeEPUB->new( { epubdir => $epubdir } );

    $epub->add_metadata( { identifier => $identifier,
                           language   => $language,
                           title      => $title,
                           creator    => $creator,
                           publisher  => $publisher,
                           rights     => $rights,
                           cover      => $cover, } );

    $epub->write_epub();

=for author to fill in:
    Brief code example(s) here showing commonest usage(s).
    This section will be as far as many users bother reading
    so make it as educational and exeplary as possible.
  
  
=head1 DESCRIPTION

=for author to fill in:
    Write a full description of the module and its features here.
    Use subsections (=head2, =head3) as appropriate.

This library is used by the script make-epub to create an ebook in EPUB
format.

=head1 INTERFACE 

=head2 new()

    my $epub = App::MakeEPUB->new( {
        epubdir     => $epubdir,
        level2      => $level2,
        spine_order => $spine_order,
    } );

Create an App::MakeEPUB object;

The named argument I<epubdir> is the path to the directory containing the
files for the ebook.

The named argument I<spine_order> takes a string containing the names of the
XHTML files in spine order as a comma separated list. If it is missing the
names are sorted by alphabet.

The named argument I<level2> takes a string containing instructions for
HTML::Element->look_down() on how to find the text and id for the level 2
navPoints in the file I<toc.ncf>. It takes a string like
'attr1:val1,attr2:val2,...' and translates it into

  HTML::Element->look_down( { attr1 =>  val1, attr2 => val2, ... } );

The content for the navPoint is taken from the first C<< <a> >> tag inside
each HTML::Element found by I<look_down()> and containing an attribute I<id>.
The text for the navPoint is taken from the whole text inside each
HTML::Element found.

If the argument I<level2> is missing, '_tag:span,class:h2' is taken. This
will take the navPoints from all spans looking roughly like

  <span class="h2"><a id="navid">some text</a></span>

and translates them to something like

  <navPoint id="navpoint-id" playOrder="order">
    <navLabel><text>some text</text></navLabel>
    <content src="filename#navid" />
  </navPoint>

=head2 add_metadata()

    $epub->add_metadata( { identifier => $identifier,
                           language   => $language,
                           title      => $title,
                           creator    => $creator,
                           publisher  => $publisher,
                           rights     => $rights,
                           cover      => $cover, } );

Add Metadata to the EPUB. 

The following keys are accepted:

=over 4

=item identifier, language, title, creator, publisher, rights

These go into the C<< <metadata> >> section of the I<content.opf> as
C<< <dc:identifier...> >>, C<< <dc:language...> >> and so on.

=item cover

This goes into die C<< <metadata> >> section of the I<content.opf> as
C<< <reference type="cover" ...> >>.

=back

=head2 write_epub()

    $epub->write_epub();
    $epub->write_epub($filename);

This method writes the epub.



( run in 0.512 second using v1.01-cache-2.11-cpan-e1769b4cff6 )