/[PLies]/burst.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /burst.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by dpavlin, Tue Apr 17 09:47:30 2001 UTC revision 1.18 by dpavlin, Fri May 11 23:46:40 2001 UTC
# Line 1  Line 1 
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
# Line 42  Line 42 
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=0;
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    
# Line 101  $talkTitle = 'Talk'; Line 107  $talkTitle = 'Talk';
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    
# Line 120  $content_hight = "70%"; Line 129  $content_hight = "70%";
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
141  ##  ##
142  @PARAM = @ARGV; # we keep this for backward compatibility with an old version  my @file;
143                  # of the slidemaker tool  
144                  #when the parameters were in Makefile or make.bat  ##############################################################################
145    sub parse_infos {
146            my @file=@_;
147            do {
148                    if ($file[0] && $file[0] =~ /^[^#\n\r]/) {
149                            $file[0] =~ s/\n//;    # remove UNIX \n
150                            $file[0] =~ s/\r//;    # remove WINDOWS \r    
151                            my ($var,$value) = split(/ *= */,$file[0],2);
152                            $value=~s/'/\\'/g;
153                            $cmd="\$$var = \'$value\';";
154                            if (defined($value)) {
155                                    eval($cmd) || warn "problem with eval of: $cmd";
156                            } else {
157                                    die "no value defined for $var";
158                            }
159                            print STDERR "$file[0]\n";
160                    }
161            } while (shift(@file));
162    }
163    ##############################################################################
164    
165    parse_infos(@ARGV);     # backward compatibility and for pack
166    
167  # read parameters from infos.txt and put them in @PARAM  # read parameters from infos.txt and put them in @PARAM
168  if (open(INFOS, $infos)) {  if (open(INFOS, $infos)) {
169      print STDOUT "--- Reading parameters file $infos ---\n";          print STDERR "--- Reading parameters file $infos ---\n";
170      local(@file,$counter);          @file = <INFOS>;
171      $counter = 0;          parse_infos(@file);
     @file = <INFOS>;  
     @PARAM = ();  
     do {  
         if ($file[0] && $file[0] =~ /^[^#\n\r]/) {  
            $file[0] =~ s/\n//;    # remove UNIX \n  
            $file[0] =~ s/\r//;    # remove WINDOWS \r      
            $file[0] =~ s/ *= */=/;  
            $PARAM[$counter++] = $file[0];  
            print "$file[0]\n";  
         }  
     } while (shift(@file));  
172  }  }
 ## @PARAM is now a table with the user preferences for his presentation  
173    
174  ## process arguments  # try to read local infos.txt for template
175  ## each preset variable is now re-attributed using the user preferences  if (-f "$template/$infos" && open(INFOS,"$template/$infos")) {
176  foreach (@PARAM) {          print STDERR "--- Reading template parameters file $template/$infos ---\n";
177      @_ = split(/ *= */,$_,2);          @file = <INFOS>;
178      $cmd="\$$_[0] = \'$_[1]\';";          parse_infos(@file);
179      if (length $_[1] != 0) {          close(INFOS);
         eval($cmd);  
     }  
180  }  }
181    
182    ## @PARAM is now a table with the user preferences for his presentation
183    
184  ## use charset  ## use charset
185    
186  if ($charset) {  if ($charset) {
# Line 169  if ($charset) { Line 190  if ($charset) {
190  }  }
191    
192    
 ## 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";  
 }  
   
193  ##############################################################################  ##############################################################################
194  ## read the raw html presentation  ## read the raw html presentation
195  ##  ##
# Line 190  if ($author2Url) { Line 197  if ($author2Url) {
197  ## copy file in memory  ## copy file in memory
198  my $sep = $/;  my $sep = $/;
199  $/ = undef;  $/ = undef;
200  if (!open(ALL, $all)) {  open(ALL, $all) || die "Error: Cannot open file: $all";
     print "Error: Cannot open file: $all\n";  
     exit 0;  
 }  
201  my $buf = <ALL>;  my $buf = <ALL>;
202    $buf =~ s/\r//g;        # remove WINDOWS \r    
203  close(ALL);  close(ALL);
204  $/ = $sep;  $/ = $sep;
205    
# Line 202  $/ = $sep; Line 207  $/ = $sep;
207  ## they do not need to show up on the slides  ## they do not need to show up on the slides
208  $buf =~ s/<!--.*?-->//sgo;  $buf =~ s/<!--.*?-->//sgo;
209    
210    ## if $pack is set, output name of css (for inclusion in archive), but
211    ## reset $cssStandard only to filename (without path)
212    
213    if ($pack) {
214            push @pack_additional,$cssStandard;
215            $cssStandard =~ s/^.*\/([^\/]+)$/$1/g;
216    }
217    
218  ## 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
219  ## if not it will generate a rather weird output  ## if not it will generate a rather weird output
220  ## split using <h1...> and </h1...> as separator (ignores attributes!)  ## split using <h1...> and </h1...> as separator (ignores attributes!)
# Line 221  if ($#table % 2 != 0) { Line 234  if ($#table % 2 != 0) {
234  ##############################################################################  ##############################################################################
235  ## processing the slides  ## processing the slides
236    
237  print STDOUT "\n--- Processing $total slides ---\n";  print STDERR "\n--- Processing $total slides ---\n";
238    
239  ## generate the header table of content of the presentation  ## generate the header table of content of the presentation
240  ## which is also the first page of the talk  ## which is also the first page of the talk
# Line 230  print STDOUT "\n--- Processing $total sl Line 243  print STDOUT "\n--- Processing $total sl
243  ## start the slide count so we can number them  ## start the slide count so we can number them
244  $slideCount = 1;  $slideCount = 1;
245    
246    ## pre-load template slides using $template dir
247    Text::FastTemplate->defaults(
248                    path => [ $template ]
249            );
250    
251    Text::FastTemplate->preload( [
252                    { file => 'slide.html', key => 'slide' },
253                    { file => 'overview.html', key => 'overview' },
254                    { file => 'title.html', key => 'title' },
255            ]);
256    
257    ## unroll relative anchors (#something) into links with slides
258    
259    my %anchor_on_slide;
260    
261    ## step 1: record anchors
262    for($i=0; $i<$total; $i++) {
263            my $tmp = $table[($i*2)].$table[($i*2)+1];
264            while ($tmp =~ s,<a +name="*([^>"]+)"*>,,i) {
265                    $anchor_on_slide{$1}=($i+1);
266                    print STDERR "\tslide ",($i+1)," anchor: $1\n" if ($debug);
267            }
268    }
269    
270    ## step 2: fix links
271    for($i=0; $i<$total; $i++) {
272            foreach (keys %anchor_on_slide) {
273                    $table[($i*2)] =~ s,href="*#$_"*>,href="slide$anchor_on_slide{$_}\.html#$_">,gi;
274            }
275    }
276    
277  ## @table is the array containing each slide with its title  ## @table is the array containing each slide with its title
278  ## for each slide to be generated  ## for each slide to be generated
279  ## we delete each slide and its title when generated  ## we delete each slide and its title when generated
280  ## 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)
281  ## and $table[1] (for the slide content)  ## and $table[1] (for the slide content)
282    
283    undef $prev_title;
284    undef $next_title;
285    
286  do {  do {
287    
288          ## get rid of the first element contained by the raw presentation array          ## get rid of the first element contained by the raw presentation array
# Line 251  do { Line 298  do {
298          ## need to check if the title contains any anchor          ## need to check if the title contains any anchor
299          ## if so it needs to be removed          ## if so it needs to be removed
300          ## 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
301          $table[0] =~ s/(.*)<A[^>]*>(.*)<\/A>(.*)/$1$2$3/i;          $table[0] = remove_anchor($table[0]);
302    
303          ## grab next slide title $table[2] (if there's a next slide)          ## grab next slide title $table[2] (if there's a next slide)
304          ## to be able to use in the 'next' navigation button          ## to be able to use in the 'next' navigation button
305          ## 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]
306          $next_slide_title = $table[2] if $table[2];          if ($table[2]) {
307          ## remove any anchor from the next slide title                  $next_title= remove_anchor($table[2]);
308          $next_slide_title =~ s/(.*)<A[^>]*>(.*)<\/A>(.*)/$1$2$3/i;          }
309    
310          ## the current slide content is stored $table[1]          ## the current slide content is stored $table[1]
311          ## there is an attempt to make sure it's clean HTML          ## there is an attempt to make sure it's clean HTML
# Line 268  do { Line 315  do {
315    
316          ## extract slide Sub Title <h2>          ## extract slide Sub Title <h2>
317          undef $slideSubTitle;          undef $slideSubTitle;
318          if ($slideContent =~ s/<[hH]2[^>]*>([^<]+)<\/[hH]2[^>]*>//) {          if ($slideContent =~ s/<[hH]2[^>]*>(.+)<\/[hH]2[^>]*>//sm) {
319                  $slideSubTitle=$1;                  $slideSubTitle=remove_anchor($1);
320          }          }
321    
322          ## add the title of the current slide to the table of content          ## add the title of the current slide to the table of content
# Line 278  do { Line 325  do {
325          ## generate the current slide          ## generate the current slide
326          ## parameters are:          ## parameters are:
327          ## 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
328          &createSlide($slideTitle,$slideSubTitle,$slideContent ,$slideCount++,$previous_slide_title,$next_slide_title);          &createSlide($slideTitle,$slideSubTitle,$slideContent ,$slideCount++,$prev_title,$next_title);
329    
330          ## 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
331          $previous_slide_title="$table[0]";          $prev_title=remove_anchor($table[0]);
332  }  }
333  ## process the next slide  ## process the next slide
334  while (shift(@table));  while (shift(@table));
# Line 295  while (shift(@table)); Line 342  while (shift(@table));
342  ## 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)
343  &generateTOC;  &generateTOC;
344    
345    ## print additional files to pack
346    print STDOUT join("\n",@pack_additional) if ($pack);
347    
348  print STDOUT "--- Finished ---\n";  print STDERR "--- Finished ---\n";
349  exit 0;  exit 0;
350  ##  ##
351  ## end of the slidemaker main program  ## end of the slidemaker main program
# Line 310  sub openOverview Line 359  sub openOverview
359  {  {
360          ## open the file to write to          ## open the file to write to
361          open(FOO, ">$_[0].html") || die "can't open $_[0].html: $!";          open(FOO, ">$_[0].html") || die "can't open $_[0].html: $!";
362            push @pack_additional,"$_[0].html" if ($pack);
363    
364          ## the style sheet used in the table of content is          ## the style sheet used in the table of content is
365          $stylelink = "";          $stylelink = "";
366          ## here is the standard style sheet          ## here is the standard style sheet
367          $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\">";
368    
369          if ($logoFile) {          %overview_data = (
370                  $logo_html="<a href=\"$logoLink\"><img src=\"$logoFile\" alt=\"$logoAlt\" border=\"0\"></a>";                  doctype => $doctype,
371          }                  title => $title,
372                    http_equiv => $http_equiv,
373          if ($logoFile2) {                  stylelink => $stylelink,
374                  $logo_html.="<a href=\"$logoLink2\"><img src=\"$logoFile2\" alt=\"$logoAlt2\" border=\"0\"></a>";                  body => $body,
375          }  
376                    logoLink => $logoLink,
377          $title_html="<h1>$talkTitle</h1>";                  logoFile => $logoFile,
378          if (length $talkSubTitle != 0) {                  logoAlt => $logoAlt,
379                  $title_html.="<h2>$talkSubTitle</h2>";                  logoLink2 => $logoLink2,
380          }                  logoFile2 => $logoFile2,
381                    logoAlt2 => $logoAlt2,
382          if (length $date != 0) {  
383                  $date_html="($date)";                  talkTitle => $talkTitle,
384          }                  talkSubTitle => $talkSubTitle,
385    
386          print FOO <<END;                  content_hight => $content_hight,
387  $doctype  
388      <head>                  author => $author,
389              <title>$talkTitle - $loc_toc</title>                  authorUrl => $authorUrl,
390              $http_equiv                  author2 => $author2,
391              $stylelink                  author2Url => $author2Url,
392       </head>  
393       $body                  date => $date,
394          <table height="100%" width="100%">  
395              <tr>                  toc_title => $loc_toc,
396                  <td class="header-first" valign="top">                  template_dir => "$template/",
397                      <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="$content_hight" class="body" valign="top">  
                     <div class="body">  
                         <h3>$loc_toc</h3>  
                         <ul>  
 END  
398    
399  }  }
400  ##  ##
# Line 369  END Line 406  END
406    
407  sub closeOverview  sub closeOverview
408  {  {
409          my $slide_html=make_progress_bar(0,$total);          $overview_data{slide_html} = make_progress_bar(0,$total);
410          print FOO <<END;          $overview_data{toc_entries} = [ @toc_entries ];
411                          </ul>  
412                      </div>          my $page= new Text::FastTemplate key => 'overview';
413                  </td>          $page_data{template_dir}='' if ($pack);
414              </tr>          print FOO $page->output( \%overview_data );
             <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  
415    
416          close(FOO);          close(FOO);
417  }  }
# Line 428  sub addTitle Line 437  sub addTitle
437          if ($nr % $toc_on_page == 0) {          if ($nr % $toc_on_page == 0) {
438                  my $toc_nr=int($nr/$toc_on_page);                  my $toc_nr=int($nr/$toc_on_page);
439    
440                  print FOO <<END;                  $item = {
441  <br><small><a accesskey=" " tabindex=" " href="index-toc$toc_nr.html">...</a></small></br>                          pre_html => $pre_ul,
442  END                          accesskey => " ",       # space
443                            href => "index-toc$toc_nr.html",
444                            title => "...",
445                            post_html => $post_ul,
446                            more => 1,      # use style for more pages link (...)
447                    };
448                    push @toc_entries, $item;
449    
450                  &closeOverview;                  &closeOverview;
451                    undef @toc_entries;
452                  &openOverview("$overview-toc$toc_nr");                  &openOverview("$overview-toc$toc_nr");
453                  $last_toc_title='';                  $last_toc_title='';
454          }          }
455    
456          $ul1=$ul2='';          $pre_ul=$post_ul='';
457          if ($last_toc_title eq $title) {          if ($last_toc_title eq $title && $subtitle) {
458                  $title = $subtitle;                  $title = $subtitle;
459                  $ul1='<ul>';                  $pre_ul='<ul>';
460                  $ul2='</ul>';                  $post_ul='</ul>';
461          } else {          } else {
462                  $last_toc_title=$title;                  $last_toc_title=$title;
463          }          }
# Line 448  END Line 465  END
465          # add accesskey for first 9 slides (`1' - `9') or just for first          # add accesskey for first 9 slides (`1' - `9') or just for first
466          # TOC page, and tabindex for all slides          # TOC page, and tabindex for all slides
467          if ($nr < 10 && $nr < $toc_on_page) {          if ($nr < 10 && $nr < $toc_on_page) {
468                  print FOO <<END;                  $item = {
469  $ul1<li><a accesskey="$nr" tabindex="$nr" href="slide$nr.html">$title</a></li>$ul2                          pre_html => $pre_ul,
470  END                          accesskey => "$nr",
471                            tabindex => "$nr",
472                            href => "slide$nr.html",
473                            title => $title,
474                            post_html => $post_ul,
475                            more => 0,
476                    };
477                    push @toc_entries,$item;
478          } else {          } else {
479                  print FOO <<END;                  $item = {
480  $ul1<li><a tabindex="$nr" href="slide$nr.html">$title</a></li>$ul2                          pre_html => $pre_ul,
481  END                          tabindex => "$nr",
482                            href => "slide$nr.html",
483                            title => $title,
484                            post_html => $post_ul,
485                    };
486                    push @toc_entries,$item;
487          }          }
488  }  }
489  ##  ##
# Line 469  sub createSlide Line 498  sub createSlide
498          # parameters are respectively the slide title, its content,          # parameters are respectively the slide title, its content,
499          # its number, the next slide title and the previous slide title          # its number, the next slide title and the previous slide title
500    
501          my ($title,$subtitle,$content,$nr,$next_title,$prev_title) = @_;          my ($title,$subtitle,$content,$nr,$prev_title,$next_title) = @_;
502    
503          if (! $title) {          if (! $title) {
504                  return 1;                  return 1;
# Line 497  sub createSlide Line 526  sub createSlide
526    
527          $status = sprintf "Slide %2d: %s %s\n", $nr, $title, $subtitle;          $status = sprintf "Slide %2d: %s %s\n", $nr, $title, $subtitle;
528          $status =~ s/<[^>]+>//g;          $status =~ s/<[^>]+>//g;
529          print STDOUT $status;          print STDERR $status;
530    
531          &verify_html($content);    # check the html          &verify_html($content);    # check the html
532    
533          ## write to the slide          ## write to the slide
534          open(SLIDE, ">slide$nr.html") || die "can't save slide$nr.html: $!";          open(SLIDE, ">slide$nr.html") || die "can't save slide$nr.html: $!";
535            push @pack_additional,"slide$nr.html" if ($pack);
536    
537          my $toclink = "[ <a href=\"$overview\.html\" title=\"Contents\">Contents</a> ]";          my $toc_link = "$overview\.html";
538    
539          ## initialization of the navigation links          ## initialization of the navigation links
540          my $nextlink = "";          my $next_link = "";
541          my $prevlink = "";          my $prev_link = "";
542    
543          if ($nr>1) {          if ($nr>1) {
544                  $prevlink = "<a href=\"slide".($nr-1).".html\" title=\"Previous\">&lt;&lt;</a>";                  $prev_link = "slide".($nr-1).".html";
545  #       } else {  #       } else {
546  #       ## 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
547  #               $prevlink = "<a href=\"$overview\.html\" title=\"Previous\">&lt;&lt;</a>";  #               $prev_link = "$overview\.html";
548          }          }
549    
550          if ($nr != $total) {          if ($nr != $total) {
551                  $nextlink = "<a href=\"slide".($nr+1).".html\" title=\"Next\">&gt;&gt;</a>";                  $next_link = "slide".($nr+1).".html";
552          }          }
553    
554          $stylelink = "";          $stylelink = "";
555          # here is the standard style sheet          # here is the standard style sheet
556          $stylelink .= "<link href=\"$cssStandard\" rel=\"stylesheet\" type=\"text/css\" title=\"Talk\">";          $stylelink .= "<link href=\"$cssStandard\" rel=\"stylesheet\" type=\"text/css\" title=\"Talk\">";
557    
         $title_html="<h1>$title</h1>";  
         if ($subtitle) {  
                 $title_html.="<h2>$subtitle</h2>";  
         }  
   
558          my $slide_html=make_progress_bar($nr,$total);          my $slide_html=make_progress_bar($nr,$total);
559    
560          print SLIDE <<END;          # undefine body if no content is found (so that template can show
561  $doctype          # only title and sub-title
562      <head>          if ($content !~ m/\S/g) {
563              <title>$talkTitle - $title</title>                  undef $content;
564              $http_equiv          }
565              $stylelink  
566       </head>          %page_data = (
567       $body                  doctype => $doctype,
568          <table height="100%" width="100%">                  talkTitle => $talkTitle,
569              <tr>                  title => $title,
570                  <td class="header-first" valign="top">                  subtitle => $subtitle,
571                      <table width="100%" border="0">                  http_equiv => $http_equiv,
572                          <tr>                  stylelink => $stylelink,
573                              <td class="cell-logo">$logo_html</td>                  body => $body,
574                              <td class="cell-heading">$title_html</td>  
575                          </tr>                  logoLink => $logoLink,
576                      </table>                  logoFile => $logoFile,
577                  </td>                  logoAlt => $logoAlt,
578              </tr>                  logoLink2 => $logoLink2,
579              <tr>                  logoFile2 => $logoFile2,
580                  <td height="$content_hight" class="body" valign="top">                  logoAlt2 => $logoAlt2,
581                      <div class="body">  
582  $content  
583                      </div>                  content_hight => $content_hight,
584                  </td>                  content => $content,
585              </tr>  
586              <tr>                  prev_link => $prev_link,
587                  <td class="footer">                  toc_link => $toc_link,
588                      <table border="0" width="100%">                  next_link => $next_link,
589                          <tr>                  prev_title => $prev_title,
590                              <td width="33%" class="footer-info">                  toc_title => $loc_toc,
591                                  <p>                  next_title => $next_title,
592                                      <i>$talkTitle</i>  
593                                      <br>$author $date_html                  author => $author,
594                                  </p>                  authorUrl => $authorUrl,
595                              </td><td width="33%" class="footer-nav">                  author2 => $author2,
596                                  <table border="0">                  author2Url => $author2Url,
597                                      <tr>  
598                                          <td>                  date => $date,
599  $prevlink  
600  $toclink                  slide_html => $slide_html,
601  $nextlink  
602                                          </td>                  template_dir => "$template/",
603                                      </tr>          );
604                                  </table>  
605                              </td><td width="33%" class="footer-count">          my $page;
606                                  $slide_html          if ($content) {
607                                  $author2</td>                  $page= new Text::FastTemplate key => 'slide';
608                          </tr>          } else {
609                      </table>                  $page= new Text::FastTemplate key => 'title';
610                  </td>          }
611              </tr>          $page_data{template_dir}='' if ($pack);
612          </table>          print SLIDE $page->output( \%page_data );
613      </body>          extract_files($page->output( \%page_data )) if ($pack);
 </html>  
 END  
   
614          close(SLIDE);          close(SLIDE);
615          return 0;          return 0;
616  }  }
# Line 636  sub verify_html { Line 658  sub verify_html {
658    
659      if ($_[0] =~ /<img([^>]*)>/im) {      if ($_[0] =~ /<img([^>]*)>/im) {
660          if (!($1 =~ /ALT=/im)) {          if (!($1 =~ /ALT=/im)) {
661              print STDOUT "WARNING: <IMG> without ALT\n";              print STDERR "WARNING: <IMG> without ALT\n";
662              print STDOUT "         <IMG$1>\n" ;              print STDERR "         <IMG$1>\n" ;
663          }          }
664      }      }
665  }  }
# Line 646  sub verify_html { Line 668  sub verify_html {
668  # clean the html of the slide  # clean the html of the slide
669  # remove all <div class="comment">blabla</div>  # remove all <div class="comment">blabla</div>
670  sub clean_html {  sub clean_html {
671      $_[0] =~ s/<div\s+class\s*=\s*(?:comment[\s>]|\"comment\").*?<\/div>//igs;          my $tmp=$_[0];
672      return $_[0];          $tmp =~ s/<div\s+class\s*=\s*(?:comment[\s>]|\"comment\").*?<\/div>//igs;
673            $tmp =~ s,</*font[^>]+>,,ig;
674            return $tmp;
675  }  }
676    
677  ##############################################################################  ##############################################################################
# Line 672  sub make_progress_bar { Line 696  sub make_progress_bar {
696          my $pcnt_done=int($nr*100/$total);          my $pcnt_done=int($nr*100/$total);
697          my $pcnt_left=100-$pcnt_done;          my $pcnt_left=100-$pcnt_done;
698    
699          if ($progress_bar) {          if ($progress_bar && uc($progress_bar) ne "NO") {
700                  my $l=$r="&nbsp;";                  my $l=$r="&nbsp;";
701                  my $t="$nr of $total";                  my $t="$nr of $total";
702                  if ($pcnt_done > 50) {                  if ($pcnt_done > 50) {
# Line 680  sub make_progress_bar { Line 704  sub make_progress_bar {
704                  } else {                  } else {
705                          $r=$t;                          $r=$t;
706                  }                  }
707                  $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>';
708                    if ($pcnt_done != 0) {
709                            $html.='<td width="'.$pcnt_done.'%" class="pcnt-done">'.$l.'</td>';
710                    }
711                    if ($pcnt_left != 0) {
712                            $html.='<td width="'.$pcnt_left.'%" class="pcnt-left">'.$r.'</td>';
713                    }
714                    $html.='</tr></table>';
715          } else {          } else {
716                  $html="$loc_slide $nr $loc_of $total";                  $html="$loc_slide $nr $loc_of $total";
717          }          }
# Line 688  sub make_progress_bar { Line 719  sub make_progress_bar {
719          return $html;          return $html;
720  }  }
721    
722    ##############################################################################
723    # remove anchors <a href...> from html (for titles)
724    sub remove_anchor {
725            my $tmp = $_[0];
726            $tmp =~ s/(.*)<A[^>]*>(.*)<\/A>(.*)/$1$2$3/ig;
727            return $tmp;
728    }
729    
730    ##############################################################################
731    # extract files referenced in presentation
732    
733    sub extract_files {
734            my $tmp = $_[0];
735            while ($tmp =~ s/href="*([^"\s]+)"*//ism ||
736                    $tmp =~ s/src="*([^"\s]+)"*//ism) {
737                    if ("$1" !~ m/[hf]t?tp:/ && -f "$1" && !grep(/$1/,@pack_additional)) {
738                            push @pack_additional,$1;
739                    }
740            }
741    }

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.18

  ViewVC Help
Powered by ViewVC 1.1.26