--- burst.pl 2001/05/08 23:03:03 1.14 +++ burst.pl 2001/05/11 22:04:54 1.17 @@ -139,41 +139,48 @@ ############################################################################## ## reading user input from $infos ## -@PARAM = @ARGV; # we keep this for backward compatibility with an old version - # of the slidemaker tool - #when the parameters were in Makefile or make.bat +my @file; -# read parameters from infos.txt and put them in @PARAM -if (open(INFOS, $infos)) { - print STDERR "--- Reading parameters file $infos ---\n"; - local(@file); - @file = ; -# @PARAM = (); # don't reset param, use @ARGV +############################################################################## +sub parse_infos { + my @file=@_; 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/ *= */=/; - push @PARAM,$file[0]; + my ($var,$value) = split(/ *= */,$file[0],2); + $value=~s/'/\\'/g; + $cmd="\$$var = \'$value\';"; + if (defined($value)) { + eval($cmd) || warn "problem with eval of: $cmd"; + } else { + die "no value defined for $var"; + } print STDERR "$file[0]\n"; } } while (shift(@file)); } -## @PARAM is now a table with the user preferences for his presentation +############################################################################## -## process arguments -## each preset variable is now re-attributed using the user preferences -foreach (@PARAM) { - 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"; - } +parse_infos(@ARGV); # backward compatibility and for pack + +# read parameters from infos.txt and put them in @PARAM +if (open(INFOS, $infos)) { + print STDERR "--- Reading parameters file $infos ---\n"; + @file = ; + parse_infos(@file); +} + +# try to read local infos.txt for template +if (-f "$template/$infos" && open(INFOS,"$template/$infos")) { + print STDERR "--- Reading template parameters file $template/$infos ---\n"; + @file = ; + parse_infos(@file); + close(INFOS); } +## @PARAM is now a table with the user preferences for his presentation + ## use charset if ($charset) { @@ -385,7 +392,8 @@ date => $date, - toc => $loc_toc, + toc_title => $loc_toc, + template_dir => "$template/", ); } @@ -402,6 +410,7 @@ $overview_data{toc_entries} = [ @toc_entries ]; my $page= new Text::FastTemplate key => 'overview'; + $page_data{template_dir}='' if ($pack); print FOO $page->output( \%overview_data ); close(FOO); @@ -578,6 +587,7 @@ toc_link => $toc_link, next_link => $next_link, prev_title => $prev_title, + toc_title => $loc_toc, next_title => $next_title, author => $author, @@ -589,6 +599,7 @@ slide_html => $slide_html, + template_dir => "$template/", ); my $page; @@ -597,6 +608,7 @@ } else { $page= new Text::FastTemplate key => 'title'; } + $page_data{template_dir}='' if ($pack); print SLIDE $page->output( \%page_data ); extract_files($page->output( \%page_data )) if ($pack); close(SLIDE); @@ -684,7 +696,7 @@ my $pcnt_done=int($nr*100/$total); my $pcnt_left=100-$pcnt_done; - if ($progress_bar) { + if ($progress_bar && uc($progress_bar) ne "NO") { my $l=$r=" "; my $t="$nr of $total"; if ($pcnt_done > 50) { @@ -692,7 +704,14 @@ } else { $r=$t; } - $html='
'.$l.''.$r.'
'; + $html=''; + if ($pcnt_done != 0) { + $html.=''; + } + if ($pcnt_left != 0) { + $html.=''; + } + $html.='
'.$l.''.$r.'
'; } else { $html="$loc_slide $nr $loc_of $total"; } @@ -713,8 +732,8 @@ sub extract_files { my $tmp = $_[0]; - while ($tmp =~ s/