App-Pod2Epub
view release on metacpan or search on metacpan
Revision history for App-Pod2Epub
0.05 September 2 2012
! Removed overridden Pod::Simple::XHTML start_L() function.
This method is now handled correctly in Pod::Simple::XHTML
for versions >= 3.15. RT #69413.
0.04 August 24 2010
! Increased Pod::Simple dependency to 3.06 to ensure access to
Pod::Simple::XHTML.
bin/pod2epub view on Meta::CPAN
open $in_fh, '<', $in_filename
or die "Couldn't open $in_filename: $!\n";
}
else {
$in_fh = *STDIN;
}
if ( $xhtml_only ) {
# Output the XHTML doc only. This is mainly use for debugging
# the XHTML output.
if ( $out_filename ) {
open $xhtml_fh, '>', $out_filename
or die "Couldn't open $out_filename: $!\n";
}
}
else {
# Write the XHTML to a temp file. This will be added to the ePub doc.
( $xhtml_fh, $xhtml_filename ) = tempfile();
}
# Parse the Pod doc and output the XHTML file.
$parser->output_fh( $xhtml_fh );
$parser->parse_file( $in_fh );
close $xhtml_fh;
close $in_fh;
# If using the --xhtml-only option exit before creating an ePub doc.
return if $xhtml_only;
bin/pod2epub view on Meta::CPAN
}
# Add cover metadata for iBooks.
my $cover_id = $epub->copy_image( $cover_filename, 'images/cover.jpg' );
$epub->add_meta_item( 'cover', $cover_id );
# Add an additional cover page for other eBook readers.
my $cover_xhtml =
qq[<?xml version="1.0" encoding="UTF-8"?>\n]
. qq[<!DOCTYPE html\n]
. qq[ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"\n]
. qq[ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n\n]
. qq[<html xmlns="http://www.w3.org/1999/xhtml">\n]
. qq[<head>\n]
. qq[<title></title>\n]
. qq[<meta http-equiv="Content-Type" ]
. qq[content="text/html; charset=iso-8859-1"/>\n]
. qq[<style type="text/css"> img { max-width: 100%; }</style>\n]
. qq[</head>\n]
. qq[<body>\n]
. qq[ <img alt="" src="../images/cover.jpg" />\n]
bin/pod2epub view on Meta::CPAN
Print a brief help message and exit.
=back
=head1 SECONDARY OPTIONS
=over 4
=item B<-x or --xhtml-only>
Output the Pod documentation in XHTML format without converting it ePub. This can be useful for debugging XHTML errors.
=item B<-l or --language>
Add the ePub book language. Defaults to "en".
=item B<-m or --man>
Prints the manpage and exit.
=item B<-v or --version>
bin/pod2epub view on Meta::CPAN
=item *
Parse the document title from the Pod doc, where possible.
=item *
Parse the author name from the Pod doc, where possible.
=item *
Add an XHTML validation option.
=item *
Add controls and defaults for internal links.
=back
=head1 AUTHOR
John McNamara jmcnamara@cpan.org
lib/App/Pod2Epub.pm view on Meta::CPAN
#
# new()
#
# Simple constructor inheriting from Pod::Simple::XHTML.
#
sub new {
my $class = shift;
my $self = Pod::Simple::XHTML->new( @_ );
# Don't generate an XHTML index. We will use the ePub TOC instead.
$self->index(0);
# Add the default XHTML headers.
$self->html_header(
qq{<?xml version="1.0" encoding="UTF-8"?>\n}
. qq{<!DOCTYPE html\n}
. qq{ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"\n}
. qq{ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n}
. qq{\n}
. qq{<html xmlns="http://www.w3.org/1999/xhtml">\n}
. qq{<head>\n}
. qq{<title></title>\n}
. qq{<meta http-equiv="Content-Type" }
. qq{content="text/html; charset=iso-8859-1"/>\n}
. qq{<link rel="stylesheet" href="../styles/style.css" }
. qq{type="text/css"/>\n}
. qq{</head>\n}
lib/App/Pod2Epub.pm view on Meta::CPAN
This module is used for converting Pod documents to ePub eBooks. The output eBook can be read on a variety of hardware and software eBook readers.
Pod is Perl's I<Plain Old Documentation> format, see L<http://perldoc.perl.org/perlpod.html>. EPub is an eBook format, see L<http://en.wikipedia.org/wiki/Epub>.
This module comes with a L<pod2epub> utility that will convert Pod to an ePub eBook.
=head1 SYNOPSIS
To create a simple filter to convert Pod to an XHTML format suitable for inclusion in an ePub eBook.
#!/usr/bin/perl -w
use strict;
use App::Pod2Epub;
my $parser = App::Pod2Epub->new();
if (defined $ARGV[0]) {
lib/App/Pod2Epub.pm view on Meta::CPAN
To convert Pod to ePub using the installed C<pod2epub> utility:
pod2epub some_module.pm -o some_module.epub
=head1 USING THIS MODULE
At the moment this module isn't very useful on its own. It is mainly in existence as a backend for C<pod2epub>.
It provides a framework to convert Pod documents to an XHTML format suitable for inclusion in an ePub eBook. The ePub creation is handled by L<EBook::EPUB> in C<pod2epub>. Future versions will move that functionality into this module so that it has a...
=head1 METHODS
=head2 new()
The C<new> method is used to create a new C<App::Pod2Epub> object.
=head2 Other methods
C<App::Pod2Epub> inherits all of the methods of its parent modules C<Pod::Simple> and C<Pod::Simple::XHTML>. See L<Pod::Simple> for more details if you need finer control over the output of this module.
( run in 0.849 second using v1.01-cache-2.11-cpan-49f99fa48dc )