1 |
#!/usr/local/bin/perl |
#!/usr/bin/perl |
2 |
# |
# |
3 |
# SLies Copyright 2001 Dobrica Pavlinusic <dpavlin@rot13.org> |
# PLies Copyright 2001 Dobrica Pavlinusic <dpavlin@rot13.org> |
4 |
# |
# |
5 |
# this tool is based on SlideMaker and XLSies tool |
# this tool is based on SlideMaker and XLSies tool |
6 |
# split a all.htm into slide*.htm |
# split a all.htm into slide*.htm |
42 |
# |
# |
43 |
# Sami Lempinen - lempinen@iki.fi |
# Sami Lempinen - lempinen@iki.fi |
44 |
# http://www.snowman.sgic.fi/ssl/xslies/ |
# http://www.snowman.sgic.fi/ssl/xslies/ |
45 |
|
# |
46 |
|
# Text::FastTemplate: |
47 |
|
# Robert Lehr - bozzio@the-lehrs.com |
48 |
|
|
49 |
make_dotgif("pero.gif"); |
use Text::FastTemplate; |
50 |
|
|
51 |
############################################################################## |
############################################################################## |
52 |
## default values of variables |
## default values of variables |
53 |
## |
## |
54 |
|
|
55 |
|
## show debug output |
56 |
|
my $debug=1; |
57 |
|
|
58 |
## default DOCTYPE added on the slides |
## default DOCTYPE added on the slides |
59 |
$doctype = '<html xmlns="http://www.w3.org/TR/REC-html40">'; |
$doctype = '<html xmlns="http://www.w3.org/TR/REC-html40">'; |
60 |
|
|
107 |
## standard style sheets |
## standard style sheets |
108 |
$cssStandard = '../PLies/css/default.css'; |
$cssStandard = '../PLies/css/default.css'; |
109 |
|
|
110 |
|
## template name |
111 |
|
$template = '../PLies/default'; |
112 |
|
|
113 |
## default charset use in meta tag http-equiv (undef to skip) |
## default charset use in meta tag http-equiv (undef to skip) |
114 |
#$charset = 'ISO-8859-1'; |
#$charset = 'ISO-8859-1'; |
115 |
|
|
122 |
## use progress bar |
## use progress bar |
123 |
$progress_bar = 1; |
$progress_bar = 1; |
124 |
|
|
125 |
|
## content hight for each slide |
126 |
|
$content_hight = "70%"; |
127 |
|
|
128 |
## end of default values for the presentation |
## end of default values for the presentation |
129 |
############################################################################## |
############################################################################## |
130 |
|
|
131 |
## globals |
## globals |
|
my $logo_html; |
|
|
my $date_html; |
|
132 |
my $last_toc_title; |
my $last_toc_title; |
133 |
|
my %page_data; |
134 |
|
my %overview_data; |
135 |
|
|
136 |
|
my $pack = 0; |
137 |
|
my @pack_additional; # additional files to pack (pictures, logos...) |
138 |
|
|
139 |
############################################################################## |
############################################################################## |
140 |
## reading user input from $infos |
## reading user input from $infos |
145 |
|
|
146 |
# read parameters from infos.txt and put them in @PARAM |
# read parameters from infos.txt and put them in @PARAM |
147 |
if (open(INFOS, $infos)) { |
if (open(INFOS, $infos)) { |
148 |
print STDOUT "--- Reading parameters file $infos ---\n"; |
print STDERR "--- Reading parameters file $infos ---\n"; |
149 |
local(@file,$counter); |
local(@file); |
150 |
$counter = 0; |
@file = <INFOS>; |
151 |
@file = <INFOS>; |
# @PARAM = (); # don't reset param, use @ARGV |
152 |
@PARAM = (); |
do { |
153 |
do { |
if ($file[0] && $file[0] =~ /^[^#\n\r]/) { |
154 |
if ($file[0] && $file[0] =~ /^[^#\n\r]/) { |
$file[0] =~ s/\n//; # remove UNIX \n |
155 |
$file[0] =~ s/\n//; # remove UNIX \n |
$file[0] =~ s/\r//; # remove WINDOWS \r |
156 |
$file[0] =~ s/\r//; # remove WINDOWS \r |
$file[0] =~ s/ *= */=/; |
157 |
$file[0] =~ s/ *= */=/; |
push @PARAM,$file[0]; |
158 |
$PARAM[$counter++] = $file[0]; |
print STDERR "$file[0]\n"; |
159 |
print "$file[0]\n"; |
} |
160 |
} |
} while (shift(@file)); |
|
} while (shift(@file)); |
|
161 |
} |
} |
162 |
## @PARAM is now a table with the user preferences for his presentation |
## @PARAM is now a table with the user preferences for his presentation |
163 |
|
|
164 |
## process arguments |
## process arguments |
165 |
## each preset variable is now re-attributed using the user preferences |
## each preset variable is now re-attributed using the user preferences |
166 |
foreach (@PARAM) { |
foreach (@PARAM) { |
167 |
@_ = split(/ *= */,$_,2); |
my ($var,$value) = split(/ *= */,$_,2); |
168 |
$cmd="\$$_[0] = \'$_[1]\';"; |
$value=~s/'/\\'/g; |
169 |
if (length $_[1] != 0) { |
$cmd="\$$var = \'$value\';"; |
170 |
eval($cmd); |
if ($value) { |
171 |
} |
eval($cmd) || die "problem with eval of: $cmd"; |
172 |
|
} else { |
173 |
|
die "no value defined for $var"; |
174 |
|
} |
175 |
} |
} |
176 |
|
|
177 |
## use charset |
## use charset |
183 |
} |
} |
184 |
|
|
185 |
|
|
|
## build an html string for the author variable |
|
|
## containing the presentation author name linked to |
|
|
## a location of his choice |
|
|
if ($authorUrl) { |
|
|
$author = "<a href=\"$authorUrl\">$author</a>"; |
|
|
} |
|
|
|
|
|
## same string is built if there is a second author for the presentation |
|
|
if ($author2Url) { |
|
|
$author2 = "<br><a href=\"$author2Url\">$author2</a>"; |
|
|
} elsif ($author2) { |
|
|
$author2 = "<br>$author2"; |
|
|
} |
|
|
|
|
186 |
############################################################################## |
############################################################################## |
187 |
## read the raw html presentation |
## read the raw html presentation |
188 |
## |
## |
190 |
## copy file in memory |
## copy file in memory |
191 |
my $sep = $/; |
my $sep = $/; |
192 |
$/ = undef; |
$/ = undef; |
193 |
if (!open(ALL, $all)) { |
open(ALL, $all) || die "Error: Cannot open file: $all"; |
|
print "Error: Cannot open file: $all\n"; |
|
|
exit 0; |
|
|
} |
|
194 |
my $buf = <ALL>; |
my $buf = <ALL>; |
195 |
|
$buf =~ s/\r//g; # remove WINDOWS \r |
196 |
close(ALL); |
close(ALL); |
197 |
$/ = $sep; |
$/ = $sep; |
198 |
|
|
200 |
## they do not need to show up on the slides |
## they do not need to show up on the slides |
201 |
$buf =~ s/<!--.*?-->//sgo; |
$buf =~ s/<!--.*?-->//sgo; |
202 |
|
|
203 |
|
## if $pack is set, output name of css (for inclusion in archive), but |
204 |
|
## reset $cssStandard only to filename (without path) |
205 |
|
|
206 |
|
if ($pack) { |
207 |
|
push @pack_additional,$cssStandard; |
208 |
|
$cssStandard =~ s/^.*\/([^\/]+)$/$1/g; |
209 |
|
} |
210 |
|
|
211 |
## the slidemaker tool assumes that each slide is self contained between 2 sets of h1 tags |
## the slidemaker tool assumes that each slide is self contained between 2 sets of h1 tags |
212 |
## if not it will generate a rather weird output |
## if not it will generate a rather weird output |
213 |
## split using <h1...> and </h1...> as separator (ignores attributes!) |
## split using <h1...> and </h1...> as separator (ignores attributes!) |
227 |
############################################################################## |
############################################################################## |
228 |
## processing the slides |
## processing the slides |
229 |
|
|
230 |
print STDOUT "\n--- Processing $total slides ---\n"; |
print STDERR "\n--- Processing $total slides ---\n"; |
231 |
|
|
232 |
## generate the header table of content of the presentation |
## generate the header table of content of the presentation |
233 |
## which is also the first page of the talk |
## which is also the first page of the talk |
236 |
## start the slide count so we can number them |
## start the slide count so we can number them |
237 |
$slideCount = 1; |
$slideCount = 1; |
238 |
|
|
239 |
|
## pre-load template slides using $template dir |
240 |
|
Text::FastTemplate->defaults( |
241 |
|
path => [ $template ] |
242 |
|
); |
243 |
|
|
244 |
|
Text::FastTemplate->preload( [ |
245 |
|
{ file => 'slide.html', key => 'slide' }, |
246 |
|
{ file => 'overview.html', key => 'overview' }, |
247 |
|
{ file => 'title.html', key => 'title' }, |
248 |
|
]); |
249 |
|
|
250 |
|
## unroll relative anchors (#something) into links with slides |
251 |
|
|
252 |
|
my %anchor_on_slide; |
253 |
|
|
254 |
|
## step 1: record anchors |
255 |
|
for($i=0; $i<$total; $i++) { |
256 |
|
my $tmp = $table[($i*2)].$table[($i*2)+1]; |
257 |
|
while ($tmp =~ s,<a +name="*([^>"]+)"*>,,i) { |
258 |
|
$anchor_on_slide{$1}=($i+1); |
259 |
|
print STDERR "\tslide ",($i+1)," anchor: $1\n" if ($debug); |
260 |
|
} |
261 |
|
} |
262 |
|
|
263 |
|
## step 2: fix links |
264 |
|
for($i=0; $i<$total; $i++) { |
265 |
|
foreach (keys %anchor_on_slide) { |
266 |
|
$table[($i*2)] =~ s,href="*#$_"*>,href="slide$anchor_on_slide{$_}\.html#$_">,gi; |
267 |
|
} |
268 |
|
} |
269 |
|
|
270 |
## @table is the array containing each slide with its title |
## @table is the array containing each slide with its title |
271 |
## for each slide to be generated |
## for each slide to be generated |
272 |
## we delete each slide and its title when generated |
## we delete each slide and its title when generated |
273 |
## so that the current slide and its title are always at $table[0] (for the title) |
## so that the current slide and its title are always at $table[0] (for the title) |
274 |
## and $table[1] (for the slide content) |
## and $table[1] (for the slide content) |
275 |
|
|
276 |
|
undef $prev_title; |
277 |
|
undef $next_title; |
278 |
|
|
279 |
do { |
do { |
280 |
|
|
281 |
## get rid of the first element contained by the raw presentation array |
## get rid of the first element contained by the raw presentation array |
291 |
## need to check if the title contains any anchor |
## need to check if the title contains any anchor |
292 |
## if so it needs to be removed |
## if so it needs to be removed |
293 |
## because the title is being used in the table of content to link to the corresponding slide |
## because the title is being used in the table of content to link to the corresponding slide |
294 |
$table[0] =~ s/(.*)<A[^>]*>(.*)<\/A>(.*)/$1$2$3/i; |
$table[0] = remove_anchor($table[0]); |
295 |
|
|
296 |
## grab next slide title $table[2] (if there's a next slide) |
## grab next slide title $table[2] (if there's a next slide) |
297 |
## to be able to use in the 'next' navigation button |
## to be able to use in the 'next' navigation button |
298 |
## keep in mind that $table[1] contains the slide corresponding to the title $table[0] |
## keep in mind that $table[1] contains the slide corresponding to the title $table[0] |
299 |
$next_slide_title = $table[2] if $table[2]; |
if ($table[2]) { |
300 |
## remove any anchor from the next slide title |
$next_title= remove_anchor($table[2]); |
301 |
$next_slide_title =~ s/(.*)<A[^>]*>(.*)<\/A>(.*)/$1$2$3/i; |
} |
302 |
|
|
303 |
## the current slide content is stored $table[1] |
## the current slide content is stored $table[1] |
304 |
## there is an attempt to make sure it's clean HTML |
## there is an attempt to make sure it's clean HTML |
308 |
|
|
309 |
## extract slide Sub Title <h2> |
## extract slide Sub Title <h2> |
310 |
undef $slideSubTitle; |
undef $slideSubTitle; |
311 |
if ($slideContent =~ s/<[hH]2[^>]*>([^<]+)<\/[hH]2[^>]*>//) { |
if ($slideContent =~ s/<[hH]2[^>]*>(.+)<\/[hH]2[^>]*>//sm) { |
312 |
$slideSubTitle=$1; |
$slideSubTitle=remove_anchor($1); |
313 |
} |
} |
314 |
|
|
315 |
## add the title of the current slide to the table of content |
## add the title of the current slide to the table of content |
318 |
## generate the current slide |
## generate the current slide |
319 |
## parameters are: |
## parameters are: |
320 |
## title of the slide, its content, the slide number, the title of the previous slide and the title of the next slide |
## title of the slide, its content, the slide number, the title of the previous slide and the title of the next slide |
321 |
&createSlide($slideTitle,$slideSubTitle,$slideContent ,$slideCount++,$previous_slide_title,$next_slide_title); |
&createSlide($slideTitle,$slideSubTitle,$slideContent ,$slideCount++,$prev_title,$next_title); |
322 |
|
|
323 |
## save the title of the previous slide to be displayed in the 'previous' navigation button |
## save the title of the previous slide to be displayed in the 'previous' navigation button |
324 |
$previous_slide_title="$table[0]"; |
$prev_title=remove_anchor($table[0]); |
325 |
} |
} |
326 |
## process the next slide |
## process the next slide |
327 |
while (shift(@table)); |
while (shift(@table)); |
335 |
## and would not work on all platforms (ie would fail on Joe's laptop) |
## and would not work on all platforms (ie would fail on Joe's laptop) |
336 |
&generateTOC; |
&generateTOC; |
337 |
|
|
338 |
|
## print additional files to pack |
339 |
|
print STDOUT join("\n",@pack_additional) if ($pack); |
340 |
|
|
341 |
print STDOUT "--- Finished ---\n"; |
print STDERR "--- Finished ---\n"; |
342 |
exit 0; |
exit 0; |
343 |
## |
## |
344 |
## end of the slidemaker main program |
## end of the slidemaker main program |
352 |
{ |
{ |
353 |
## open the file to write to |
## open the file to write to |
354 |
open(FOO, ">$_[0].html") || die "can't open $_[0].html: $!"; |
open(FOO, ">$_[0].html") || die "can't open $_[0].html: $!"; |
355 |
|
push @pack_additional,"$_[0].html" if ($pack); |
356 |
|
|
357 |
## the style sheet used in the table of content is |
## the style sheet used in the table of content is |
358 |
$stylelink = ""; |
$stylelink = ""; |
359 |
## here is the standard style sheet |
## here is the standard style sheet |
360 |
$stylelink .= "<link href=\"$cssStandard\" rel=\"stylesheet\" type=\"text/css\" title=\"Talk\" media=\"screen\">"; |
$stylelink .= "<link href=\"$cssStandard\" rel=\"stylesheet\" type=\"text/css\" title=\"Talk\" media=\"screen\">"; |
361 |
|
|
362 |
if ($logoFile) { |
%overview_data = ( |
363 |
$logo_html="<a href=\"$logoLink\"><img src=\"$logoFile\" alt=\"$logoAlt\" border=\"0\"></a>"; |
doctype => $doctype, |
364 |
} |
title => $title, |
365 |
|
http_equiv => $http_equiv, |
366 |
|
stylelink => $stylelink, |
367 |
|
body => $body, |
368 |
|
|
369 |
|
logoLink => $logoLink, |
370 |
|
logoFile => $logoFile, |
371 |
|
logoAlt => $logoAlt, |
372 |
|
logoLink2 => $logoLink2, |
373 |
|
logoFile2 => $logoFile2, |
374 |
|
logoAlt2 => $logoAlt2, |
375 |
|
|
376 |
|
talkTitle => $talkTitle, |
377 |
|
talkSubTitle => $talkSubTitle, |
378 |
|
|
379 |
|
content_hight => $content_hight, |
380 |
|
|
381 |
|
author => $author, |
382 |
|
authorUrl => $authorUrl, |
383 |
|
author2 => $author2, |
384 |
|
authorUrl2 => $authorUrl2, |
385 |
|
|
386 |
if ($logoFile2) { |
date => $date, |
|
$logo_html.="<a href=\"$logoLink2\"><img src=\"$logoFile2\" alt=\"$logoAlt2\" border=\"0\"></a>"; |
|
|
} |
|
387 |
|
|
388 |
$title_html="<h1>$talkTitle</h1>"; |
toc => $loc_toc, |
389 |
if (length $talkSubTitle != 0) { |
); |
|
$title_html.="<h2>$talkSubTitle</h2>"; |
|
|
} |
|
|
|
|
|
if (length $date != 0) { |
|
|
$date_html="($date)"; |
|
|
} |
|
|
|
|
|
print FOO <<END; |
|
|
$doctype |
|
|
<head> |
|
|
<title>$talkTitle - $loc_toc</title> |
|
|
$http_equiv |
|
|
$stylelink |
|
|
</head> |
|
|
$body |
|
|
<table height="100%" width="100%"> |
|
|
<tr> |
|
|
<td class="header-first" valign="top"> |
|
|
<table width="100%" border="0"> |
|
|
<tr> |
|
|
<td class="cell-logo">$logo_html</td> |
|
|
<td class="cell-heading">$title_html</td> |
|
|
</tr> |
|
|
</table> |
|
|
</td> |
|
|
</tr> |
|
|
<tr> |
|
|
<td height="80%" class="body" valign="top"> |
|
|
<div class="body"> |
|
|
<h3>$loc_toc</h3> |
|
|
<ul> |
|
|
END |
|
390 |
|
|
391 |
} |
} |
392 |
## |
## |
398 |
|
|
399 |
sub closeOverview |
sub closeOverview |
400 |
{ |
{ |
401 |
my $slide_html=make_progress_bar(0,$total); |
$overview_data{slide_html} = make_progress_bar(0,$total); |
402 |
print FOO <<END; |
$overview_data{toc_entries} = [ @toc_entries ]; |
403 |
</ul> |
|
404 |
</div> |
my $page= new Text::FastTemplate key => 'overview'; |
405 |
</td> |
print FOO $page->output( \%overview_data ); |
|
</tr> |
|
|
<tr> |
|
|
<td class="footer"> |
|
|
<table border="0" width="100%"> |
|
|
<tr> |
|
|
<td width="33%" class="footer-info"> |
|
|
<p> |
|
|
<i>$talkTitle</i> |
|
|
<br>$author $date_html |
|
|
</p> |
|
|
</td><td width="33%" class="footer-nav"> |
|
|
<table border="0"> |
|
|
<tr> |
|
|
<td> |
|
|
[ <a href="slide1.html">On with the show</a> ] |
|
|
</td> |
|
|
</tr> |
|
|
</table> |
|
|
</td><td width="33%" class="footer-count"> |
|
|
$slide_html |
|
|
$author2</td> |
|
|
</tr> |
|
|
</table> |
|
|
</td> |
|
|
</tr> |
|
|
</table> |
|
|
</body> |
|
|
</html> |
|
|
END |
|
406 |
|
|
407 |
close(FOO); |
close(FOO); |
408 |
} |
} |
428 |
if ($nr % $toc_on_page == 0) { |
if ($nr % $toc_on_page == 0) { |
429 |
my $toc_nr=int($nr/$toc_on_page); |
my $toc_nr=int($nr/$toc_on_page); |
430 |
|
|
431 |
print FOO <<END; |
$item = { |
432 |
<br><small><a accesskey=" " tabindex=" " href="index-toc$toc_nr.html">...</a></small></br> |
pre_html => $pre_ul, |
433 |
END |
accesskey => " ", # space |
434 |
|
href => "index-toc$toc_nr.html", |
435 |
|
title => "...", |
436 |
|
post_html => $post_ul, |
437 |
|
more => 1, # use style for more pages link (...) |
438 |
|
}; |
439 |
|
push @toc_entries, $item; |
440 |
|
|
441 |
&closeOverview; |
&closeOverview; |
442 |
|
undef @toc_entries; |
443 |
&openOverview("$overview-toc$toc_nr"); |
&openOverview("$overview-toc$toc_nr"); |
444 |
$last_toc_title=''; |
$last_toc_title=''; |
445 |
} |
} |
446 |
|
|
447 |
$ul1=$ul2=''; |
$pre_ul=$post_ul=''; |
448 |
if ($last_toc_title eq $title) { |
if ($last_toc_title eq $title && $subtitle) { |
449 |
$title = $subtitle; |
$title = $subtitle; |
450 |
$ul1='<ul>'; |
$pre_ul='<ul>'; |
451 |
$ul2='</ul>'; |
$post_ul='</ul>'; |
452 |
} else { |
} else { |
453 |
$last_toc_title=$title; |
$last_toc_title=$title; |
454 |
} |
} |
456 |
# add accesskey for first 9 slides (`1' - `9') or just for first |
# add accesskey for first 9 slides (`1' - `9') or just for first |
457 |
# TOC page, and tabindex for all slides |
# TOC page, and tabindex for all slides |
458 |
if ($nr < 10 && $nr < $toc_on_page) { |
if ($nr < 10 && $nr < $toc_on_page) { |
459 |
print FOO <<END; |
$item = { |
460 |
$ul1<li><a accesskey="$nr" tabindex="$nr" href="slide$nr.html">$title</a></li>$ul2 |
pre_html => $pre_ul, |
461 |
END |
accesskey => "$nr", |
462 |
|
tabindex => "$nr", |
463 |
|
href => "slide$nr.html", |
464 |
|
title => $title, |
465 |
|
post_html => $post_ul, |
466 |
|
more => 0, |
467 |
|
}; |
468 |
|
push @toc_entries,$item; |
469 |
} else { |
} else { |
470 |
print FOO <<END; |
$item = { |
471 |
$ul1<li><a tabindex="$nr" href="slide$nr.html">$title</a></li>$ul2 |
pre_html => $pre_ul, |
472 |
END |
tabindex => "$nr", |
473 |
|
href => "slide$nr.html", |
474 |
|
title => $title, |
475 |
|
post_html => $post_ul, |
476 |
|
}; |
477 |
|
push @toc_entries,$item; |
478 |
} |
} |
479 |
} |
} |
480 |
## |
## |
489 |
# parameters are respectively the slide title, its content, |
# parameters are respectively the slide title, its content, |
490 |
# its number, the next slide title and the previous slide title |
# its number, the next slide title and the previous slide title |
491 |
|
|
492 |
my ($title,$subtitle,$content,$nr,$next_title,$prev_title) = @_; |
my ($title,$subtitle,$content,$nr,$prev_title,$next_title) = @_; |
493 |
|
|
494 |
if (! $title) { |
if (! $title) { |
495 |
return 1; |
return 1; |
517 |
|
|
518 |
$status = sprintf "Slide %2d: %s %s\n", $nr, $title, $subtitle; |
$status = sprintf "Slide %2d: %s %s\n", $nr, $title, $subtitle; |
519 |
$status =~ s/<[^>]+>//g; |
$status =~ s/<[^>]+>//g; |
520 |
print STDOUT $status; |
print STDERR $status; |
521 |
|
|
522 |
&verify_html($content); # check the html |
&verify_html($content); # check the html |
523 |
|
|
524 |
## write to the slide |
## write to the slide |
525 |
open(SLIDE, ">slide$nr.html") || die "can't save slide$nr.html: $!"; |
open(SLIDE, ">slide$nr.html") || die "can't save slide$nr.html: $!"; |
526 |
|
push @pack_additional,"slide$nr.html" if ($pack); |
527 |
|
|
528 |
my $toclink = "[ <a href=\"$overview\.html\" title=\"Contents\">Contents</a> ]"; |
my $toc_link = "$overview\.html"; |
529 |
|
|
530 |
## initialization of the navigation links |
## initialization of the navigation links |
531 |
my $nextlink = ""; |
my $next_link = ""; |
532 |
my $prevlink = ""; |
my $prev_link = ""; |
533 |
|
|
534 |
if ($nr>1) { |
if ($nr>1) { |
535 |
$prevlink = "<a href=\"slide".($nr-1).".html\" title=\"Previous\"><<</a>"; |
$prev_link = "slide".($nr-1).".html"; |
536 |
# } else { |
# } else { |
537 |
# ## add a link back to the toc for the first slide --CMN 19991102 |
# ## add a link back to the toc for the first slide --CMN 19991102 |
538 |
# $prevlink = "<a href=\"$overview\.html\" title=\"Previous\"><<</a>"; |
# $prev_link = "$overview\.html"; |
539 |
} |
} |
540 |
|
|
541 |
if ($nr != $total) { |
if ($nr != $total) { |
542 |
$nextlink = "<a href=\"slide".($nr+1).".html\" title=\"Next\">>></a>"; |
$next_link = "slide".($nr+1).".html"; |
543 |
} |
} |
544 |
|
|
545 |
$stylelink = ""; |
$stylelink = ""; |
546 |
# here is the standard style sheet |
# here is the standard style sheet |
547 |
$stylelink .= "<link href=\"$cssStandard\" rel=\"stylesheet\" type=\"text/css\" title=\"Talk\">"; |
$stylelink .= "<link href=\"$cssStandard\" rel=\"stylesheet\" type=\"text/css\" title=\"Talk\">"; |
548 |
|
|
|
$title_html="<h1>$title</h1>"; |
|
|
if ($subtitle) { |
|
|
$title_html.="<h2>$subtitle</h2>"; |
|
|
} |
|
|
|
|
549 |
my $slide_html=make_progress_bar($nr,$total); |
my $slide_html=make_progress_bar($nr,$total); |
550 |
|
|
551 |
print SLIDE <<END; |
# undefine body if no content is found (so that template can show |
552 |
$doctype |
# only title and sub-title |
553 |
<head> |
if ($content !~ m/\S/g) { |
554 |
<title>$talkTitle - $title</title> |
undef $content; |
555 |
$http_equiv |
} |
556 |
$stylelink |
|
557 |
</head> |
%page_data = ( |
558 |
$body |
doctype => $doctype, |
559 |
<table height="100%" width="100%"> |
talkTitle => $talkTitle, |
560 |
<tr> |
title => $title, |
561 |
<td class="header-first" valign="top"> |
subtitle => $subtitle, |
562 |
<table width="100%" border="0"> |
http_equiv => $http_equiv, |
563 |
<tr> |
stylelink => $stylelink, |
564 |
<td class="cell-logo">$logo_html</td> |
body => $body, |
565 |
<td class="cell-heading">$title_html</td> |
|
566 |
</tr> |
logoLink => $logoLink, |
567 |
</table> |
logoFile => $logoFile, |
568 |
</td> |
logoAlt => $logoAlt, |
569 |
</tr> |
logoLink2 => $logoLink2, |
570 |
<tr> |
logoFile2 => $logoFile2, |
571 |
<td height="80%" class="body" valign="top"> |
logoAlt2 => $logoAlt2, |
572 |
<div class="body"> |
|
573 |
$content |
|
574 |
</div> |
content_hight => $content_hight, |
575 |
</td> |
content => $content, |
576 |
</tr> |
|
577 |
<tr> |
prev_link => $prev_link, |
578 |
<td class="footer"> |
toc_link => $toc_link, |
579 |
<table border="0" width="100%"> |
next_link => $next_link, |
580 |
<tr> |
prev_title => $prev_title, |
581 |
<td width="33%" class="footer-info"> |
next_title => $next_title, |
582 |
<p> |
|
583 |
<i>$talkTitle</i> |
author => $author, |
584 |
<br>$author $date_html |
authorUrl => $authorUrl, |
585 |
</p> |
author2 => $author2, |
586 |
</td><td width="33%" class="footer-nav"> |
authorUrl2 => $authorUrl2, |
587 |
<table border="0"> |
|
588 |
<tr> |
date => $date, |
589 |
<td> |
|
590 |
$prevlink |
slide_html => $slide_html, |
591 |
$toclink |
|
592 |
$nextlink |
); |
593 |
</td> |
|
594 |
</tr> |
my $page; |
595 |
</table> |
if ($content) { |
596 |
</td><td width="33%" class="footer-count"> |
$page= new Text::FastTemplate key => 'slide'; |
597 |
$slide_html |
} else { |
598 |
$author2</td> |
$page= new Text::FastTemplate key => 'title'; |
599 |
</tr> |
} |
600 |
</table> |
print SLIDE $page->output( \%page_data ); |
601 |
</td> |
extract_files($page->output( \%page_data )) if ($pack); |
|
</tr> |
|
|
</table> |
|
|
</body> |
|
|
</html> |
|
|
END |
|
|
|
|
602 |
close(SLIDE); |
close(SLIDE); |
603 |
return 0; |
return 0; |
604 |
} |
} |
646 |
|
|
647 |
if ($_[0] =~ /<img([^>]*)>/im) { |
if ($_[0] =~ /<img([^>]*)>/im) { |
648 |
if (!($1 =~ /ALT=/im)) { |
if (!($1 =~ /ALT=/im)) { |
649 |
print STDOUT "WARNING: <IMG> without ALT\n"; |
print STDERR "WARNING: <IMG> without ALT\n"; |
650 |
print STDOUT " <IMG$1>\n" ; |
print STDERR " <IMG$1>\n" ; |
651 |
} |
} |
652 |
} |
} |
653 |
} |
} |
656 |
# clean the html of the slide |
# clean the html of the slide |
657 |
# remove all <div class="comment">blabla</div> |
# remove all <div class="comment">blabla</div> |
658 |
sub clean_html { |
sub clean_html { |
659 |
$_[0] =~ s/<div\s+class\s*=\s*(?:comment[\s>]|\"comment\").*?<\/div>//igs; |
my $tmp=$_[0]; |
660 |
return $_[0]; |
$tmp =~ s/<div\s+class\s*=\s*(?:comment[\s>]|\"comment\").*?<\/div>//igs; |
661 |
|
$tmp =~ s,</*font[^>]+>,,ig; |
662 |
|
return $tmp; |
663 |
} |
} |
664 |
|
|
665 |
############################################################################## |
############################################################################## |
692 |
} else { |
} else { |
693 |
$r=$t; |
$r=$t; |
694 |
} |
} |
695 |
$html='<table border="0" width="30%" cellpadding="0" cellspacing="0" align="right"><tr><td width="'.$pcnt_done.'%" class="pcnt-done">'.$l.'</td><td width="'.$pcnt_left.'%" class="pcnt-left">'.$r.'</td></tr></table>'; |
$html='<table border="0" width="50%" cellpadding="0" cellspacing="0" align="right"><tr><td width="'.$pcnt_done.'%" class="pcnt-done">'.$l.'</td><td width="'.$pcnt_left.'%" class="pcnt-left">'.$r.'</td></tr></table>'; |
696 |
} else { |
} else { |
697 |
$html="$loc_slide $nr $loc_of $total"; |
$html="$loc_slide $nr $loc_of $total"; |
698 |
} |
} |
700 |
return $html; |
return $html; |
701 |
} |
} |
702 |
|
|
703 |
|
############################################################################## |
704 |
|
# remove anchors <a href...> from html (for titles) |
705 |
|
sub remove_anchor { |
706 |
|
my $tmp = $_[0]; |
707 |
|
$tmp =~ s/(.*)<A[^>]*>(.*)<\/A>(.*)/$1$2$3/ig; |
708 |
|
return $tmp; |
709 |
|
} |
710 |
|
|
711 |
|
############################################################################## |
712 |
|
# extract files referenced in presentation |
713 |
|
|
714 |
|
sub extract_files { |
715 |
|
my $tmp = $_[0]; |
716 |
|
while ($tmp =~ s/<a\s+href="*([^"\s]+)"*//ism || |
717 |
|
$tmp =~ s/<img\s+src="*([^"\s]+)"*//ism) { |
718 |
|
if ("$1" !~ m/[hf]t?tp:/ && -f "$1" && !grep(/$1/,@pack_additional)) { |
719 |
|
push @pack_additional,$1; |
720 |
|
} |
721 |
|
} |
722 |
|
} |