/[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.6 by dpavlin, Sat May 5 18:23:39 2001 UTC revision 1.7 by dpavlin, Sat May 5 19:20:27 2001 UTC
# Line 52  use Text::FastTemplate; Line 52  use Text::FastTemplate;
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    
# Line 126  $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;  my %page_data;
134  my %overview_data;  my %overview_data;
# Line 141  my %overview_data; Line 142  my %overview_data;
142    
143  # read parameters from infos.txt and put them in @PARAM  # read parameters from infos.txt and put them in @PARAM
144  if (open(INFOS, $infos)) {  if (open(INFOS, $infos)) {
145      print STDOUT "--- Reading parameters file $infos ---\n";          print STDOUT "--- Reading parameters file $infos ---\n";
146      local(@file,$counter);          local(@file,$counter);
147      $counter = 0;          $counter = 0;
148      @file = <INFOS>;          @file = <INFOS>;
149      @PARAM = ();          @PARAM = ();
150      do {          do {
151          if ($file[0] && $file[0] =~ /^[^#\n\r]/) {                  if ($file[0] && $file[0] =~ /^[^#\n\r]/) {
152             $file[0] =~ s/\n//;    # remove UNIX \n                          $file[0] =~ s/\n//;    # remove UNIX \n
153             $file[0] =~ s/\r//;    # remove WINDOWS \r                              $file[0] =~ s/\r//;    # remove WINDOWS \r    
154             $file[0] =~ s/ *= */=/;                          $file[0] =~ s/ *= */=/;
155             $PARAM[$counter++] = $file[0];                          $PARAM[$counter++] = $file[0];
156             print "$file[0]\n";                          print "$file[0]\n";
157          }                  }
158      } while (shift(@file));          } while (shift(@file));
159  }  }
160  ## @PARAM is now a table with the user preferences for his presentation  ## @PARAM is now a table with the user preferences for his presentation
161    
# Line 186  if ($charset) { Line 187  if ($charset) {
187  ## copy file in memory  ## copy file in memory
188  my $sep = $/;  my $sep = $/;
189  $/ = undef;  $/ = undef;
190  if (!open(ALL, $all)) {  open(ALL, $all) || die "Error: Cannot open file: $all";
     print "Error: Cannot open file: $all\n";  
     exit 0;  
 }  
191  my $buf = <ALL>;  my $buf = <ALL>;
192  close(ALL);  close(ALL);
193  $/ = $sep;  $/ = $sep;
# Line 236  Text::FastTemplate->preload( [ Line 234  Text::FastTemplate->preload( [
234                  { file => 'overview.html', key => 'overview' },                  { file => 'overview.html', key => 'overview' },
235          ]);          ]);
236    
237    ## unroll relative anchors (#something) into links with slides
238    
239    my %anchor_on_slide;
240    
241    ## step 1: record anchors
242    for($i=0; $i<$total; $i++) {
243            my $tmp = $table[($i*2)];
244            while ($tmp =~ s,<a +name="*([^>"]+)"*>,,i) {
245                    $anchor_on_slide{$1}=($i+1);
246                    print "\tslide ",($i+1)," anchor: $1\n" if ($debug);
247            }
248    }
249    
250    ## step 2: fix links
251    for($i=0; $i<$total; $i++) {
252            foreach (keys %anchor_on_slide) {
253                    $table[($i*2)] =~ s,href="*#$_"*>,href="slide$anchor_on_slide{$_}\.html#$_">,gi;
254            }
255    }
256    
257  ## @table is the array containing each slide with its title  ## @table is the array containing each slide with its title
258  ## for each slide to be generated  ## for each slide to be generated
259  ## we delete each slide and its title when generated  ## we delete each slide and its title when generated
260  ## 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)
261  ## and $table[1] (for the slide content)  ## and $table[1] (for the slide content)
262    
263    undef $prev_title;
264    undef $next_title;
265    
266  do {  do {
267    
268          ## 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 261  do { Line 283  do {
283          ## grab next slide title $table[2] (if there's a next slide)          ## grab next slide title $table[2] (if there's a next slide)
284          ## to be able to use in the 'next' navigation button          ## to be able to use in the 'next' navigation button
285          ## 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]
286          $next_slide_title = $table[2] if $table[2];          if ($table[2]) {
287          ## remove any anchor from the next slide title                  $next_title= $table[2];
288          $next_slide_title =~ s/(.*)<A[^>]*>(.*)<\/A>(.*)/$1$2$3/i;                  ## remove any anchor from the next slide title
289                    $next_title =~ s/(.*)<A[^>]*>(.*)<\/A>(.*)/$1$2$3/i;
290            }
291    
292          ## the current slide content is stored $table[1]          ## the current slide content is stored $table[1]
293          ## there is an attempt to make sure it's clean HTML          ## there is an attempt to make sure it's clean HTML
# Line 283  do { Line 307  do {
307          ## generate the current slide          ## generate the current slide
308          ## parameters are:          ## parameters are:
309          ## 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
310          &createSlide($slideTitle,$slideSubTitle,$slideContent ,$slideCount++,$previous_slide_title,$next_slide_title);          &createSlide($slideTitle,$slideSubTitle,$slideContent ,$slideCount++,$prev_title,$next_title);
311    
312          ## 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
313          $previous_slide_title="$table[0]";          $prev_title="$table[0]";
314  }  }
315  ## process the next slide  ## process the next slide
316  while (shift(@table));  while (shift(@table));
# Line 331  sub openOverview Line 355  sub openOverview
355                  logoLink => $logoLink,                  logoLink => $logoLink,
356                  logoFile => $logoFile,                  logoFile => $logoFile,
357                  logoAlt => $logoAlt,                  logoAlt => $logoAlt,
358                    logoLink2 => $logoLink2,
359                    logoFile2 => $logoFile2,
360                    logoAlt2 => $logoAlt2,
361    
362                  talkTitle => $talkTitle,                  talkTitle => $talkTitle,
363                  talkSubTitle => $talkSubTitle,                  talkSubTitle => $talkSubTitle,
# Line 447  sub createSlide Line 474  sub createSlide
474          # parameters are respectively the slide title, its content,          # parameters are respectively the slide title, its content,
475          # its number, the next slide title and the previous slide title          # its number, the next slide title and the previous slide title
476    
477          my ($title,$subtitle,$content,$nr,$next_title,$prev_title) = @_;          my ($title,$subtitle,$content,$nr,$prev_title,$next_title) = @_;
478    
479          if (! $title) {          if (! $title) {
480                  return 1;                  return 1;
# Line 482  sub createSlide Line 509  sub createSlide
509          ## write to the slide          ## write to the slide
510          open(SLIDE, ">slide$nr.html") || die "can't save slide$nr.html: $!";          open(SLIDE, ">slide$nr.html") || die "can't save slide$nr.html: $!";
511    
512          my $toclink = "[ <a href=\"$overview\.html\" title=\"Contents\">Contents</a> ]";          my $toc_link = "$overview\.html";
513    
514          ## initialization of the navigation links          ## initialization of the navigation links
515          my $nextlink = "";          my $next_link = "";
516          my $prevlink = "";          my $prev_link = "";
517    
518          if ($nr>1) {          if ($nr>1) {
519                  $prevlink = "<a href=\"slide".($nr-1).".html\" title=\"Previous\">&lt;&lt;</a>";                  $prev_link = "slide".($nr-1).".html";
520  #       } else {  #       } else {
521  #       ## 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
522  #               $prevlink = "<a href=\"$overview\.html\" title=\"Previous\">&lt;&lt;</a>";  #               $prev_link = "$overview\.html";
523          }          }
524    
525          if ($nr != $total) {          if ($nr != $total) {
526                  $nextlink = "<a href=\"slide".($nr+1).".html\" title=\"Next\">&gt;&gt;</a>";                  $next_link = "slide".($nr+1).".html";
527          }          }
528    
529          $stylelink = "";          $stylelink = "";
530          # here is the standard style sheet          # here is the standard style sheet
531          $stylelink .= "<link href=\"$cssStandard\" rel=\"stylesheet\" type=\"text/css\" title=\"Talk\">";          $stylelink .= "<link href=\"$cssStandard\" rel=\"stylesheet\" type=\"text/css\" title=\"Talk\">";
532    
         $title_html="<h1>$title</h1>";  
         if ($subtitle) {  
                 $title_html.="<h2>$subtitle</h2>";  
         }  
   
533          my $slide_html=make_progress_bar($nr,$total);          my $slide_html=make_progress_bar($nr,$total);
534    
535          %page_data = (          %page_data = (
536                  doctype => $doctype,                  doctype => $doctype,
537                  talkTitle => $talkTitle,                  talkTitle => $talkTitle,
538                  title => $title,                  title => $title,
539                    subtitle => $subtitle,
540                  http_equiv => $http_equiv,                  http_equiv => $http_equiv,
541                  stylelink => $stylelink,                  stylelink => $stylelink,
542                  body => $body,                  body => $body,
543    
544                  logo_html => $logo_html,                  logoLink => $logoLink,
545                  title_html => $title_html,                  logoFile => $logoFile,
546                    logoAlt => $logoAlt,
547                    logoLink2 => $logoLink2,
548                    logoFile2 => $logoFile2,
549                    logoAlt2 => $logoAlt2,
550    
551    
552                  content_hight => $content_hight,                  content_hight => $content_hight,
553                  content => $content,                  content => $content,
554    
555                    prev_link => $prev_link,
556                    toc_link => $toc_link,
557                    next_link => $next_link,
558                    prev_title => $prev_title,
559                    next_title => $next_title,
560    
561                  author => $author,                  author => $author,
562                  date_html => $date_html,                  authorUrl => $authorUrl,
563                  prevlink => $prevlink,                  author2 => $author2,
564                  toclink => $toclink,                  authorUrl2 => $authorUrl2,
565                  nextlink => $nextlink,  
566                    date => $date,
567    
568                  slide_html => $slide_html,                  slide_html => $slide_html,
                 author2 => $author2  
569    
570          );          );
571    

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

  ViewVC Help
Powered by ViewVC 1.1.26