/[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.3 by dpavlin, Tue Apr 17 13:40:36 2001 UTC revision 1.6 by dpavlin, Sat May 5 18:23:39 2001 UTC
# Line 1  Line 1 
1  #!/usr/local/bin/perl  #!/usr/bin/perl
2  #  #
3  # SLies Copyright 2001 Dobrica Pavlinusic <dpavlin@rot13.org>  # SLies Copyright 2001 Dobrica Pavlinusic <dpavlin@rot13.org>
4  #  #
# 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    use Text::FastTemplate;
50    
51  ##############################################################################  ##############################################################################
52  ## default values of variables  ## default values of variables
# Line 99  $talkTitle = 'Talk'; Line 104  $talkTitle = 'Talk';
104  ## standard style sheets  ## standard style sheets
105  $cssStandard = '../PLies/css/default.css';  $cssStandard = '../PLies/css/default.css';
106    
107    ## template name
108    $template = '../PLies/default';
109    
110  ## default charset use in meta tag http-equiv (undef to skip)  ## default charset use in meta tag http-equiv (undef to skip)
111  #$charset = 'ISO-8859-1';  #$charset = 'ISO-8859-1';
112    
# Line 121  $content_hight = "70%"; Line 129  $content_hight = "70%";
129  my $logo_html;  my $logo_html;
130  my $date_html;  my $date_html;
131  my $last_toc_title;  my $last_toc_title;
132    my %page_data;
133    my %overview_data;
134    
135  ##############################################################################  ##############################################################################
136  ## reading user input from $infos  ## reading user input from $infos
# Line 151  if (open(INFOS, $infos)) { Line 161  if (open(INFOS, $infos)) {
161  ## process arguments  ## process arguments
162  ## each preset variable is now re-attributed using the user preferences  ## each preset variable is now re-attributed using the user preferences
163  foreach (@PARAM) {  foreach (@PARAM) {
164      @_ = split(/ *= */,$_,2);          my ($var,$value) = split(/ *= */,$_,2);
165      $cmd="\$$_[0] = \'$_[1]\';";          $value=~s/'/\\'/g;
166      if (length $_[1] != 0) {          $cmd="\$$var = \'$value\';";
167          eval($cmd);          if ($value) {
168      }                  eval($cmd) || die "problem with eval of: $cmd";
169            } else {
170                    die "no value defined for $var";
171            }
172  }  }
173    
174  ## use charset  ## use charset
# Line 166  if ($charset) { Line 179  if ($charset) {
179          $http_equiv='';          $http_equiv='';
180  }  }
181    
   
 ## 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 = "<a href=\"$author2Url\">$author2</a>";  
 }  
 if ($author2) {  
     $author2 = "<br>$author2";  
 }  
   
182  ##############################################################################  ##############################################################################
183  ## read the raw html presentation  ## read the raw html presentation
184  ##  ##
# Line 229  print STDOUT "\n--- Processing $total sl Line 226  print STDOUT "\n--- Processing $total sl
226  ## start the slide count so we can number them  ## start the slide count so we can number them
227  $slideCount = 1;  $slideCount = 1;
228    
229    ## pre-load template slides using $template dir
230    Text::FastTemplate->defaults(
231                    path => [ $template ]
232            );
233    
234    Text::FastTemplate->preload( [
235                    { file => 'slide.html', key => 'slide' },
236                    { file => 'overview.html', key => 'overview' },
237            ]);
238    
239  ## @table is the array containing each slide with its title  ## @table is the array containing each slide with its title
240  ## for each slide to be generated  ## for each slide to be generated
# Line 315  sub openOverview Line 321  sub openOverview
321          ## here is the standard style sheet          ## here is the standard style sheet
322          $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\">";
323    
324          if ($logoFile) {          %overview_data = (
325                  $logo_html="<a href=\"$logoLink\"><img src=\"$logoFile\" alt=\"$logoAlt\" border=\"0\"></a>";                  doctype => $doctype,
326          }                  title => $title,
327                    http_equiv => $http_equiv,
328                    stylelink => $stylelink,
329                    body => $body,
330    
331                    logoLink => $logoLink,
332                    logoFile => $logoFile,
333                    logoAlt => $logoAlt,
334    
335                    talkTitle => $talkTitle,
336                    talkSubTitle => $talkSubTitle,
337    
338                    content_hight => $content_hight,
339    
340                    author => $author,
341                    authorUrl => $authorUrl,
342                    author2 => $author2,
343                    authorUrl2 => $authorUrl2,
344    
345          if ($logoFile2) {                  date => $date,
                 $logo_html.="<a href=\"$logoLink2\"><img src=\"$logoFile2\" alt=\"$logoAlt2\" border=\"0\"></a>";  
         }  
346    
347          $title_html="<h1>$talkTitle</h1>";                  toc => $loc_toc,
348          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="$content_hight" class="body" valign="top">  
                     <div class="body">  
                         <h3>$loc_toc</h3>  
                         <ul>  
 END  
349    
350  }  }
351  ##  ##
# Line 368  END Line 357  END
357    
358  sub closeOverview  sub closeOverview
359  {  {
360          my $slide_html=make_progress_bar(0,$total);          $overview_data{slide_html} = make_progress_bar(0,$total);
361          print FOO <<END;          $overview_data{toc_entries} = [ @toc_entries ];
362                          </ul>  
363                      </div>          my $page= new Text::FastTemplate key => 'overview';
364                  </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  
365    
366          close(FOO);          close(FOO);
367  }  }
# Line 427  sub addTitle Line 387  sub addTitle
387          if ($nr % $toc_on_page == 0) {          if ($nr % $toc_on_page == 0) {
388                  my $toc_nr=int($nr/$toc_on_page);                  my $toc_nr=int($nr/$toc_on_page);
389    
390                  print FOO <<END;                  %item = (
391  <br><small><a accesskey=" " tabindex=" " href="index-toc$toc_nr.html">...</a></small></br>                          pre_html => $pre_ul,
392  END                          accesskey => " ",       # space
393                            href => "index-toc$toc_nr.html",
394                            title => "...",
395                            post_html => $post_ul,
396                            more => 1,      # use style for more pages link (...)
397                    )
398    #               push @toc_entries, %item;
399    
400                  &closeOverview;                  &closeOverview;
401                  &openOverview("$overview-toc$toc_nr");                  &openOverview("$overview-toc$toc_nr");
402                  $last_toc_title='';                  $last_toc_title='';
403          }          }
404    
405          $ul1=$ul2='';          $pre_ul=$post_ul='';
406          if ($last_toc_title eq $title) {          if ($last_toc_title eq $title) {
407                  $title = $subtitle;                  $title = $subtitle;
408                  $ul1='<ul>';                  $pre_ul='<ul>';
409                  $ul2='</ul>';                  $post_ul='</ul>';
410          } else {          } else {
411                  $last_toc_title=$title;                  $last_toc_title=$title;
412          }          }
# Line 447  END Line 414  END
414          # add accesskey for first 9 slides (`1' - `9') or just for first          # add accesskey for first 9 slides (`1' - `9') or just for first
415          # TOC page, and tabindex for all slides          # TOC page, and tabindex for all slides
416          if ($nr < 10 && $nr < $toc_on_page) {          if ($nr < 10 && $nr < $toc_on_page) {
417                  print FOO <<END;                  $item = {
418  $ul1<li><a accesskey="$nr" tabindex="$nr" href="slide$nr.html">$title</a></li>$ul2                          pre_html => $pre_ul,
419  END                          accesskey => "$nr",
420                            tabindex => "$nr",
421                            href => "slide$nr.html",
422                            title => $title,
423                            post_html => $post_ul,
424                            more => 0,
425                    };
426                    push @toc_entries,$item;
427          } else {          } else {
428                  print FOO <<END;                  %item = (
429  $ul1<li><a tabindex="$nr" href="slide$nr.html">$title</a></li>$ul2                          pre_html => $pre_ul,
430  END                          tabindex => "$nr",
431                            href => "slide$nr.html",
432                            title => $title,
433                            post_html => $post_ul,
434                    )
435    #               push @toc_entries,\%item;
436          }          }
437  }  }
438  ##  ##
# Line 531  sub createSlide Line 510  sub createSlide
510    
511          my $slide_html=make_progress_bar($nr,$total);          my $slide_html=make_progress_bar($nr,$total);
512    
513          print SLIDE <<END;          %page_data = (
514  $doctype                  doctype => $doctype,
515      <head>                  talkTitle => $talkTitle,
516              <title>$talkTitle - $title</title>                  title => $title,
517              $http_equiv                  http_equiv => $http_equiv,
518              $stylelink                  stylelink => $stylelink,
519       </head>                  body => $body,
520       $body  
521          <table height="100%" width="100%">                  logo_html => $logo_html,
522              <tr>                  title_html => $title_html,
523                  <td class="header-first" valign="top">                  content_hight => $content_hight,
524                      <table width="100%" border="0">                  content => $content,
525                          <tr>                  author => $author,
526                              <td class="cell-logo">$logo_html</td>                  date_html => $date_html,
527                              <td class="cell-heading">$title_html</td>                  prevlink => $prevlink,
528                          </tr>                  toclink => $toclink,
529                      </table>                  nextlink => $nextlink,
530                  </td>                  slide_html => $slide_html,
531              </tr>                  author2 => $author2
532              <tr>  
533                  <td height="$content_hight" class="body" valign="top">          );
534                      <div class="body">  
535  $content          my $page= new Text::FastTemplate key => 'slide';
536                      </div>          print SLIDE $page->output( \%page_data );
                 </td>  
             </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>  
 $prevlink  
 $toclink  
 $nextlink  
                                         </td>  
                                     </tr>  
                                 </table>  
                             </td><td width="33%" class="footer-count">  
                                 $slide_html  
                                 $author2</td>  
                         </tr>  
                     </table>  
                 </td>  
             </tr>  
         </table>  
     </body>  
 </html>  
 END  
537    
538          close(SLIDE);          close(SLIDE);
539          return 0;          return 0;
# Line 679  sub make_progress_bar { Line 626  sub make_progress_bar {
626                  } else {                  } else {
627                          $r=$t;                          $r=$t;
628                  }                  }
629                  $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>';
630          } else {          } else {
631                  $html="$loc_slide $nr $loc_of $total";                  $html="$loc_slide $nr $loc_of $total";
632          }          }

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

  ViewVC Help
Powered by ViewVC 1.1.26