| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Pod::PseudoPod::Book::Command::create; |
|
2
|
|
|
|
|
|
|
# ABSTRACT: command module for C<ppbook create> |
|
3
|
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
2139
|
use strict; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
71
|
|
|
5
|
2
|
|
|
2
|
|
13
|
use warnings; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
67
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
11
|
use parent 'Pod::PseudoPod::Book::Command'; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
14
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
145
|
use File::Path 'make_path'; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
170
|
|
|
10
|
2
|
|
|
2
|
|
15
|
use File::Spec::Functions qw( catdir catfile ); |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
1038
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub execute |
|
13
|
|
|
|
|
|
|
{ |
|
14
|
0
|
|
|
0
|
1
|
|
my ($self, $opt, $args) = @_; |
|
15
|
|
|
|
|
|
|
|
|
16
|
0
|
0
|
|
|
|
|
die "No book name given\n" unless @$args == 1; |
|
17
|
0
|
|
|
|
|
|
my $book_dir = $args->[0]; |
|
18
|
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
$self->make_paths( $book_dir ); |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# the previous line implies the following, but it's idempotent |
|
22
|
0
|
|
|
|
|
|
$self->make_conf_file( $book_dir ); |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub make_paths |
|
26
|
|
|
|
|
|
|
{ |
|
27
|
0
|
|
|
0
|
0
|
|
my ($self, $book_dir) = @_; |
|
28
|
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
make_path( $book_dir ); |
|
30
|
0
|
|
|
|
|
|
my $conf = $self->make_conf_file( $book_dir ); |
|
31
|
0
|
|
|
|
|
|
my $layout_conf = $conf->{layout}; |
|
32
|
0
|
|
|
|
|
|
my $dir = $layout_conf->{subchapter_directory}; |
|
33
|
0
|
|
|
|
|
|
my $builddir = $layout_conf->{chapter_build_directory}; |
|
34
|
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
make_path map { catdir( $book_dir, $_ ) } |
|
36
|
0
|
|
|
|
|
|
$dir, 'images', map { catdir( 'build', $_ ) } |
|
|
0
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
$builddir, qw( latex html epub pdf ); |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub make_conf_file |
|
41
|
|
|
|
|
|
|
{ |
|
42
|
0
|
|
|
0
|
0
|
|
my ($self, $conf_dir) = @_; |
|
43
|
0
|
|
|
|
|
|
my $conf_file = catfile( $conf_dir, 'book.conf' ); |
|
44
|
0
|
|
|
|
|
|
my $conf = Config::Tiny->read( $conf_file ); |
|
45
|
0
|
0
|
|
|
|
|
return $conf if $conf; |
|
46
|
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
my $config = Config::Tiny->new; |
|
48
|
|
|
|
|
|
|
$config->{_}{rootproperty} = |
|
49
|
|
|
|
|
|
|
{ |
|
50
|
0
|
|
|
|
|
|
help => 'See perldoc Pod::PseudoPod::Book::Conf for details', |
|
51
|
|
|
|
|
|
|
}; |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
$config->{book} = |
|
54
|
|
|
|
|
|
|
{ |
|
55
|
0
|
|
|
|
|
|
title => '', |
|
56
|
|
|
|
|
|
|
language => 'en', |
|
57
|
|
|
|
|
|
|
cover_image => '', |
|
58
|
|
|
|
|
|
|
author_name => '', |
|
59
|
|
|
|
|
|
|
copyright_year => (localtime)[5] + 1900, |
|
60
|
|
|
|
|
|
|
filename_template => 'book', |
|
61
|
|
|
|
|
|
|
subtitle => '', |
|
62
|
|
|
|
|
|
|
build_index => 1, |
|
63
|
|
|
|
|
|
|
build_credits => 0, |
|
64
|
|
|
|
|
|
|
ISBN10 => '', |
|
65
|
|
|
|
|
|
|
ISBN13 => '', |
|
66
|
|
|
|
|
|
|
}; |
|
67
|
|
|
|
|
|
|
$config->{layout} = |
|
68
|
|
|
|
|
|
|
{ |
|
69
|
0
|
|
|
|
|
|
chapter_name_prefix => 'chapter', |
|
70
|
|
|
|
|
|
|
subchapter_directory => 'sections', |
|
71
|
|
|
|
|
|
|
chapter_build_directory => 'pod', |
|
72
|
|
|
|
|
|
|
}; |
|
73
|
|
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
|
$config->write( $conf_file ); |
|
75
|
0
|
|
|
|
|
|
print "Please edit '$conf_file' to configure your book\n"; |
|
76
|
0
|
|
|
|
|
|
print "See perldoc Pod::PseudoPod::Book::Conf for details\n"; |
|
77
|
|
|
|
|
|
|
|
|
78
|
0
|
|
|
|
|
|
return $config; |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
1; |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
__END__ |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=pod |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=encoding UTF-8 |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 NAME |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Pod::PseudoPod::Book::Command::create - command module for C<ppbook create> |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 VERSION |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
version 1.20210620.2051 |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 AUTHOR |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
chromatic <chromatic@wgz.org> |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
This software is copyright (c) 2011 by chromatic. |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
106
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=cut |