#!/usr/local/bin/perl # # vv - a Perl script for producing "Virtual Viewgraphs", a chain of linked frames # of HTML pages for talks, presented directly off the web, or from a laptop # cache of web pages. # # Released into the public domain by Aake Nordlund, NBIfAFG & TAC, Copenhagen, # 18-sep-98. # # NO support is provided, this "use as is" software, provided as a service to # those, who in principle could have written this piece of perl code themselves, # and / or are smart enough to adjust it to their own needs and preferences. # # Syntax: vv [ -f ] [ -p pp ] [ -c sz ] [ -t sz ] 1.sld 2.sld 3.sld ... # # -f : "fold" section headers (just try it) # -p pp : percentage width of the contents fram (default 22) # -c sz : relative size of contents text (-1 is default) # -t sz : relative size of talks text (+1 is default) # # The files 1.sld etc contain ascii data (and embedded HTML) in the form # (see also http://www.tac.dk/~padoan/talks/dust/[0123].sld): # # title: Protogalaxies at high z [ only one per talk ] # section: Introduction [ one per file ] # head: Acknowledgements [ one per slide # o Collaborators: # + James Dunlop # + Jose Franco # [ blank line separates slides ] # head: Galaxies at High Redshift # o When are galaxies formed? # - Observing distant galaxies is the only direct method to study galaxy formation and evolution. ##################################################################### sub beginHTML { $file="$sep1$s$sep2$pg.html"; $page="$sep1$s$sep2"."page"."$pg.html"; if ($sep2 eq ":") { $icons="file:///Macintosh HD/Desktop Folder/Computer Physics/HTML/Icons"; } else { $icons="http://www.astro.ku.dk/Icons"; }; #$prv=$cur; #$cur="../$s/index$pg.html"; #print STDERR "page=$page prv=$prv cur=$cur\n"; open (PGE,">$page"); $html=""; $html0="
| $title | "; $html1="($s.$pg) |
$html "; close (PGE); } ##################################################################### sub doIndex { open(IDX,">$_[0]"); $psize1 = 100-$psize; print IDX "
$_
"; } ##################################################################### sub doBullet{ $html=$html."
CONTENTS
";
$s0 = -1;
$d = `pwd`;
chop($d);
$sec=-1;
#opendir(DIR,$d);
#@files = sort(readdir(DIR));
#file: foreach (@files) {
# next file unless /[0-z].sld$/;
file: while ($#ARGV >= 0) {
$_ = $ARGV[0];
print STDERR "$_ ";
if (/-f/) {
$folded=1;
shift(@ARGV);
next file;
} elsif (/-c/) {
$csize=$ARGV[1];
shift(@ARGV);
print STDERR "csize: $csize ";
shift(@ARGV);
next file;
} elsif (/-p/) {
$psize=$ARGV[1];
shift(@ARGV);
print STDERR "psize: $csize ";
shift(@ARGV);
next file;
} elsif (/-t/) {
$tsize=$ARGV[1];
shift(@ARGV);
print STDERR "tsize: $tsize ";
shift(@ARGV);
next file;
}
shift(@ARGV);
@s = split(/\./);
$s = $s[0];
if ($s0 == -1) {$s0=$s;}
$section = '';
stat($s) || mkdir($s,0755);
open(O,">$s.html");
print O "
\n";
$level=-1;
next line;
} elsif ($n == 0) {
$level=-1;
} elsif ($_[0] eq "title:") {
s/title: //;
$title = $_;
} elsif ($_[0] eq "head:") {
$level=0;
s/head: //;
$head=$_;
$text{$sec,$pg}=$head;
$nsub{$sec}++;
print LNK " $head
\n";
} elsif ($_[0] eq "link:") {
$level=0;
s/link: //;
$head=$_;
$text{$sec,$pg}=$head;
$_=
\n";
} elsif (/^ [o\+-] /) {
$level=5;
s/^ *[o\+-] //;
} elsif (/^ *[<]/) {
$html=$html."$_";
next line;
} elsif (/^ /) {
$level=5;
&setLevel;
$html=$html."$_";
next line;
} elsif (/^ [o\+-] /) {
$level=4;
s/^ *[o\+-] //;
} elsif (/^ /) {
$level=4;
&setLevel;
$html=$html."$_";
next line;
} elsif (/^ [o\+-] /) {
$level=3;
s/^ *[o\+-] //;
} elsif (/^ /) {
$level=3;
&setLevel;
$html=$html."$_";
next line;
} elsif (/^ [o\+-] /) {
$level=2;
s/^ *[o\+-] //;
} elsif (/^ /) {
$level=2;
&setLevel;
$html=$html."$_";
next line;
} elsif (/^ *\\vskip/) {
next line;
} else {
$level=1;
}
# print "\n n=$n level=$level str=$_\n";
&setLevel;
if ($level == 1) {&doText;}
elsif ($level == 2) {&doBullet;}
elsif ($level >= 3) {&doList;}
#select STDOUT;
#print "$level $_\n";
}
close (IN);
$s++;
$r = "../$s/";
$pg=0;
&endHTML;
}
print STDERR "\n";
print LNK "
\n";
for ($ii=$sec0; $ii<=$sec; $ii++) {
if ($ii == $i) {
print CNT "$text{$ii,0}
\n";
for ($jj=1; $jj<=$nsub{$ii}; $jj++) {
if ($jj == $j) {
print CNT " $text{$ii,$jj}
\n";
} else {
print CNT " $text{$ii,$jj}
\n";
}
}
} else {
if ($folded) {
print CNT "$text{$ii,0}
\n";
} else {
print CNT "$text{$ii,0}
\n";
for ($jj=1; $jj<=$nsub{$ii}; $jj++) {
print CNT " $text{$ii,$jj}
\n";
}
}
}
}
print CNT "\n";
close(CNT);
# print " $text{$i,$j}\n";
}
}
exit;