line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Pod::Simple::HTMLBatch; |
2
|
2
|
|
|
2
|
|
1844
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
110
|
|
3
|
|
|
|
|
|
|
our $VERSION = '3.45'; |
4
|
|
|
|
|
|
|
our @ISA = (); # Yup, we're NOT a subclass of Pod::Simple::HTML! |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# TODO: nocontents stylesheets. Strike some of the color variations? |
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
613
|
use Pod::Simple::HTML (); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
68
|
|
9
|
2
|
|
|
2
|
|
36
|
BEGIN {*esc = \&Pod::Simple::HTML::esc } |
10
|
2
|
|
|
2
|
|
16
|
use File::Spec (); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
31
|
|
11
|
|
|
|
|
|
|
|
12
|
2
|
|
|
2
|
|
1337
|
use Pod::Simple::Search; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
182
|
|
13
|
|
|
|
|
|
|
our $SEARCH_CLASS ||= 'Pod::Simple::Search'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
BEGIN { |
16
|
2
|
50
|
|
2
|
|
17
|
if(defined &DEBUG) { } # no-op |
|
|
50
|
|
|
|
|
|
17
|
2
|
|
|
|
|
11529
|
elsif( defined &Pod::Simple::DEBUG ) { *DEBUG = \&Pod::Simple::DEBUG } |
18
|
0
|
|
|
|
|
0
|
else { *DEBUG = sub () {0}; } |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
our $SLEEPY; |
22
|
|
|
|
|
|
|
$SLEEPY = 1 if !defined $SLEEPY and $^O =~ /mswin|mac/i; |
23
|
|
|
|
|
|
|
# flag to occasionally sleep for $SLEEPY - 1 seconds. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
our $HTML_RENDER_CLASS ||= "Pod::Simple::HTML"; |
26
|
|
|
|
|
|
|
our $HTML_EXTENSION; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# |
29
|
|
|
|
|
|
|
# Methods beginning with "_" are particularly internal and possibly ugly. |
30
|
|
|
|
|
|
|
# |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
Pod::Simple::_accessorize( __PACKAGE__, |
33
|
|
|
|
|
|
|
'verbose', # how verbose to be during batch conversion |
34
|
|
|
|
|
|
|
'html_render_class', # what class to use to render |
35
|
|
|
|
|
|
|
'search_class', # what to use to search for POD documents |
36
|
|
|
|
|
|
|
'contents_file', # If set, should be the name of a file (in current directory) |
37
|
|
|
|
|
|
|
# to write the list of all modules to |
38
|
|
|
|
|
|
|
'index', # will set $htmlpage->index(...) to this (true or false) |
39
|
|
|
|
|
|
|
'progress', # progress object |
40
|
|
|
|
|
|
|
'contents_page_start', 'contents_page_end', |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
'css_flurry', '_css_wad', 'javascript_flurry', '_javascript_wad', |
43
|
|
|
|
|
|
|
'no_contents_links', # set to true to suppress automatic adding of << links. |
44
|
|
|
|
|
|
|
'_contents', |
45
|
|
|
|
|
|
|
); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
48
|
|
|
|
|
|
|
# Just so we can run from the command line more easily |
49
|
|
|
|
|
|
|
sub go { |
50
|
0
|
0
|
|
0
|
0
|
0
|
@ARGV == 2 or die sprintf( |
51
|
|
|
|
|
|
|
"Usage: perl -M%s -e %s:go indirs outdir\n (or use \"\@INC\" for indirs)\n", |
52
|
|
|
|
|
|
|
__PACKAGE__, __PACKAGE__, |
53
|
|
|
|
|
|
|
); |
54
|
|
|
|
|
|
|
|
55
|
0
|
0
|
0
|
|
|
0
|
if(defined($ARGV[1]) and length($ARGV[1])) { |
56
|
0
|
|
|
|
|
0
|
my $d = $ARGV[1]; |
57
|
0
|
0
|
|
|
|
0
|
-e $d or die "I see no output directory named \"$d\"\nAborting"; |
58
|
0
|
0
|
|
|
|
0
|
-d $d or die "But \"$d\" isn't a directory!\nAborting"; |
59
|
0
|
0
|
|
|
|
0
|
-w $d or die "Directory \"$d\" isn't writeable!\nAborting"; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
0
|
__PACKAGE__->batch_convert(@ARGV); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub new { |
68
|
1
|
|
33
|
1
|
1
|
6564
|
my $new = bless {}, ref($_[0]) || $_[0]; |
69
|
1
|
|
|
|
|
45
|
$new->html_render_class($HTML_RENDER_CLASS); |
70
|
1
|
|
|
|
|
19
|
$new->search_class($SEARCH_CLASS); |
71
|
1
|
|
|
|
|
13
|
$new->verbose(1 + DEBUG); |
72
|
1
|
|
|
|
|
26
|
$new->_contents([]); |
73
|
|
|
|
|
|
|
|
74
|
1
|
|
|
|
|
14
|
$new->index(1); |
75
|
|
|
|
|
|
|
|
76
|
1
|
|
|
|
|
41
|
$new-> _css_wad([]); $new->css_flurry(1); |
|
1
|
|
|
|
|
12
|
|
77
|
1
|
|
|
|
|
19
|
$new->_javascript_wad([]); $new->javascript_flurry(1); |
|
1
|
|
|
|
|
302
|
|
78
|
|
|
|
|
|
|
|
79
|
1
|
|
33
|
|
|
32
|
$new->contents_file( |
80
|
|
|
|
|
|
|
'index' . ($HTML_EXTENSION || $Pod::Simple::HTML::HTML_EXTENSION) |
81
|
|
|
|
|
|
|
); |
82
|
|
|
|
|
|
|
|
83
|
1
|
|
|
|
|
26
|
$new->contents_page_start( join "\n", grep $_, |
84
|
|
|
|
|
|
|
$Pod::Simple::HTML::Doctype_decl, |
85
|
|
|
|
|
|
|
"", |
86
|
|
|
|
|
|
|
"Perl Documentation", |
87
|
|
|
|
|
|
|
$Pod::Simple::HTML::Content_decl, |
88
|
|
|
|
|
|
|
"", |
89
|
|
|
|
|
|
|
"\n\nPerl Documentation\n" |
90
|
|
|
|
|
|
|
); # override if you need a different title |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
$new->contents_page_end( sprintf( |
94
|
|
|
|
|
|
|
"\n\n\n\n\n", |
95
|
|
|
|
|
|
|
esc( |
96
|
|
|
|
|
|
|
ref($new), |
97
|
|
|
|
|
|
|
eval {$new->VERSION} || $VERSION, |
98
|
1
|
|
33
|
|
|
4
|
$], scalar(gmtime($ENV{SOURCE_DATE_EPOCH} || time)), |
|
|
|
33
|
|
|
|
|
99
|
|
|
|
|
|
|
))); |
100
|
|
|
|
|
|
|
|
101
|
1
|
|
|
|
|
5
|
return $new; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub muse { |
107
|
10
|
|
|
10
|
0
|
27
|
my $self = shift; |
108
|
10
|
50
|
|
|
|
40
|
if($self->verbose) { |
109
|
0
|
|
|
|
|
0
|
print 'T+', int(time() - $self->{'_batch_start_time'}), "s: ", @_, "\n"; |
110
|
|
|
|
|
|
|
} |
111
|
10
|
|
|
|
|
21
|
return 1; |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
sub batch_convert { |
117
|
1
|
|
|
1
|
1
|
14
|
my($self, $dirs, $outdir) = @_; |
118
|
1
|
|
50
|
|
|
9
|
$self ||= __PACKAGE__; # tolerate being called as an optionless function |
119
|
1
|
50
|
|
|
|
5
|
$self = $self->new unless ref $self; # tolerate being used as a class method |
120
|
|
|
|
|
|
|
|
121
|
1
|
50
|
33
|
|
|
27
|
if(!defined($dirs) or $dirs eq '' or $dirs eq '@INC' ) { |
|
|
50
|
33
|
|
|
|
|
122
|
0
|
|
|
|
|
0
|
$dirs = ''; |
123
|
|
|
|
|
|
|
} elsif(ref $dirs) { |
124
|
|
|
|
|
|
|
# OK, it's an explicit set of dirs to scan, specified as an arrayref. |
125
|
|
|
|
|
|
|
} else { |
126
|
|
|
|
|
|
|
# OK, it's an explicit set of dirs to scan, specified as a |
127
|
|
|
|
|
|
|
# string like "/thing:/also:/whatever/perl" (":"-delim, as usual) |
128
|
|
|
|
|
|
|
# or, under MSWin, like "c:/thing;d:/also;c:/whatever/perl" (";"-delim!) |
129
|
0
|
|
|
|
|
0
|
require Config; |
130
|
0
|
|
0
|
|
|
0
|
my $ps = quotemeta( $Config::Config{'path_sep'} || ":" ); |
131
|
0
|
|
|
|
|
0
|
$dirs = [ grep length($_), split qr/$ps/, $dirs ]; |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
|
134
|
1
|
50
|
33
|
|
|
13
|
$outdir = $self->filespecsys->curdir |
135
|
|
|
|
|
|
|
unless defined $outdir and length $outdir; |
136
|
|
|
|
|
|
|
|
137
|
1
|
|
|
|
|
14
|
$self->_batch_convert_main($dirs, $outdir); |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
sub _batch_convert_main { |
143
|
1
|
|
|
1
|
|
7
|
my($self, $dirs, $outdir) = @_; |
144
|
|
|
|
|
|
|
# $dirs is either false, or an arrayref. |
145
|
|
|
|
|
|
|
# $outdir is a pathspec. |
146
|
|
|
|
|
|
|
|
147
|
1
|
|
33
|
|
|
44
|
$self->{'_batch_start_time'} ||= time(); |
148
|
|
|
|
|
|
|
|
149
|
1
|
|
|
|
|
84
|
$self->muse( "= ", scalar(localtime) ); |
150
|
1
|
|
|
|
|
7
|
$self->muse( "Starting batch conversion to \"$outdir\"" ); |
151
|
|
|
|
|
|
|
|
152
|
1
|
|
|
|
|
5
|
my $progress = $self->progress; |
153
|
1
|
50
|
33
|
|
|
27
|
if(!$progress and $self->verbose > 0 and $self->verbose() <= 5) { |
|
|
|
33
|
|
|
|
|
154
|
0
|
|
|
|
|
0
|
require Pod::Simple::Progress; |
155
|
0
|
0
|
|
|
|
0
|
$progress = Pod::Simple::Progress->new( |
|
|
0
|
|
|
|
|
|
156
|
|
|
|
|
|
|
($self->verbose < 2) ? () # Default omission-delay |
157
|
|
|
|
|
|
|
: ($self->verbose == 2) ? 1 # Reduce the omission-delay |
158
|
|
|
|
|
|
|
: 0 # Eliminate the omission-delay |
159
|
|
|
|
|
|
|
); |
160
|
0
|
|
|
|
|
0
|
$self->progress($progress); |
161
|
|
|
|
|
|
|
} |
162
|
|
|
|
|
|
|
|
163
|
1
|
50
|
|
|
|
5
|
if($dirs) { |
164
|
1
|
|
|
|
|
9
|
$self->muse(scalar(@$dirs), " dirs to scan: @$dirs"); |
165
|
|
|
|
|
|
|
} else { |
166
|
0
|
|
|
|
|
0
|
$self->muse("Scanning \@INC. This could take a minute or two."); |
167
|
|
|
|
|
|
|
} |
168
|
1
|
50
|
|
|
|
26
|
my $mod2path = $self->find_all_pods($dirs ? $dirs : ()); |
169
|
1
|
|
|
|
|
5
|
$self->muse("Done scanning."); |
170
|
|
|
|
|
|
|
|
171
|
1
|
|
|
|
|
2
|
my $total = keys %$mod2path; |
172
|
1
|
50
|
|
|
|
2
|
unless($total) { |
173
|
0
|
|
|
|
|
0
|
$self->muse("No pod found. Aborting batch conversion.\n"); |
174
|
0
|
|
|
|
|
0
|
return $self; |
175
|
|
|
|
|
|
|
} |
176
|
|
|
|
|
|
|
|
177
|
1
|
50
|
|
|
|
3
|
$progress and $progress->goal($total); |
178
|
1
|
50
|
|
|
|
4
|
$self->muse("Now converting pod files to HTML.", |
179
|
|
|
|
|
|
|
($total > 25) ? " This will take a while more." : () |
180
|
|
|
|
|
|
|
); |
181
|
|
|
|
|
|
|
|
182
|
1
|
|
|
|
|
7
|
$self->_spray_css( $outdir ); |
183
|
1
|
|
|
|
|
12
|
$self->_spray_javascript( $outdir ); |
184
|
|
|
|
|
|
|
|
185
|
1
|
|
|
|
|
4
|
$self->_do_all_batch_conversions($mod2path, $outdir); |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
$progress and $progress->done(sprintf ( |
188
|
1
|
50
|
|
|
|
3
|
"Done converting %d files.", $self->{"__batch_conv_page_count"} |
189
|
|
|
|
|
|
|
)); |
190
|
1
|
|
|
|
|
5
|
return $self->_batch_convert_finish($outdir); |
191
|
0
|
|
|
|
|
0
|
return $self; |
192
|
|
|
|
|
|
|
} |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
sub _do_all_batch_conversions { |
196
|
1
|
|
|
1
|
|
3
|
my($self, $mod2path, $outdir) = @_; |
197
|
1
|
|
|
|
|
3
|
$self->{"__batch_conv_page_count"} = 0; |
198
|
|
|
|
|
|
|
|
199
|
1
|
|
|
|
|
11
|
foreach my $module (sort {lc($a) cmp lc($b)} keys %$mod2path) { |
|
23
|
|
|
|
|
37
|
|
200
|
10
|
|
|
|
|
38
|
$self->_do_one_batch_conversion($module, $mod2path, $outdir); |
201
|
10
|
50
|
|
|
|
31
|
sleep($SLEEPY - 1) if $SLEEPY; |
202
|
|
|
|
|
|
|
} |
203
|
|
|
|
|
|
|
|
204
|
1
|
|
|
|
|
4
|
return; |
205
|
|
|
|
|
|
|
} |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
sub _batch_convert_finish { |
208
|
1
|
|
|
1
|
|
3
|
my($self, $outdir) = @_; |
209
|
1
|
|
|
|
|
11
|
$self->write_contents_file($outdir); |
210
|
1
|
|
|
|
|
12
|
$self->muse("Done with batch conversion. $$self{'__batch_conv_page_count'} files done."); |
211
|
1
|
|
|
|
|
56
|
$self->muse( "= ", scalar(localtime) ); |
212
|
1
|
50
|
|
|
|
6
|
$self->progress and $self->progress->done("All done!"); |
213
|
1
|
|
|
|
|
22
|
return; |
214
|
|
|
|
|
|
|
} |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
sub _do_one_batch_conversion { |
219
|
10
|
|
|
10
|
|
29
|
my($self, $module, $mod2path, $outdir, $outfile) = @_; |
220
|
|
|
|
|
|
|
|
221
|
10
|
|
|
|
|
13
|
my $retval; |
222
|
10
|
|
|
|
|
20
|
my $total = scalar keys %$mod2path; |
223
|
10
|
|
|
|
|
20
|
my $infile = $mod2path->{$module}; |
224
|
10
|
|
|
|
|
117
|
my @namelets = grep m/\S/, split "::", $module; |
225
|
|
|
|
|
|
|
# this can stick around in the contents LoL |
226
|
10
|
|
|
|
|
23
|
my $depth = scalar @namelets; |
227
|
10
|
50
|
|
|
|
23
|
die "Contentless thingie?! $module $infile" unless @namelets; #sanity |
228
|
|
|
|
|
|
|
|
229
|
10
|
|
33
|
|
|
32
|
$outfile ||= do { |
230
|
10
|
|
|
|
|
19
|
my @n = @namelets; |
231
|
10
|
|
33
|
|
|
45
|
$n[-1] .= $HTML_EXTENSION || $Pod::Simple::HTML::HTML_EXTENSION; |
232
|
10
|
|
|
|
|
24
|
$self->filespecsys->catfile( $outdir, @n ); |
233
|
|
|
|
|
|
|
}; |
234
|
|
|
|
|
|
|
|
235
|
10
|
|
|
|
|
29
|
my $progress = $self->progress; |
236
|
|
|
|
|
|
|
|
237
|
10
|
|
|
|
|
34
|
my $page = $self->html_render_class->new; |
238
|
10
|
|
|
|
|
17
|
if(DEBUG > 5) { |
239
|
|
|
|
|
|
|
$self->muse($self->{"__batch_conv_page_count"} + 1, "/$total: ", |
240
|
|
|
|
|
|
|
ref($page), " render ($depth) $module => $outfile"); |
241
|
0
|
|
|
|
|
0
|
} elsif(DEBUG > 2) { |
242
|
|
|
|
|
|
|
$self->muse($self->{"__batch_conv_page_count"} + 1, "/$total: $module => $outfile") |
243
|
|
|
|
|
|
|
} |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
# Give each class a chance to init the converter: |
246
|
10
|
50
|
|
|
|
66
|
$page->batch_mode_page_object_init($self, $module, $infile, $outfile, $depth) |
247
|
|
|
|
|
|
|
if $page->can('batch_mode_page_object_init'); |
248
|
|
|
|
|
|
|
# Init for the index (TOC), too. |
249
|
10
|
50
|
|
|
|
60
|
$self->batch_mode_page_object_init($page, $module, $infile, $outfile, $depth) |
250
|
|
|
|
|
|
|
if $self->can('batch_mode_page_object_init'); |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
# Now get busy... |
253
|
10
|
|
|
|
|
27
|
$self->makepath($outdir => \@namelets); |
254
|
|
|
|
|
|
|
|
255
|
10
|
50
|
|
|
|
21
|
$progress and $progress->reach($self->{"__batch_conv_page_count"}, "Rendering $module"); |
256
|
|
|
|
|
|
|
|
257
|
10
|
50
|
|
|
|
44
|
if( $retval = $page->parse_from_file($infile, $outfile) ) { |
258
|
10
|
|
|
|
|
19
|
++ $self->{"__batch_conv_page_count"} ; |
259
|
10
|
|
|
|
|
27
|
$self->note_for_contents_file( \@namelets, $infile, $outfile ); |
260
|
|
|
|
|
|
|
} else { |
261
|
0
|
|
|
|
|
0
|
$self->muse("Odd, parse_from_file(\"$infile\", \"$outfile\") returned false."); |
262
|
|
|
|
|
|
|
} |
263
|
|
|
|
|
|
|
|
264
|
10
|
50
|
|
|
|
56
|
$page->batch_mode_page_object_kill($self, $module, $infile, $outfile, $depth) |
265
|
|
|
|
|
|
|
if $page->can('batch_mode_page_object_kill'); |
266
|
|
|
|
|
|
|
# The following isn't a typo. Note that it switches $self and $page. |
267
|
10
|
50
|
|
|
|
31
|
$self->batch_mode_page_object_kill($page, $module, $infile, $outfile, $depth) |
268
|
|
|
|
|
|
|
if $self->can('batch_mode_page_object_kill'); |
269
|
|
|
|
|
|
|
|
270
|
10
|
|
|
|
|
12
|
DEBUG > 4 and printf STDERR "%s %sb < $infile %s %sb\n", |
271
|
|
|
|
|
|
|
$outfile, -s $outfile, $infile, -s $infile |
272
|
|
|
|
|
|
|
; |
273
|
|
|
|
|
|
|
|
274
|
10
|
|
|
|
|
672
|
undef($page); |
275
|
10
|
|
|
|
|
47
|
return $retval; |
276
|
|
|
|
|
|
|
} |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
279
|
28
|
50
|
|
28
|
0
|
558
|
sub filespecsys { $_[0]{'_filespecsys'} || 'File::Spec' } |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
sub note_for_contents_file { |
284
|
10
|
|
|
10
|
0
|
27
|
my($self, $namelets, $infile, $outfile) = @_; |
285
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
# I think the infile and outfile parts are never used. -- SMB |
287
|
|
|
|
|
|
|
# But it's handy to have them around for debugging. |
288
|
|
|
|
|
|
|
|
289
|
10
|
50
|
|
|
|
22
|
if( $self->contents_file ) { |
290
|
10
|
|
|
|
|
36
|
my $c = $self->_contents(); |
291
|
10
|
|
|
|
|
55
|
push @$c, |
292
|
|
|
|
|
|
|
[ join("::", @$namelets), $infile, $outfile, $namelets ] |
293
|
|
|
|
|
|
|
# 0 1 2 3 |
294
|
|
|
|
|
|
|
; |
295
|
10
|
|
|
|
|
17
|
DEBUG > 3 and print STDERR "Noting @$c[-1]\n"; |
296
|
|
|
|
|
|
|
} |
297
|
10
|
|
|
|
|
17
|
return; |
298
|
|
|
|
|
|
|
} |
299
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
#_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- |
301
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
sub write_contents_file { |
303
|
1
|
|
|
1
|
0
|
6
|
my($self, $outdir) = @_; |
304
|
1
|
|
50
|
|
|
5
|
my $outfile = $self->_contents_filespec($outdir) || return; |
305
|
|
|
|
|
|
|
|
306
|
1
|
|
|
|
|
10
|
$self->muse("Preparing list of modules for ToC"); |
307
|
|
|
|
|
|
|
|
308
|
1
|
|
|
|
|
3
|
my($toplevel, # maps toplevelbit => [all submodules] |
309
|
|
|
|
|
|
|
$toplevel_form_freq, # ends up being 'foo' => 'Foo' |
310
|
|
|
|
|
|
|
) = $self->_prep_contents_breakdown; |
311
|
|
|
|
|
|
|
|
312
|
1
|
|
|
|
|
2
|
my $Contents = eval { $self->_wopen($outfile) }; |
|
1
|
|
|
|
|
5
|
|
313
|
1
|
50
|
|
|
|
7
|
if( $Contents ) { |
314
|
1
|
|
|
|
|
7
|
$self->muse( "Writing contents file $outfile" ); |
315
|
|
|
|
|
|
|
} else { |
316
|
0
|
|
|
|
|
0
|
warn "Couldn't write-open contents file $outfile: $!\nAbort writing to $outfile at all"; |
317
|
0
|
|
|
|
|
0
|
return; |
318
|
|
|
|
|
|
|
} |
319
|
|
|
|
|
|
|
|
320
|
1
|
|
|
|
|
10
|
$self->_write_contents_start( $Contents, $outfile, ); |
321
|
1
|
|
|
|
|
5
|
$self->_write_contents_middle( $Contents, $outfile, $toplevel, $toplevel_form_freq ); |
322
|
1
|
|
|
|
|
4
|
$self->_write_contents_end( $Contents, $outfile, ); |
323
|
1
|
|
|
|
|
8
|
return $outfile; |
324
|
|
|
|
|
|
|
} |
325
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
327
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
sub _write_contents_start { |
329
|
1
|
|
|
1
|
|
3
|
my($self, $Contents, $outfile) = @_; |
330
|
1
|
|
50
|
|
|
4
|
my $starter = $self->contents_page_start || ''; |
331
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
{ |
333
|
1
|
|
|
|
|
2
|
my $css_wad = $self->_css_wad_to_markup(1); |
|
1
|
|
|
|
|
5
|
|
334
|
1
|
50
|
|
|
|
5
|
if( $css_wad ) { |
335
|
1
|
|
|
|
|
14
|
$starter =~ s{()}{\n$css_wad\n$1}i; # otherwise nevermind |
336
|
|
|
|
|
|
|
} |
337
|
|
|
|
|
|
|
|
338
|
1
|
|
|
|
|
7
|
my $javascript_wad = $self->_javascript_wad_to_markup(1); |
339
|
1
|
50
|
|
|
|
5
|
if( $javascript_wad ) { |
340
|
1
|
|
|
|
|
18
|
$starter =~ s{()}{\n$javascript_wad\n$1}i; # otherwise nevermind |
341
|
|
|
|
|
|
|
} |
342
|
|
|
|
|
|
|
} |
343
|
|
|
|
|
|
|
|
344
|
1
|
50
|
|
|
|
20
|
unless(print $Contents $starter, "\n" ) { |
345
|
0
|
|
|
|
|
0
|
warn "Couldn't print to $outfile: $!\nAbort writing to $outfile at all"; |
346
|
0
|
|
|
|
|
0
|
close($Contents); |
347
|
0
|
|
|
|
|
0
|
return 0; |
348
|
|
|
|
|
|
|
} |
349
|
1
|
|
|
|
|
5
|
return 1; |
350
|
|
|
|
|
|
|
} |
351
|
|
|
|
|
|
|
|
352
|
|
|
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
353
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
sub _write_contents_middle { |
355
|
1
|
|
|
1
|
|
5
|
my($self, $Contents, $outfile, $toplevel2submodules, $toplevel_form_freq) = @_; |
356
|
|
|
|
|
|
|
|
357
|
1
|
|
|
|
|
11
|
foreach my $t (sort keys %$toplevel2submodules) { |
358
|
5
|
|
|
|
|
14
|
my @downlines = sort {$a->[-1] cmp $b->[-1]} |
359
|
6
|
|
|
|
|
19
|
@{ $toplevel2submodules->{$t} }; |
|
6
|
|
|
|
|
21
|
|
360
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
printf $Contents qq[%s\n\n], |
362
|
6
|
|
|
|
|
20
|
esc( $t, $toplevel_form_freq->{$t} ) |
363
|
|
|
|
|
|
|
; |
364
|
|
|
|
|
|
|
|
365
|
6
|
|
|
|
|
13
|
my($path, $name); |
366
|
6
|
|
|
|
|
11
|
foreach my $e (@downlines) { |
367
|
10
|
|
|
|
|
18
|
$name = $e->[0]; |
368
|
10
|
|
33
|
|
|
15
|
$path = join( "/", '.', esc( @{$e->[3]} ) ) |
|
10
|
|
|
|
|
23
|
|
369
|
|
|
|
|
|
|
. ($HTML_EXTENSION || $Pod::Simple::HTML::HTML_EXTENSION); |
370
|
10
|
|
|
|
|
29
|
print $Contents qq{ }, esc($name), " \n"; |
371
|
|
|
|
|
|
|
} |
372
|
6
|
|
|
|
|
13
|
print $Contents "\n\n"; |
373
|
|
|
|
|
|
|
} |
374
|
1
|
|
|
|
|
3
|
return 1; |
375
|
|
|
|
|
|
|
} |
376
|
|
|
|
|
|
|
|
377
|
|
|
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
378
|
|
|
|
|
|
|
|
379
|
|
|
|
|
|
|
sub _write_contents_end { |
380
|
1
|
|
|
1
|
|
3
|
my($self, $Contents, $outfile) = @_; |
381
|
1
|
50
|
50
|
|
|
5
|
unless( |
382
|
|
|
|
|
|
|
print $Contents "\n", |
383
|
|
|
|
|
|
|
$self->contents_page_end || '', |
384
|
|
|
|
|
|
|
) { |
385
|
0
|
|
|
|
|
0
|
warn "Couldn't write to $outfile: $!"; |
386
|
|
|
|
|
|
|
} |
387
|
1
|
50
|
|
|
|
42
|
close($Contents) or warn "Couldn't close $outfile: $!"; |
388
|
1
|
|
|
|
|
4
|
return 1; |
389
|
|
|
|
|
|
|
} |
390
|
|
|
|
|
|
|
|
391
|
|
|
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
392
|
|
|
|
|
|
|
|
393
|
|
|
|
|
|
|
sub _prep_contents_breakdown { |
394
|
1
|
|
|
1
|
|
4
|
my($self) = @_; |
395
|
1
|
|
|
|
|
3
|
my $contents = $self->_contents; |
396
|
1
|
|
|
|
|
2
|
my %toplevel; # maps lctoplevelbit => [all submodules] |
397
|
|
|
|
|
|
|
my %toplevel_form_freq; # ends up being 'foo' => 'Foo' |
398
|
|
|
|
|
|
|
# (mapping anycase forms to most freq form) |
399
|
|
|
|
|
|
|
|
400
|
1
|
|
|
|
|
8
|
foreach my $entry (@$contents) { |
401
|
10
|
100
|
|
|
|
35
|
my $toplevel = |
402
|
|
|
|
|
|
|
$entry->[0] =~ m/^perl\w*$/ ? 'perl_core_docs' |
403
|
|
|
|
|
|
|
# group all the perlwhatever docs together |
404
|
|
|
|
|
|
|
: $entry->[3][0] # normal case |
405
|
|
|
|
|
|
|
; |
406
|
10
|
|
|
|
|
28
|
++$toplevel_form_freq{ lc $toplevel }{ $toplevel }; |
407
|
10
|
|
|
|
|
12
|
push @{ $toplevel{ lc $toplevel } }, $entry; |
|
10
|
|
|
|
|
18
|
|
408
|
10
|
|
|
|
|
21
|
push @$entry, lc($entry->[0]); # add a sort-order key to the end |
409
|
|
|
|
|
|
|
} |
410
|
|
|
|
|
|
|
|
411
|
1
|
|
|
|
|
7
|
foreach my $toplevel (sort keys %toplevel) { |
412
|
6
|
|
|
|
|
11
|
my $fgroup = $toplevel_form_freq{$toplevel}; |
413
|
|
|
|
|
|
|
$toplevel_form_freq{$toplevel} = |
414
|
|
|
|
|
|
|
( |
415
|
6
|
0
|
|
|
|
17
|
sort { $fgroup->{$b} <=> $fgroup->{$a} or $a cmp $b } |
|
0
|
|
|
|
|
0
|
|
416
|
|
|
|
|
|
|
keys %$fgroup |
417
|
|
|
|
|
|
|
# This hash is extremely unlikely to have more than 4 members, so this |
418
|
|
|
|
|
|
|
# sort isn't so very wasteful |
419
|
|
|
|
|
|
|
)[0]; |
420
|
|
|
|
|
|
|
} |
421
|
|
|
|
|
|
|
|
422
|
1
|
50
|
|
|
|
6
|
return(\%toplevel, \%toplevel_form_freq) if wantarray; |
423
|
0
|
|
|
|
|
0
|
return \%toplevel; |
424
|
|
|
|
|
|
|
} |
425
|
|
|
|
|
|
|
|
426
|
|
|
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
427
|
|
|
|
|
|
|
|
428
|
|
|
|
|
|
|
sub _contents_filespec { |
429
|
1
|
|
|
1
|
|
4
|
my($self, $outdir) = @_; |
430
|
1
|
|
|
|
|
4
|
my $outfile = $self->contents_file; |
431
|
1
|
50
|
|
|
|
4
|
return unless $outfile; |
432
|
1
|
|
|
|
|
4
|
return $self->filespecsys->catfile( $outdir, $outfile ); |
433
|
|
|
|
|
|
|
} |
434
|
|
|
|
|
|
|
|
435
|
|
|
|
|
|
|
#_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- |
436
|
|
|
|
|
|
|
|
437
|
|
|
|
|
|
|
sub makepath { |
438
|
10
|
|
|
10
|
0
|
21
|
my($self, $outdir, $namelets) = @_; |
439
|
10
|
100
|
|
|
|
21
|
return unless @$namelets > 1; |
440
|
5
|
|
|
|
|
21
|
for my $i (0 .. ($#$namelets - 1)) { |
441
|
5
|
|
|
|
|
11
|
my $dir = $self->filespecsys->catdir( $outdir, @$namelets[0 .. $i] ); |
442
|
5
|
100
|
|
|
|
138
|
if(-e $dir) { |
443
|
2
|
50
|
|
|
|
27
|
die "$dir exists but not as a directory!?" unless -d $dir; |
444
|
2
|
|
|
|
|
7
|
next; |
445
|
|
|
|
|
|
|
} |
446
|
3
|
|
|
|
|
8
|
DEBUG > 3 and print STDERR " Making $dir\n"; |
447
|
3
|
50
|
|
|
|
191
|
mkdir $dir, 0777 |
448
|
|
|
|
|
|
|
or die "Can't mkdir $dir: $!\nAborting" |
449
|
|
|
|
|
|
|
; |
450
|
|
|
|
|
|
|
} |
451
|
5
|
|
|
|
|
17
|
return; |
452
|
|
|
|
|
|
|
} |
453
|
|
|
|
|
|
|
|
454
|
|
|
|
|
|
|
#_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- |
455
|
|
|
|
|
|
|
|
456
|
|
|
|
|
|
|
sub batch_mode_page_object_init { |
457
|
10
|
|
|
10
|
0
|
49
|
my $self = shift; |
458
|
10
|
|
|
|
|
25
|
my($page, $module, $infile, $outfile, $depth) = @_; |
459
|
|
|
|
|
|
|
|
460
|
|
|
|
|
|
|
# TODO: any further options to percolate onto this new object here? |
461
|
|
|
|
|
|
|
|
462
|
10
|
|
|
|
|
27
|
$page->default_title($module); |
463
|
10
|
|
|
|
|
25
|
$page->index( $self->index ); |
464
|
|
|
|
|
|
|
|
465
|
10
|
|
|
|
|
29
|
$page->html_css( $self-> _css_wad_to_markup($depth) ); |
466
|
10
|
|
|
|
|
27
|
$page->html_javascript( $self->_javascript_wad_to_markup($depth) ); |
467
|
|
|
|
|
|
|
|
468
|
10
|
|
|
|
|
28
|
$self->add_header_backlink($page, $module, $infile, $outfile, $depth); |
469
|
10
|
|
|
|
|
26
|
$self->add_footer_backlink($page, $module, $infile, $outfile, $depth); |
470
|
|
|
|
|
|
|
|
471
|
|
|
|
|
|
|
|
472
|
10
|
|
|
|
|
16
|
return $self; |
473
|
|
|
|
|
|
|
} |
474
|
|
|
|
|
|
|
|
475
|
|
|
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
476
|
|
|
|
|
|
|
|
477
|
|
|
|
|
|
|
sub add_header_backlink { |
478
|
10
|
|
|
10
|
0
|
16
|
my $self = shift; |
479
|
10
|
50
|
|
|
|
23
|
return if $self->no_contents_links; |
480
|
10
|
|
|
|
|
25
|
my($page, $module, $infile, $outfile, $depth) = @_; |
481
|
10
|
50
|
50
|
|
|
24
|
$page->html_header_after_title( join '', |
482
|
|
|
|
|
|
|
$page->html_header_after_title || '', |
483
|
|
|
|
|
|
|
|
484
|
|
|
|
|
|
|
qq[
485
|
|
|
|
|
|
|
$self->url_up_to_contents($depth), |
486
|
|
|
|
|
|
|
qq[" accesskey="1" title="All Documents"><<\n], |
487
|
|
|
|
|
|
|
) |
488
|
|
|
|
|
|
|
if $self->contents_file |
489
|
|
|
|
|
|
|
; |
490
|
10
|
|
|
|
|
24
|
return; |
491
|
|
|
|
|
|
|
} |
492
|
|
|
|
|
|
|
|
493
|
|
|
|
|
|
|
sub add_footer_backlink { |
494
|
10
|
|
|
10
|
0
|
17
|
my $self = shift; |
495
|
10
|
50
|
|
|
|
19
|
return if $self->no_contents_links; |
496
|
10
|
|
|
|
|
20
|
my($page, $module, $infile, $outfile, $depth) = @_; |
497
|
10
|
50
|
50
|
|
|
18
|
$page->html_footer( join '', |
498
|
|
|
|
|
|
|
qq[
499
|
|
|
|
|
|
|
$self->url_up_to_contents($depth), |
500
|
|
|
|
|
|
|
qq[" title="All Documents"><<\n], |
501
|
|
|
|
|
|
|
|
502
|
|
|
|
|
|
|
$page->html_footer || '', |
503
|
|
|
|
|
|
|
) |
504
|
|
|
|
|
|
|
if $self->contents_file |
505
|
|
|
|
|
|
|
; |
506
|
10
|
|
|
|
|
21
|
return; |
507
|
|
|
|
|
|
|
} |
508
|
|
|
|
|
|
|
|
509
|
|
|
|
|
|
|
sub url_up_to_contents { |
510
|
20
|
|
|
20
|
0
|
34
|
my($self, $depth) = @_; |
511
|
20
|
|
|
|
|
23
|
--$depth; |
512
|
20
|
|
|
|
|
51
|
return join '/', ('..') x $depth, esc($self->contents_file); |
513
|
|
|
|
|
|
|
} |
514
|
|
|
|
|
|
|
|
515
|
|
|
|
|
|
|
#_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- |
516
|
|
|
|
|
|
|
|
517
|
|
|
|
|
|
|
sub find_all_pods { |
518
|
1
|
|
|
1
|
0
|
4
|
my($self, $dirs) = @_; |
519
|
|
|
|
|
|
|
# You can override find_all_pods in a subclass if you want to |
520
|
|
|
|
|
|
|
# do extra filtering or whatnot. But for the moment, we just |
521
|
|
|
|
|
|
|
# pass to modnames2paths: |
522
|
1
|
|
|
|
|
14
|
return $self->modnames2paths($dirs); |
523
|
|
|
|
|
|
|
} |
524
|
|
|
|
|
|
|
|
525
|
|
|
|
|
|
|
#_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- |
526
|
|
|
|
|
|
|
|
527
|
|
|
|
|
|
|
sub modnames2paths { # return a hashref mapping modulenames => paths |
528
|
1
|
|
|
1
|
0
|
4
|
my($self, $dirs) = @_; |
529
|
|
|
|
|
|
|
|
530
|
1
|
|
|
|
|
2
|
my $m2p; |
531
|
|
|
|
|
|
|
{ |
532
|
1
|
|
|
|
|
8
|
my $search = $self->search_class->new; |
|
1
|
|
|
|
|
5
|
|
533
|
1
|
|
|
|
|
3
|
DEBUG and print STDERR "Searching via $search\n"; |
534
|
1
|
|
|
|
|
2
|
$search->verbose(1) if DEBUG > 10; |
535
|
1
|
50
|
|
|
|
5
|
$search->progress( $self->progress->copy->goal(0) ) if $self->progress; |
536
|
1
|
|
|
|
|
11
|
$search->shadows(0); # don't bother noting shadowed files |
537
|
1
|
50
|
|
|
|
11
|
$search->inc( $dirs ? 0 : 1 ); |
538
|
1
|
50
|
|
|
|
29
|
$search->survey( $dirs ? @$dirs : () ); |
539
|
1
|
|
|
|
|
9
|
$m2p = $search->name2path; |
540
|
1
|
50
|
|
|
|
41
|
die "What, no name2path?!" unless $m2p; |
541
|
|
|
|
|
|
|
} |
542
|
|
|
|
|
|
|
|
543
|
1
|
50
|
|
|
|
5
|
$self->muse("That's odd... no modules found!") unless keys %$m2p; |
544
|
1
|
|
|
|
|
2
|
if( DEBUG > 4 ) { |
545
|
|
|
|
|
|
|
print STDERR "Modules found (name => path):\n"; |
546
|
|
|
|
|
|
|
foreach my $m (sort {lc($a) cmp lc($b)} keys %$m2p) { |
547
|
|
|
|
|
|
|
print STDERR " $m $$m2p{$m}\n"; |
548
|
|
|
|
|
|
|
} |
549
|
|
|
|
|
|
|
print STDERR "(total ", scalar(keys %$m2p), ")\n\n"; |
550
|
0
|
|
|
|
|
0
|
} elsif( DEBUG ) { |
551
|
|
|
|
|
|
|
print STDERR "Found ", scalar(keys %$m2p), " modules.\n"; |
552
|
|
|
|
|
|
|
} |
553
|
1
|
|
|
|
|
13
|
$self->muse( "Found ", scalar(keys %$m2p), " modules." ); |
554
|
|
|
|
|
|
|
|
555
|
|
|
|
|
|
|
# return the Foo::Bar => /whatever/Foo/Bar.pod|pm hashref |
556
|
1
|
|
|
|
|
12
|
return $m2p; |
557
|
|
|
|
|
|
|
} |
558
|
|
|
|
|
|
|
|
559
|
|
|
|
|
|
|
#=========================================================================== |
560
|
|
|
|
|
|
|
|
561
|
|
|
|
|
|
|
sub _wopen { |
562
|
|
|
|
|
|
|
# this is abstracted out so that the daemon class can override it |
563
|
13
|
|
|
13
|
|
31
|
my($self, $outpath) = @_; |
564
|
13
|
|
|
|
|
70
|
require Symbol; |
565
|
13
|
|
|
|
|
44
|
my $out_fh = Symbol::gensym(); |
566
|
13
|
|
|
|
|
200
|
DEBUG > 5 and print STDERR "Write-opening to $outpath\n"; |
567
|
13
|
50
|
|
|
|
2462
|
return $out_fh if open($out_fh, "> $outpath"); |
568
|
0
|
|
|
|
|
0
|
require Carp; |
569
|
0
|
|
|
|
|
0
|
Carp::croak("Can't write-open $outpath: $!"); |
570
|
|
|
|
|
|
|
} |
571
|
|
|
|
|
|
|
|
572
|
|
|
|
|
|
|
#========================================================================== |
573
|
|
|
|
|
|
|
|
574
|
|
|
|
|
|
|
sub add_css { |
575
|
11
|
|
|
11
|
1
|
25
|
my($self, $url, $is_default, $name, $content_type, $media, $_code) = @_; |
576
|
11
|
50
|
|
|
|
23
|
return unless $url; |
577
|
11
|
50
|
|
|
|
22
|
unless($name) { |
578
|
|
|
|
|
|
|
# cook up a reasonable name based on the URL |
579
|
0
|
|
|
|
|
0
|
$name = $url; |
580
|
0
|
0
|
0
|
|
|
0
|
if( $name !~ m/\?/ and $name =~ m{([^/]+)$}s ) { |
581
|
0
|
|
|
|
|
0
|
$name = $1; |
582
|
0
|
|
|
|
|
0
|
$name =~ s/\.css//i; |
583
|
|
|
|
|
|
|
} |
584
|
|
|
|
|
|
|
} |
585
|
11
|
|
50
|
|
|
51
|
$media ||= 'all'; |
586
|
11
|
|
50
|
|
|
38
|
$content_type ||= 'text/css'; |
587
|
|
|
|
|
|
|
|
588
|
11
|
|
|
|
|
42
|
my $bunch = [$url, $name, $content_type, $media, $_code]; |
589
|
11
|
50
|
|
|
|
22
|
if($is_default) { unshift @{ $self->_css_wad }, $bunch } |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
590
|
11
|
|
|
|
|
28
|
else { push @{ $self->_css_wad }, $bunch } |
|
11
|
|
|
|
|
28
|
|
591
|
11
|
|
|
|
|
32
|
return; |
592
|
|
|
|
|
|
|
} |
593
|
|
|
|
|
|
|
|
594
|
|
|
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
595
|
|
|
|
|
|
|
|
596
|
|
|
|
|
|
|
sub _spray_css { |
597
|
1
|
|
|
1
|
|
17
|
my($self, $outdir) = @_; |
598
|
|
|
|
|
|
|
|
599
|
1
|
50
|
|
|
|
12
|
return unless $self->css_flurry(); |
600
|
1
|
|
|
|
|
25
|
$self->_gen_css_wad(); |
601
|
|
|
|
|
|
|
|
602
|
1
|
|
|
|
|
2
|
my $lol = $self->_css_wad; |
603
|
1
|
|
|
|
|
8
|
foreach my $chunk (@$lol) { |
604
|
11
|
|
|
|
|
27
|
my $url = $chunk->[0]; |
605
|
11
|
|
|
|
|
19
|
my $outfile; |
606
|
11
|
50
|
33
|
|
|
126
|
if( ref($chunk->[-1]) and $url =~ m{^(_[-a-z0-9_]+\.css$)} ) { |
607
|
11
|
|
|
|
|
46
|
$outfile = $self->filespecsys->catfile( $outdir, "$1" ); |
608
|
11
|
|
|
|
|
32
|
DEBUG > 5 and print STDERR "Noting $$chunk[0] as a file I'll create.\n"; |
609
|
|
|
|
|
|
|
} else { |
610
|
0
|
|
|
|
|
0
|
DEBUG > 5 and print STDERR "OK, noting $$chunk[0] as an external CSS.\n"; |
611
|
|
|
|
|
|
|
# Requires no further attention. |
612
|
0
|
|
|
|
|
0
|
next; |
613
|
|
|
|
|
|
|
} |
614
|
|
|
|
|
|
|
|
615
|
|
|
|
|
|
|
#$self->muse( "Writing autogenerated CSS file $outfile" ); |
616
|
11
|
|
|
|
|
24
|
my $Cssout = $self->_wopen($outfile); |
617
|
11
|
50
|
|
|
|
40
|
print $Cssout ${$chunk->[-1]} |
|
11
|
|
|
|
|
78
|
|
618
|
|
|
|
|
|
|
or warn "Couldn't print to $outfile: $!\nAbort writing to $outfile at all"; |
619
|
11
|
|
|
|
|
511
|
close($Cssout); |
620
|
11
|
|
|
|
|
60
|
DEBUG > 5 and print STDERR "Wrote $outfile\n"; |
621
|
|
|
|
|
|
|
} |
622
|
|
|
|
|
|
|
|
623
|
1
|
|
|
|
|
4
|
return; |
624
|
|
|
|
|
|
|
} |
625
|
|
|
|
|
|
|
|
626
|
|
|
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
627
|
|
|
|
|
|
|
|
628
|
|
|
|
|
|
|
sub _css_wad_to_markup { |
629
|
11
|
|
|
11
|
|
20
|
my($self, $depth) = @_; |
630
|
|
|
|
|
|
|
|
631
|
11
|
50
|
|
|
|
17
|
my @css = @{ $self->_css_wad || return '' }; |
|
11
|
|
|
|
|
24
|
|
632
|
11
|
50
|
|
|
|
23
|
return '' unless @css; |
633
|
|
|
|
|
|
|
|
634
|
11
|
|
|
|
|
18
|
my $rel = 'stylesheet'; |
635
|
11
|
|
|
|
|
20
|
my $out = ''; |
636
|
|
|
|
|
|
|
|
637
|
11
|
|
|
|
|
17
|
--$depth; |
638
|
11
|
100
|
|
|
|
36
|
my $uplink = $depth ? ('../' x $depth) : ''; |
639
|
|
|
|
|
|
|
|
640
|
11
|
|
|
|
|
25
|
foreach my $chunk (@css) { |
641
|
121
|
50
|
33
|
|
|
353
|
next unless $chunk and @$chunk; |
642
|
|
|
|
|
|
|
|
643
|
121
|
|
|
|
|
240
|
my( $url1, $url2, $title, $type, $media) = ( |
644
|
|
|
|
|
|
|
$self->_maybe_uplink( $chunk->[0], $uplink ), |
645
|
|
|
|
|
|
|
esc(grep !ref($_), @$chunk) |
646
|
|
|
|
|
|
|
); |
647
|
|
|
|
|
|
|
|
648
|
121
|
|
|
|
|
320
|
$out .= qq{\n}; |
649
|
|
|
|
|
|
|
|
650
|
121
|
|
|
|
|
201
|
$rel = 'alternate stylesheet'; # alternates = all non-first iterations |
651
|
|
|
|
|
|
|
} |
652
|
11
|
|
|
|
|
57
|
return $out; |
653
|
|
|
|
|
|
|
} |
654
|
|
|
|
|
|
|
|
655
|
|
|
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
656
|
|
|
|
|
|
|
sub _maybe_uplink { |
657
|
|
|
|
|
|
|
# if the given URL looks relative, return the given uplink string -- |
658
|
|
|
|
|
|
|
# otherwise return emptystring |
659
|
132
|
|
|
132
|
|
226
|
my($self, $url, $uplink) = @_; |
660
|
132
|
50
|
33
|
|
|
739
|
($url =~ m{^\./} or $url !~ m{[/\:]} ) |
661
|
|
|
|
|
|
|
? $uplink |
662
|
|
|
|
|
|
|
: '' |
663
|
|
|
|
|
|
|
# qualify it, if/as needed |
664
|
|
|
|
|
|
|
} |
665
|
|
|
|
|
|
|
|
666
|
|
|
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
667
|
|
|
|
|
|
|
sub _gen_css_wad { |
668
|
1
|
|
|
1
|
|
3
|
my $self = $_[0]; |
669
|
1
|
|
|
|
|
3
|
my $css_template = $self->_css_template; |
670
|
1
|
|
|
|
|
6
|
foreach my $variation ( |
671
|
|
|
|
|
|
|
|
672
|
|
|
|
|
|
|
# Commented out for sake of concision: |
673
|
|
|
|
|
|
|
# |
674
|
|
|
|
|
|
|
# 011n=black_with_red_on_white |
675
|
|
|
|
|
|
|
# 001n=black_with_yellow_on_white |
676
|
|
|
|
|
|
|
# 101n=black_with_green_on_white |
677
|
|
|
|
|
|
|
# 110=white_with_yellow_on_black |
678
|
|
|
|
|
|
|
# 010=white_with_green_on_black |
679
|
|
|
|
|
|
|
# 011=white_with_blue_on_black |
680
|
|
|
|
|
|
|
# 100=white_with_red_on_black |
681
|
|
|
|
|
|
|
'110n=blkbluw', # black_with_blue_on_white |
682
|
|
|
|
|
|
|
'010n=blkmagw', # black_with_magenta_on_white |
683
|
|
|
|
|
|
|
'100n=blkcynw', # black_with_cyan_on_white |
684
|
|
|
|
|
|
|
'101=whtprpk', # white_with_purple_on_black |
685
|
|
|
|
|
|
|
'001=whtnavk', # white_with_navy_blue_on_black |
686
|
|
|
|
|
|
|
'010a=grygrnk', # grey_with_green_on_black |
687
|
|
|
|
|
|
|
'010b=whtgrng', # white_with_green_on_grey |
688
|
|
|
|
|
|
|
'101an=blkgrng', # black_with_green_on_grey |
689
|
|
|
|
|
|
|
'101bn=grygrnw', # grey_with_green_on_white |
690
|
|
|
|
|
|
|
) { |
691
|
|
|
|
|
|
|
|
692
|
9
|
|
|
|
|
20
|
my $outname = $variation; |
693
|
9
|
50
|
100
|
|
|
129
|
my($flipmode, @swap) = ( ($4 || ''), $1,$2,$3) |
694
|
|
|
|
|
|
|
if $outname =~ s/^([012])([012])([[012])([a-z]*)=?//s; |
695
|
9
|
100
|
|
|
|
35
|
@swap = () if '010' eq join '', @swap; # 010 is a swop-no-op! |
696
|
|
|
|
|
|
|
|
697
|
9
|
|
|
|
|
109
|
my $this_css = |
698
|
|
|
|
|
|
|
"/* This file is autogenerated. Do not edit. $variation */\n\n" |
699
|
|
|
|
|
|
|
. $css_template; |
700
|
|
|
|
|
|
|
|
701
|
|
|
|
|
|
|
# Only look at three-digitty colors, for now at least. |
702
|
9
|
100
|
|
|
|
28
|
if( $flipmode =~ m/n/ ) { |
703
|
5
|
|
|
|
|
47
|
$this_css =~ s/(#[0-9a-fA-F]{3})\b/_color_negate($1)/eg; |
|
110
|
|
|
|
|
204
|
|
704
|
5
|
|
|
|
|
102
|
$this_css =~ s/\bthin\b/medium/g; |
705
|
|
|
|
|
|
|
} |
706
|
9
|
100
|
|
|
|
51
|
$this_css =~ s<#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])\b> |
|
132
|
|
|
|
|
405
|
|
707
|
|
|
|
|
|
|
< join '', '#', ($1,$2,$3)[@swap] >eg if @swap; |
708
|
9
|
100
|
|
|
|
27
|
|
|
|
100
|
|
|
|
|
|
709
|
2
|
|
|
|
|
78
|
if( $flipmode =~ m/a/) |
710
|
|
|
|
|
|
|
{ $this_css =~ s/#fff\b/#999/gi } # black -> dark grey |
711
|
2
|
|
|
|
|
27
|
elsif($flipmode =~ m/b/) |
712
|
|
|
|
|
|
|
{ $this_css =~ s/#000\b/#666/gi } # white -> light grey |
713
|
9
|
|
|
|
|
18
|
|
714
|
9
|
|
|
|
|
28
|
my $name = $outname; |
715
|
9
|
|
|
|
|
58
|
$name =~ tr/-_/ /; |
716
|
|
|
|
|
|
|
$self->add_css( "_$outname.css", 0, $name, 0, 0, \$this_css); |
717
|
|
|
|
|
|
|
} |
718
|
|
|
|
|
|
|
|
719
|
1
|
|
|
|
|
2
|
# Now a few indexless variations: |
720
|
1
|
|
|
|
|
15
|
for (my ($outfile, $variation) = each %{{ |
721
|
|
|
|
|
|
|
blkbluw => 'black_with_blue_on_white', |
722
|
|
|
|
|
|
|
whtpurk => 'white_with_purple_on_black', |
723
|
|
|
|
|
|
|
whtgrng => 'white_with_green_on_grey', |
724
|
|
|
|
|
|
|
grygrnw => 'grey_with_green_on_white', |
725
|
2
|
|
|
|
|
20
|
}}) { |
726
|
|
|
|
|
|
|
my $this_css = join "\n", |
727
|
|
|
|
|
|
|
"/* This file is autogenerated. Do not edit. $outfile */\n", |
728
|
|
|
|
|
|
|
"\@import url(\"./_$variation.css\");", |
729
|
|
|
|
|
|
|
".indexgroup { display: none; }", |
730
|
|
|
|
|
|
|
"\n", |
731
|
2
|
|
|
|
|
3
|
; |
732
|
2
|
|
|
|
|
4
|
my $name = $outfile; |
733
|
2
|
|
|
|
|
16
|
$name =~ tr/-_/ /; |
734
|
|
|
|
|
|
|
$self->add_css( "_$outfile.css", 0, $name, 0, 0, \$this_css); |
735
|
|
|
|
|
|
|
} |
736
|
1
|
|
|
|
|
4
|
|
737
|
|
|
|
|
|
|
return; |
738
|
|
|
|
|
|
|
} |
739
|
|
|
|
|
|
|
|
740
|
110
|
|
|
110
|
|
225
|
sub _color_negate { |
741
|
110
|
|
|
|
|
162
|
my $x = lc $_[0]; |
742
|
|
|
|
|
|
|
$x =~ tr[0123456789abcdef] |
743
|
110
|
|
|
|
|
556
|
[fedcba9876543210]; |
744
|
|
|
|
|
|
|
return $x; |
745
|
|
|
|
|
|
|
} |
746
|
|
|
|
|
|
|
|
747
|
|
|
|
|
|
|
#=========================================================================== |
748
|
|
|
|
|
|
|
|
749
|
1
|
|
|
1
|
1
|
4
|
sub add_javascript { |
750
|
1
|
50
|
|
|
|
3
|
my($self, $url, $content_type, $_code) = @_; |
751
|
1
|
|
50
|
|
|
2
|
return unless $url; |
|
1
|
|
|
|
|
6
|
|
752
|
|
|
|
|
|
|
push @{ $self->_javascript_wad }, [ |
753
|
|
|
|
|
|
|
$url, $content_type || 'text/javascript', $_code |
754
|
1
|
|
|
|
|
3
|
]; |
755
|
|
|
|
|
|
|
return; |
756
|
|
|
|
|
|
|
} |
757
|
|
|
|
|
|
|
|
758
|
1
|
|
|
1
|
|
5
|
sub _spray_javascript { |
759
|
1
|
50
|
|
|
|
8
|
my($self, $outdir) = @_; |
760
|
1
|
|
|
|
|
10
|
return unless $self->javascript_flurry(); |
761
|
|
|
|
|
|
|
$self->_gen_javascript_wad(); |
762
|
1
|
|
|
|
|
3
|
|
763
|
1
|
|
|
|
|
6
|
my $lol = $self->_javascript_wad; |
764
|
1
|
|
|
|
|
3
|
foreach my $script (@$lol) { |
765
|
1
|
|
|
|
|
2
|
my $url = $script->[0]; |
766
|
|
|
|
|
|
|
my $outfile; |
767
|
1
|
50
|
33
|
|
|
26
|
|
768
|
1
|
|
|
|
|
4
|
if( ref($script->[-1]) and $url =~ m{^(_[-a-z0-9_]+\.js$)} ) { |
769
|
1
|
|
|
|
|
4
|
$outfile = $self->filespecsys->catfile( $outdir, "$1" ); |
770
|
|
|
|
|
|
|
DEBUG > 5 and print STDERR "Noting $$script[0] as a file I'll create.\n"; |
771
|
0
|
|
|
|
|
0
|
} else { |
772
|
0
|
|
|
|
|
0
|
DEBUG > 5 and print STDERR "OK, noting $$script[0] as an external JavaScript.\n"; |
773
|
|
|
|
|
|
|
next; |
774
|
|
|
|
|
|
|
} |
775
|
|
|
|
|
|
|
|
776
|
1
|
|
|
|
|
3
|
#$self->muse( "Writing JavaScript file $outfile" ); |
777
|
|
|
|
|
|
|
my $Jsout = $self->_wopen($outfile); |
778
|
1
|
50
|
|
|
|
9
|
|
|
1
|
|
|
|
|
25
|
|
779
|
|
|
|
|
|
|
print $Jsout ${$script->[-1]} |
780
|
1
|
|
|
|
|
33
|
or warn "Couldn't print to $outfile: $!\nAbort writing to $outfile at all"; |
781
|
1
|
|
|
|
|
7
|
close($Jsout); |
782
|
|
|
|
|
|
|
DEBUG > 5 and print STDERR "Wrote $outfile\n"; |
783
|
|
|
|
|
|
|
} |
784
|
1
|
|
|
|
|
3
|
|
785
|
|
|
|
|
|
|
return; |
786
|
|
|
|
|
|
|
} |
787
|
|
|
|
|
|
|
|
788
|
1
|
|
|
1
|
|
2
|
sub _gen_javascript_wad { |
789
|
1
|
|
50
|
|
|
2
|
my $self = $_[0]; |
790
|
1
|
|
|
|
|
9
|
my $js_code = $self->_javascript || return; |
791
|
1
|
|
|
|
|
6
|
$self->add_javascript( "_podly.js", 0, \$js_code); |
792
|
|
|
|
|
|
|
return; |
793
|
|
|
|
|
|
|
} |
794
|
|
|
|
|
|
|
|
795
|
11
|
|
|
11
|
|
22
|
sub _javascript_wad_to_markup { |
796
|
|
|
|
|
|
|
my($self, $depth) = @_; |
797
|
11
|
50
|
|
|
|
24
|
|
|
11
|
|
|
|
|
23
|
|
798
|
11
|
50
|
|
|
|
25
|
my @scripts = @{ $self->_javascript_wad || return '' }; |
799
|
|
|
|
|
|
|
return '' unless @scripts; |
800
|
11
|
|
|
|
|
20
|
|
801
|
|
|
|
|
|
|
my $out = ''; |
802
|
11
|
|
|
|
|
17
|
|
803
|
11
|
100
|
|
|
|
27
|
--$depth; |
804
|
|
|
|
|
|
|
my $uplink = $depth ? ('../' x $depth) : ''; |
805
|
11
|
|
|
|
|
27
|
|
806
|
11
|
50
|
33
|
|
|
44
|
foreach my $s (@scripts) { |
807
|
|
|
|
|
|
|
next unless $s and @$s; |
808
|
11
|
|
|
|
|
25
|
|
809
|
|
|
|
|
|
|
my( $url1, $url2, $type, $media) = ( |
810
|
|
|
|
|
|
|
$self->_maybe_uplink( $s->[0], $uplink ), |
811
|
|
|
|
|
|
|
esc(grep !ref($_), @$s) |
812
|
|
|
|
|
|
|
); |
813
|
11
|
|
|
|
|
42
|
|
814
|
|
|
|
|
|
|
$out .= qq{\n}; |
815
|
11
|
|
|
|
|
35
|
} |
816
|
|
|
|
|
|
|
return $out; |
817
|
|
|
|
|
|
|
} |
818
|
|
|
|
|
|
|
|
819
|
|
|
|
|
|
|
#=========================================================================== |
820
|
|
|
|
|
|
|
|
821
|
|
|
|
|
|
|
our $CSS = <<'EOCSS'; |
822
|
|
|
|
|
|
|
/* For accessibility reasons, never specify text sizes in px/pt/pc/in/cm/mm */ |
823
|
|
|
|
|
|
|
|
824
|
|
|
|
|
|
|
@media all { .hide { display: none; } } |
825
|
|
|
|
|
|
|
|
826
|
|
|
|
|
|
|
@media print { |
827
|
|
|
|
|
|
|
.noprint, div.indexgroup, .backlinktop, .backlinkbottom { display: none } |
828
|
|
|
|
|
|
|
|
829
|
|
|
|
|
|
|
* { |
830
|
|
|
|
|
|
|
border-color: black !important; |
831
|
|
|
|
|
|
|
color: black !important; |
832
|
|
|
|
|
|
|
background-color: transparent !important; |
833
|
|
|
|
|
|
|
background-image: none !important; |
834
|
|
|
|
|
|
|
} |
835
|
|
|
|
|
|
|
|
836
|
|
|
|
|
|
|
dl.superindex > dd { |
837
|
|
|
|
|
|
|
word-spacing: .6em; |
838
|
|
|
|
|
|
|
} |
839
|
|
|
|
|
|
|
} |
840
|
|
|
|
|
|
|
|
841
|
|
|
|
|
|
|
@media aural, braille, embossed { |
842
|
|
|
|
|
|
|
div.indexgroup { display: none; } /* Too noisy, don't you think? */ |
843
|
|
|
|
|
|
|
dl.superindex > dt:before { content: "Group "; } |
844
|
|
|
|
|
|
|
dl.superindex > dt:after { content: " contains:"; } |
845
|
|
|
|
|
|
|
.backlinktop a:before { content: "Back to contents"; } |
846
|
|
|
|
|
|
|
.backlinkbottom a:before { content: "Back to contents"; } |
847
|
|
|
|
|
|
|
} |
848
|
|
|
|
|
|
|
|
849
|
|
|
|
|
|
|
@media aural { |
850
|
|
|
|
|
|
|
dl.superindex > dt { pause-before: 600ms; } |
851
|
|
|
|
|
|
|
} |
852
|
|
|
|
|
|
|
|
853
|
|
|
|
|
|
|
@media screen, tty, tv, projection { |
854
|
|
|
|
|
|
|
.noscreen { display: none; } |
855
|
|
|
|
|
|
|
|
856
|
|
|
|
|
|
|
a:link { color: #7070ff; text-decoration: underline; } |
857
|
|
|
|
|
|
|
a:visited { color: #e030ff; text-decoration: underline; } |
858
|
|
|
|
|
|
|
a:active { color: #800000; text-decoration: underline; } |
859
|
|
|
|
|
|
|
body.contentspage a { text-decoration: none; } |
860
|
|
|
|
|
|
|
a.u { color: #fff !important; text-decoration: none; } |
861
|
|
|
|
|
|
|
|
862
|
|
|
|
|
|
|
body.pod { |
863
|
|
|
|
|
|
|
margin: 0 5px; |
864
|
|
|
|
|
|
|
color: #fff; |
865
|
|
|
|
|
|
|
background-color: #000; |
866
|
|
|
|
|
|
|
} |
867
|
|
|
|
|
|
|
|
868
|
|
|
|
|
|
|
body.pod h1, body.pod h2, body.pod h3, |
869
|
|
|
|
|
|
|
body.pod h4, body.pod h5, body.pod h6 { |
870
|
|
|
|
|
|
|
font-family: Tahoma, Verdana, Helvetica, Arial, sans-serif; |
871
|
|
|
|
|
|
|
font-weight: normal; |
872
|
|
|
|
|
|
|
margin-top: 1.2em; |
873
|
|
|
|
|
|
|
margin-bottom: .1em; |
874
|
|
|
|
|
|
|
border-top: thin solid transparent; |
875
|
|
|
|
|
|
|
/* margin-left: -5px; border-left: 2px #7070ff solid; padding-left: 3px; */ |
876
|
|
|
|
|
|
|
} |
877
|
|
|
|
|
|
|
|
878
|
|
|
|
|
|
|
body.pod h1 { border-top-color: #0a0; } |
879
|
|
|
|
|
|
|
body.pod h2 { border-top-color: #080; } |
880
|
|
|
|
|
|
|
body.pod h3 { border-top-color: #040; } |
881
|
|
|
|
|
|
|
body.pod h4 { border-top-color: #010; } |
882
|
|
|
|
|
|
|
body.pod h5 { border-top-color: #010; } |
883
|
|
|
|
|
|
|
body.pod h6 { border-top-color: #010; } |
884
|
|
|
|
|
|
|
|
885
|
|
|
|
|
|
|
p.backlinktop + h1 { border-top: none; margin-top: 0em; } |
886
|
|
|
|
|
|
|
p.backlinktop + h2 { border-top: none; margin-top: 0em; } |
887
|
|
|
|
|
|
|
p.backlinktop + h3 { border-top: none; margin-top: 0em; } |
888
|
|
|
|
|
|
|
p.backlinktop + h4 { border-top: none; margin-top: 0em; } |
889
|
|
|
|
|
|
|
p.backlinktop + h5 { border-top: none; margin-top: 0em; } |
890
|
|
|
|
|
|
|
p.backlinktop + h6 { border-top: none; margin-top: 0em; } |
891
|
|
|
|
|
|
|
|
892
|
|
|
|
|
|
|
body.pod dt { |
893
|
|
|
|
|
|
|
font-size: 105%; /* just a wee bit more than normal */ |
894
|
|
|
|
|
|
|
} |
895
|
|
|
|
|
|
|
|
896
|
|
|
|
|
|
|
.indexgroup { font-size: 80%; } |
897
|
|
|
|
|
|
|
|
898
|
|
|
|
|
|
|
.backlinktop, .backlinkbottom { |
899
|
|
|
|
|
|
|
margin-left: -5px; |
900
|
|
|
|
|
|
|
margin-right: -5px; |
901
|
|
|
|
|
|
|
background-color: #040; |
902
|
|
|
|
|
|
|
border-top: thin solid #050; |
903
|
|
|
|
|
|
|
border-bottom: thin solid #050; |
904
|
|
|
|
|
|
|
} |
905
|
|
|
|
|
|
|
|
906
|
|
|
|
|
|
|
.backlinktop a, .backlinkbottom a { |
907
|
|
|
|
|
|
|
text-decoration: none; |
908
|
|
|
|
|
|
|
color: #080; |
909
|
|
|
|
|
|
|
background-color: #000; |
910
|
|
|
|
|
|
|
border: thin solid #0d0; |
911
|
|
|
|
|
|
|
} |
912
|
|
|
|
|
|
|
.backlinkbottom { margin-bottom: 0; padding-bottom: 0; } |
913
|
|
|
|
|
|
|
.backlinktop { margin-top: 0; padding-top: 0; } |
914
|
|
|
|
|
|
|
|
915
|
|
|
|
|
|
|
body.contentspage { |
916
|
|
|
|
|
|
|
color: #fff; |
917
|
|
|
|
|
|
|
background-color: #000; |
918
|
|
|
|
|
|
|
} |
919
|
|
|
|
|
|
|
|
920
|
|
|
|
|
|
|
body.contentspage h1 { |
921
|
|
|
|
|
|
|
color: #0d0; |
922
|
|
|
|
|
|
|
margin-left: 1em; |
923
|
|
|
|
|
|
|
margin-right: 1em; |
924
|
|
|
|
|
|
|
text-indent: -.9em; |
925
|
|
|
|
|
|
|
font-family: Tahoma, Verdana, Helvetica, Arial, sans-serif; |
926
|
|
|
|
|
|
|
font-weight: normal; |
927
|
|
|
|
|
|
|
border-top: thin solid #fff; |
928
|
|
|
|
|
|
|
border-bottom: thin solid #fff; |
929
|
|
|
|
|
|
|
text-align: center; |
930
|
|
|
|
|
|
|
} |
931
|
|
|
|
|
|
|
|
932
|
|
|
|
|
|
|
dl.superindex > dt { |
933
|
|
|
|
|
|
|
font-family: Tahoma, Verdana, Helvetica, Arial, sans-serif; |
934
|
|
|
|
|
|
|
font-weight: normal; |
935
|
|
|
|
|
|
|
font-size: 90%; |
936
|
|
|
|
|
|
|
margin-top: .45em; |
937
|
|
|
|
|
|
|
/* margin-bottom: -.15em; */ |
938
|
|
|
|
|
|
|
} |
939
|
|
|
|
|
|
|
dl.superindex > dd { |
940
|
|
|
|
|
|
|
word-spacing: .6em; /* most important rule here! */ |
941
|
|
|
|
|
|
|
} |
942
|
|
|
|
|
|
|
dl.superindex > a:link { |
943
|
|
|
|
|
|
|
text-decoration: none; |
944
|
|
|
|
|
|
|
color: #fff; |
945
|
|
|
|
|
|
|
} |
946
|
|
|
|
|
|
|
|
947
|
|
|
|
|
|
|
.contentsfooty { |
948
|
|
|
|
|
|
|
border-top: thin solid #999; |
949
|
|
|
|
|
|
|
font-size: 90%; |
950
|
|
|
|
|
|
|
} |
951
|
|
|
|
|
|
|
|
952
|
|
|
|
|
|
|
} |
953
|
|
|
|
|
|
|
|
954
|
|
|
|
|
|
|
/* The End */ |
955
|
|
|
|
|
|
|
|
956
|
|
|
|
|
|
|
EOCSS |
957
|
|
|
|
|
|
|
|
958
|
|
|
|
|
|
|
#========================================================================== |
959
|
|
|
|
|
|
|
|
960
|
|
|
|
|
|
|
our $JAVASCRIPT = <<'EOJAVASCRIPT'; |
961
|
|
|
|
|
|
|
|
962
|
|
|
|
|
|
|
// From http://www.alistapart.com/articles/alternate/ |
963
|
|
|
|
|
|
|
|
964
|
|
|
|
|
|
|
function setActiveStyleSheet(title) { |
965
|
|
|
|
|
|
|
var i, a, main; |
966
|
|
|
|
|
|
|
for(i=0 ; (a = document.getElementsByTagName("link")[i]) ; i++) { |
967
|
|
|
|
|
|
|
if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) { |
968
|
|
|
|
|
|
|
a.disabled = true; |
969
|
|
|
|
|
|
|
if(a.getAttribute("title") == title) a.disabled = false; |
970
|
|
|
|
|
|
|
} |
971
|
|
|
|
|
|
|
} |
972
|
|
|
|
|
|
|
} |
973
|
|
|
|
|
|
|
|
974
|
|
|
|
|
|
|
function getActiveStyleSheet() { |
975
|
|
|
|
|
|
|
var i, a; |
976
|
|
|
|
|
|
|
for(i=0 ; (a = document.getElementsByTagName("link")[i]) ; i++) { |
977
|
|
|
|
|
|
|
if( a.getAttribute("rel").indexOf("style") != -1 |
978
|
|
|
|
|
|
|
&& a.getAttribute("title") |
979
|
|
|
|
|
|
|
&& !a.disabled |
980
|
|
|
|
|
|
|
) return a.getAttribute("title"); |
981
|
|
|
|
|
|
|
} |
982
|
|
|
|
|
|
|
return null; |
983
|
|
|
|
|
|
|
} |
984
|
|
|
|
|
|
|
|
985
|
|
|
|
|
|
|
function getPreferredStyleSheet() { |
986
|
|
|
|
|
|
|
var i, a; |
987
|
|
|
|
|
|
|
for(i=0 ; (a = document.getElementsByTagName("link")[i]) ; i++) { |
988
|
|
|
|
|
|
|
if( a.getAttribute("rel").indexOf("style") != -1 |
989
|
|
|
|
|
|
|
&& a.getAttribute("rel").indexOf("alt") == -1 |
990
|
|
|
|
|
|
|
&& a.getAttribute("title") |
991
|
|
|
|
|
|
|
) return a.getAttribute("title"); |
992
|
|
|
|
|
|
|
} |
993
|
|
|
|
|
|
|
return null; |
994
|
|
|
|
|
|
|
} |
995
|
|
|
|
|
|
|
|
996
|
|
|
|
|
|
|
function createCookie(name,value,days) { |
997
|
|
|
|
|
|
|
if (days) { |
998
|
|
|
|
|
|
|
var date = new Date(); |
999
|
|
|
|
|
|
|
date.setTime(date.getTime()+(days*24*60*60*1000)); |
1000
|
|
|
|
|
|
|
var expires = "; expires="+date.toGMTString(); |
1001
|
|
|
|
|
|
|
} |
1002
|
|
|
|
|
|
|
else expires = ""; |
1003
|
|
|
|
|
|
|
document.cookie = name+"="+value+expires+"; path=/"; |
1004
|
|
|
|
|
|
|
} |
1005
|
|
|
|
|
|
|
|
1006
|
|
|
|
|
|
|
function readCookie(name) { |
1007
|
|
|
|
|
|
|
var nameEQ = name + "="; |
1008
|
|
|
|
|
|
|
var ca = document.cookie.split(';'); |
1009
|
|
|
|
|
|
|
for(var i=0 ; i < ca.length ; i++) { |
1010
|
|
|
|
|
|
|
var c = ca[i]; |
1011
|
|
|
|
|
|
|
while (c.charAt(0)==' ') c = c.substring(1,c.length); |
1012
|
|
|
|
|
|
|
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); |
1013
|
|
|
|
|
|
|
} |
1014
|
|
|
|
|
|
|
return null; |
1015
|
|
|
|
|
|
|
} |
1016
|
|
|
|
|
|
|
|
1017
|
|
|
|
|
|
|
window.onload = function(e) { |
1018
|
|
|
|
|
|
|
var cookie = readCookie("style"); |
1019
|
|
|
|
|
|
|
var title = cookie ? cookie : getPreferredStyleSheet(); |
1020
|
|
|
|
|
|
|
setActiveStyleSheet(title); |
1021
|
|
|
|
|
|
|
} |
1022
|
|
|
|
|
|
|
|
1023
|
|
|
|
|
|
|
window.onunload = function(e) { |
1024
|
|
|
|
|
|
|
var title = getActiveStyleSheet(); |
1025
|
|
|
|
|
|
|
createCookie("style", title, 365); |
1026
|
|
|
|
|
|
|
} |
1027
|
|
|
|
|
|
|
|
1028
|
|
|
|
|
|
|
var cookie = readCookie("style"); |
1029
|
|
|
|
|
|
|
var title = cookie ? cookie : getPreferredStyleSheet(); |
1030
|
|
|
|
|
|
|
setActiveStyleSheet(title); |
1031
|
|
|
|
|
|
|
|
1032
|
|
|
|
|
|
|
// The End |
1033
|
|
|
|
|
|
|
|
1034
|
|
|
|
|
|
|
EOJAVASCRIPT |
1035
|
1
|
|
|
1
|
|
6
|
|
1036
|
1
|
|
|
1
|
|
6
|
sub _css_template { return $CSS } |
1037
|
|
|
|
|
|
|
sub _javascript { return $JAVASCRIPT } |
1038
|
|
|
|
|
|
|
|
1039
|
|
|
|
|
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
1040
|
|
|
|
|
|
|
1; |
1041
|
|
|
|
|
|
|
__END__ |