line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Pod::PseudoPod::Book::Command::buildpdf; |
2
|
|
|
|
|
|
|
# ABSTRACT: command module for C<ppbook buildpdf> |
3
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
2313
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
75
|
|
5
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
76
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
12
|
use parent 'Pod::PseudoPod::Book::Command'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
21
|
|
8
|
2
|
|
|
2
|
|
154
|
use Path::Class; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
134
|
|
9
|
2
|
|
|
2
|
|
1095
|
use File::chdir; |
|
2
|
|
|
|
|
4174
|
|
|
2
|
|
|
|
|
253
|
|
10
|
2
|
|
|
2
|
|
22
|
use File::Copy; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
839
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub execute |
13
|
|
|
|
|
|
|
{ |
14
|
0
|
|
|
0
|
1
|
|
my ($self, $opt, $args) = @_; |
15
|
0
|
|
|
|
|
|
my %sizes = map { $_ => 1 } qw( letter a4 6x9 5x8 ); |
|
0
|
|
|
|
|
|
|
16
|
0
|
|
|
|
|
|
my $conf = $self->config; |
17
|
0
|
|
|
|
|
|
my $size = 'letter'; |
18
|
0
|
|
|
|
|
|
my $latex_dir = dir(qw( build latex )); |
19
|
0
|
|
|
|
|
|
my $pdf_dir = $latex_dir->parent->subdir( 'pdf' )->absolute; |
20
|
0
|
|
|
|
|
|
my $filename_template = $conf->{book}{filename_template}; |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
|
for my $arg (@$args) |
23
|
|
|
|
|
|
|
{ |
24
|
0
|
0
|
|
|
|
|
next unless exists $sizes{$arg}; |
25
|
0
|
|
|
|
|
|
$size = $arg; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
push @CWD, "$latex_dir"; |
29
|
0
|
|
|
|
|
|
my $tex_file = $filename_template . '_' . $size . '.tex'; |
30
|
0
|
|
|
|
|
|
my $idx_file = $filename_template . '_' . $size . '.idx'; |
31
|
0
|
|
|
|
|
|
my $ind_file = $filename_template . '_' . $size . '.ind'; |
32
|
0
|
|
|
|
|
|
unlink $idx_file; |
33
|
|
|
|
|
|
|
|
34
|
0
|
0
|
|
|
|
|
die "No LaTeX file found at '$tex_file'\n" unless -e $tex_file; |
35
|
0
|
|
|
|
|
|
my @pdf_args = ( pdflatex => "-output-directory=$pdf_dir", $tex_file ); |
36
|
0
|
0
|
|
|
|
|
die "pdflatex failed for $tex_file: $!" if system @pdf_args; |
37
|
|
|
|
|
|
|
|
38
|
0
|
0
|
|
|
|
|
if ($conf->{book}{build_index}) |
39
|
|
|
|
|
|
|
{ |
40
|
0
|
|
|
|
|
|
copy "$pdf_dir/$idx_file", $idx_file; |
41
|
0
|
|
|
|
|
|
my @idx_args = ( makeindex => $idx_file, $idx_file ); |
42
|
0
|
0
|
|
|
|
|
die "makeindex failed for $pdf_dir/$idx_file: $!" if system @idx_args; |
43
|
0
|
0
|
|
|
|
|
die "pdflatex failed for $tex_file: $!" if system @pdf_args; |
44
|
0
|
|
|
|
|
|
unlink $idx_file; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
pop @CWD; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
__END__ |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=pod |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=encoding UTF-8 |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 NAME |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Pod::PseudoPod::Book::Command::buildpdf - command module for C<ppbook buildpdf> |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 VERSION |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
version 1.20210620.2051 |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 AUTHOR |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
chromatic <chromatic@wgz.org> |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
This software is copyright (c) 2011 by chromatic. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
75
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=cut |