3
##########################################
5
## for documentation ##
7
#### % perldoc pod2hpp ####
8
### to get the built-in ###
11
##########################################
16
# I was told that it doesn't run under perl5.004 mainly because of
17
# s/XXX/YYY/ for @foo 5.005-isms. It's about a time you should upgrade
18
# to 5.005 :) 5.6 is out!!!
21
# allow to execute this script from any path and not only from the current
23
#use FindBin qw($Bin);
26
#my $orig_dir = Cwd::cwd;
32
my $config_file = pop @ARGV;
33
croak ("!!! Target configuration file is missing\n!!! Must specify the configuration file as a last argument\n"), exit
34
unless -e $config_file and -r _;
35
use Pod::HtmlPsPdf::Config ();
36
Pod::HtmlPsPdf::Config::set_config_file($config_file);
41
use Pod::HtmlPsPdf::RunTime ();
42
use Pod::HtmlPsPdf::Book ();
43
my $config = Pod::HtmlPsPdf::Config->new();
45
######################################
46
### Init Command Line Arguments
47
######################################
49
# set defaults if no options given
50
my $verbose = 0; # verbose?
51
my $podify_items = 0; # podify pseudo-pod (s/^* /=item */)
52
my $split_html = 0; # create the splitted html version
53
my $make_tgz = 0; # create the rel and bin+src archives?
54
my $generate_ps = 0; # generate PS file
55
my $generate_pdf = 0; # generate PDF file
56
my $rebuild_all = 0; # ignore the timestamp of ../src/.last_modified
57
my $print_anchors = 0; # print the available anchors
58
my $validate_links = 0; # validate %links_to_check against %valid_anchors
59
my $makefile_mode = 0; # executed from Makefile (forces rebuild, no
60
# PS/PDF file, no tgz archive created!)
63
######################################
64
### Process Command Line Arguments
65
######################################
68
getopts('hvtpdfalmise', \%opts);
72
if (keys %opts) { # options given
73
$verbose = $opts{v} || 0;
74
$podify_items = $opts{i} || 0;
75
$split_html = $opts{s} || 0;
76
$make_tgz = $opts{t} || 0;
77
$generate_ps = $opts{p} || 0;
78
$generate_pdf = $opts{d} || 0;
79
$rebuild_all = $opts{f} || 0; # force
80
$print_anchors = $opts{a} || 0;
81
$validate_links = $opts{l} || 0;
82
$slides_mode = $opts{e} || 0;
83
$makefile_mode = $opts{m} || 0;
96
# in the slides mode we turn preprocessing automatically to be on
101
# we need a PS version in order to create a pdf
102
$generate_ps = 1 if $generate_pdf;
104
# verify the ability to create PS version
105
$generate_ps = Pod::HtmlPsPdf::RunTime::can_create_ps if $generate_ps;
107
# verify the ability to create PDF version
108
$generate_pdf = Pod::HtmlPsPdf::RunTime::can_create_pdf if $generate_pdf;
110
# we cannot create PDF if we cannot generate PS
111
$generate_pdf = 0 unless $generate_ps;
113
# if there is no toc_file we cannot produce correct internal links,
114
# therefore we force this option.
115
my $toc_file = $config->get_param('toc_file');
117
print "!!! No $toc_file was found, forcing complete rebuild\n"
118
unless -e $toc_file or $rebuild_all;
123
podify_items => $podify_items,
124
split_html => $split_html,
125
make_tgz => $make_tgz,
126
generate_ps => $generate_ps,
127
generate_pdf => $generate_pdf,
128
rebuild_all => $rebuild_all,
129
print_anchors => $print_anchors,
130
validate_links => $validate_links,
131
makefile_mode => $makefile_mode,
132
slides_mode => $slides_mode,
135
# make the runtime options available to other packages
136
Pod::HtmlPsPdf::RunTime::set_runtime_options(\%options);
138
######################################
140
######################################
142
# create the book object
143
my $book = Pod::HtmlPsPdf::Book->new();
145
# process the source files and convert them into html files write
146
# two copies of the files -- one as normal html using the html
147
# teplates, and the other again in html but using the PS templates,
148
# since generally these don't need TOC and all the other stuff,
149
# html2ps generates this for us automatically.
150
$book->create_html_version();
152
# Validate pod's L<> links
153
$book->validate_links if $validate_links;
155
# when there are broken links reported by validate_links() we need
156
# to know the correct links as rendered by pod2html converter. This
157
# will print all the available achors.
158
$book->print_anchors if $print_anchors;
160
# generate the PS version of the book
161
$book->create_ps_version if $generate_ps;
163
# generate the PDF version of the book
164
$book->create_pdf_version if $generate_pdf;
166
# generate the Split HTML version of the book
167
$book->create_split_html_version if $split_html;
170
$book->make_tar_gz() if $make_tgz;
172
# do the cleanup chores
175
# go back to where you have from
178
######################################
180
######################################
186
pod2hpp [options] config_file_location
192
-i podify pseudo-pod items (s/^* /=item */)
193
-s create the splitted html version
197
-f force a complete rebuild
198
-a print available hypertext anchors
199
-l do hypertext links validation
200
-e slides mode (for presentations)
201
-m executed from Makefile (forces rebuild,
217
pod2hpp - a script that does documentation projects building in HTML, PS and PDF formats
221
pod2hpp [options] configuration_file_location
225
See C<Pod::HtmlPsPdf>
229
Stas Bekman <stas@stason.org>
233
This program is distributed under the Artistic License, like the Perl