--- burst.pl 2001/04/20 08:01:02 1.4 +++ burst.pl 2001/05/05 18:23:39 1.6 @@ -1,4 +1,4 @@ -#!/usr/local/bin/perl +#!/usr/bin/perl # # SLies Copyright 2001 Dobrica Pavlinusic # @@ -42,6 +42,11 @@ # # Sami Lempinen - lempinen@iki.fi # http://www.snowman.sgic.fi/ssl/xslies/ +# +# Text::FastTemplate: +# Robert Lehr - bozzio@the-lehrs.com + +use Text::FastTemplate; ############################################################################## ## default values of variables @@ -99,6 +104,9 @@ ## standard style sheets $cssStandard = '../PLies/css/default.css'; +## template name +$template = '../PLies/default'; + ## default charset use in meta tag http-equiv (undef to skip) #$charset = 'ISO-8859-1'; @@ -121,6 +129,8 @@ my $logo_html; my $date_html; my $last_toc_title; +my %page_data; +my %overview_data; ############################################################################## ## reading user input from $infos @@ -151,11 +161,14 @@ ## process arguments ## each preset variable is now re-attributed using the user preferences foreach (@PARAM) { - @_ = split(/ *= */,$_,2); - $cmd="\$$_[0] = \'$_[1]\';"; - if (length $_[1] != 0) { - eval($cmd); - } + my ($var,$value) = split(/ *= */,$_,2); + $value=~s/'/\\'/g; + $cmd="\$$var = \'$value\';"; + if ($value) { + eval($cmd) || die "problem with eval of: $cmd"; + } else { + die "no value defined for $var"; + } } ## use charset @@ -166,22 +179,6 @@ $http_equiv=''; } - -## build an html string for the author variable -## containing the presentation author name linked to -## a location of his choice -if ($authorUrl) { - $author = "$author"; -} - -## same string is built if there is a second author for the presentation -if ($author2Url) { - $author2 = "$author2"; -} -if ($author2) { - $author2 = "
$author2"; -} - ############################################################################## ## read the raw html presentation ## @@ -229,6 +226,15 @@ ## start the slide count so we can number them $slideCount = 1; +## pre-load template slides using $template dir +Text::FastTemplate->defaults( + path => [ $template ] + ); + +Text::FastTemplate->preload( [ + { file => 'slide.html', key => 'slide' }, + { file => 'overview.html', key => 'overview' }, + ]); ## @table is the array containing each slide with its title ## for each slide to be generated @@ -315,48 +321,31 @@ ## here is the standard style sheet $stylelink .= ""; - if ($logoFile) { - $logo_html="\"$logoAlt\""; - } + %overview_data = ( + doctype => $doctype, + title => $title, + http_equiv => $http_equiv, + stylelink => $stylelink, + body => $body, + + logoLink => $logoLink, + logoFile => $logoFile, + logoAlt => $logoAlt, + + talkTitle => $talkTitle, + talkSubTitle => $talkSubTitle, + + content_hight => $content_hight, + + author => $author, + authorUrl => $authorUrl, + author2 => $author2, + authorUrl2 => $authorUrl2, - if ($logoFile2) { - $logo_html.="\"$logoAlt2\""; - } + date => $date, - $title_html="

$talkTitle

"; - if (length $talkSubTitle != 0) { - $title_html.="

$talkSubTitle

"; - } - - if (length $date != 0) { - $date_html="($date)"; - } - - print FOO < - $talkTitle - $loc_toc - $http_equiv - $stylelink - - $body - - - - - - - - - - -
- - - - - -
$title_html
-
-
-

$loc_toc

-
    -END + toc => $loc_toc, + ); } ## @@ -368,40 +357,11 @@ sub closeOverview { - my $slide_html=make_progress_bar(0,$total); - print FOO < -
-
- - -END + $overview_data{slide_html} = make_progress_bar(0,$total); + $overview_data{toc_entries} = [ @toc_entries ]; + + my $page= new Text::FastTemplate key => 'overview'; + print FOO $page->output( \%overview_data ); close(FOO); } @@ -427,19 +387,26 @@ if ($nr % $toc_on_page == 0) { my $toc_nr=int($nr/$toc_on_page); - print FOO <...
-END + %item = ( + pre_html => $pre_ul, + accesskey => " ", # space + href => "index-toc$toc_nr.html", + title => "...", + post_html => $post_ul, + more => 1, # use style for more pages link (...) + ) +# push @toc_entries, %item; + &closeOverview; &openOverview("$overview-toc$toc_nr"); $last_toc_title=''; } - $ul1=$ul2=''; + $pre_ul=$post_ul=''; if ($last_toc_title eq $title) { $title = $subtitle; - $ul1='
    '; - $ul2='
'; + $pre_ul='
    '; + $post_ul='
'; } else { $last_toc_title=$title; } @@ -447,13 +414,25 @@ # add accesskey for first 9 slides (`1' - `9') or just for first # TOC page, and tabindex for all slides if ($nr < 10 && $nr < $toc_on_page) { - print FOO <$title$ul2 -END + $item = { + pre_html => $pre_ul, + accesskey => "$nr", + tabindex => "$nr", + href => "slide$nr.html", + title => $title, + post_html => $post_ul, + more => 0, + }; + push @toc_entries,$item; } else { - print FOO <$title$ul2 -END + %item = ( + pre_html => $pre_ul, + tabindex => "$nr", + href => "slide$nr.html", + title => $title, + post_html => $post_ul, + ) +# push @toc_entries,\%item; } } ## @@ -531,62 +510,30 @@ my $slide_html=make_progress_bar($nr,$total); - print SLIDE < - $talkTitle - $title - $http_equiv - $stylelink - - $body - - - - - - - - - - -
- - - - - -
$title_html
-
-
-$content -
-
- - -END + %page_data = ( + doctype => $doctype, + talkTitle => $talkTitle, + title => $title, + http_equiv => $http_equiv, + stylelink => $stylelink, + body => $body, + + logo_html => $logo_html, + title_html => $title_html, + content_hight => $content_hight, + content => $content, + author => $author, + date_html => $date_html, + prevlink => $prevlink, + toclink => $toclink, + nextlink => $nextlink, + slide_html => $slide_html, + author2 => $author2 + + ); + + my $page= new Text::FastTemplate key => 'slide'; + print SLIDE $page->output( \%page_data ); close(SLIDE); return 0;