allow use of the new template system from static pages
[bse.git] / site / docs / makedocs
CommitLineData
41b9d8ec
TC
1#!perl -w
2# Build HTML files from .pod and .pm files
3# I'd love to do this as a makefile, but the targets have colons, which
4# make hates (GNU make, anyway)
5use strict;
6
7my @targets =
8 (
de193691 9 'access.html',
599fe373 10 'Article.html',
41b9d8ec 11 'bse.html',
599fe373
TC
12 'BSE::TB::SiteCommon.html',
13 'BSE::TB::TagOwner.html',
41b9d8ec
TC
14 'bugs.html',
15 'templates.html',
16 'Generate.html',
17 'Generate::Article.html',
18 'Generate::Product.html',
19 'Generate::Catalog.html',
58f0ca94 20 'Squirrel::Template.html',
41b9d8ec
TC
21 'search.html',
22 'shop.html',
23 'add.html',
24 'shopadmin.html',
b10912b4 25 'TODO.html',
edc5d096 26 'config.html',
16901a2a 27 'dynamic.html',
6e3d2da5
TC
28 'secure.html',
29 'gen.html',
30 'upgrade_mysql.html',
31 'makedocs.html',
64fa5b18 32 'standard.html',
4175638b
TC
33 'affiliate.html',
34 'BSE::UI::Affiliate.html',
d7538448 35 'future_plans.html',
ab2cd916 36 'thumbnails.html',
a5e3fc4b 37 'formmail.html',
e806c5d8 38 'userupdate.html',
7320899a 39 'siteusers.html',
e63c3728 40 'storages.html',
41b9d8ec
TC
41 );
42
43my @exts = qw(.pod .pm .pl);
6e3d2da5 44push(@exts, ''); # I should have put a .pl on makedocs
41b9d8ec
TC
45
46my @search =
47 (
fa304705 48 './',
41b9d8ec
TC
49 '../cgi-bin/',
50 '../cgi-bin/modules/',
51 '../cgi-bin/admin/',
6e3d2da5 52 '../util/',
41b9d8ec
TC
53 );
54
55use Getopt::Std;
56my %opts;
57getopts("hn", \%opts);
58$opts{h} and usage();
59++$|;
60for my $target (@targets) {
61 # try to find the source
62 my $base = $target;
63 $base =~ s!::!/!g;
64 my $source;
65 SEARCH: for my $ext (@exts) {
66 (my $file = $base) =~ s/\.html$/$ext/;
67 for my $dir (@search) {
68 if (-e $dir.$file) {
69 $source = $dir.$file;
70 last SEARCH;
71 }
72 }
73 }
74 $source or die "Cannot find source for $target\n";
75 if (!-e $target || -M $target > -M $source) {
76 my $cmd = "pod2html --infile=$source --outfile=$target --htmlroot=.";
fa304705 77 $cmd .= " --podpath=".join(":", @search);
41b9d8ec
TC
78 print $cmd,"\n";
79 if (!$opts{n} and system $cmd) {
80 die "** makedocs failed\n";
81 }
82 }
83}
84
85# remove the pod2html caches - I don't care much if this fails
86unlink 'pod2html-dircache', 'pod2html-itemcache';
87
88sub usage {
89 print <<EOS;
90Usage: $0 - make the documentation files
91 $0 -n - report what would be done to make the documentation files
92 $0 -h - produce this message
93EOS
94 exit;
95}
6e3d2da5
TC
96
97__END__
98
99=head1 NAME
100
101makedocs - produces HTML documentation from POD for BSE
102
103=head1 SYNOPSIS
104
105 perl makedocs [-nh]
106
107=head1 DESCRIPTION
108
109Used during the BSE distribution build process to product HTML
110versions of the POD documentation included with various parts of BSE.
111
112Searches in various standard places for source pod/pl/pm files and
113converts them into HTML.
114
115=head1 OPTIONS
116
117C<makedocs> is typically run without options.
118
119=over
120
121=item -n
122
123Report the actions that would be taken without actually performing the
124conversions.
125
126=item -h
127
128Produces a brief usage message.
129
130=back
131
132=head1 BUGS
133
134We're keeping a dependency list in this file, it should be elsewhere,
135maybe we could parse MANIFEST.
136
137=head1 AUTHOR
138
139Tony Cook <tony@develop-help.com>
140
141=head1 REVISION
142
143$Revision$
144
145=head1 SEE ALSO
146
147bse
148
149=cut
150