Stan's work

Curtis Villamizar curtis at ans.net
Wed Mar 8 20:02:20 UTC 1995


In message <Pine.SUN.3.91.950305174156.12714B-100000 at mon.cc.utah.edu>, "Allen M
. Cole" writes:
> So what tools do people use to put presentations into web?
> 
> Allen Cole                 University of Utah Computer Center
> cole at cc.utah.edu           3440 Merrill Engineering Building
> cole at utahcca.bitnet        Salt Lake City, UT 84112
> utah-cs!cole               (801) 581-8805

The emacs editor.  :-)

Also useful is latex2html (see CERN, under tools), the netpbm stuff,
xfig, transfig, other tex/latex stuff.  Anything that can make eps,
ps, gif, or jpeg files or any graphics format that can be converted
into one of these.  But you still need to be able to edit HTML.

Below is the perl HTML->slide conversion I use.  It produces slitex
files from the html (which has to be edited in a certain style.  The
slitex produces postscript files that can be run through lzps and
loaded into wb for mbone use.

Curtis


#!perl
#  $Id$

eval "exec /usr/bin/perl -S $0 $*"
  if $running_under_some_shell;	# just to get the shell to run perl

@listfont = ( "normalsize", "small", "footnotesize", "scriptsize" );

$prefix = "automatic";

if (defined($ARGV[0])) {
  $prefix = "$ARGV[0]";
  $prefix =~ s/\.html$//;
}

while (<>) {
  if (/^$/) {
    next;
  } elsif (/^\s*<title>(.+)<\/title>\s*$/) {
    $title = "$1";
    next;
  } elsif (/^<title>(.+)$/) {
    $title = "$1";
    $title =~ s/\s+$//;
    while (<>) {
      if (/\s*(.+)<\/title> *$/) {
	$title .= " $1";
	last;
      }
      s/^\s+//;
      s/\s+$//;
      $title .= " $_";
    }
    next;
  } elsif (/^<h1>(.+)<\/h1> *$/) {
    $title = "$1";
    next;
  } elsif (/^<h1>(.+)$/) {
    $title = "$1";
    $title =~ s/\s+$//;
    while (<>) {
      if (/\s*(.+)<\/h1> *$/) {
	$title .= " $1";
	last;
      }
      s/\n//;
      s/^\s+//;
      s/\s+$//;
      $title .= " $_";
    }
    next;
  } elsif (/<hr>/) {
    last;
  }
  s/\n//;
  s/<p>\s*$/\n/;
  $body .= "$_\n";
}

$depth = 0;
$touched = 0;

$slide_no=0;

while (<>) {
  s/\n//;
  s/<a [^>]*>//g;
  s/<\/a>//g;
  if (s/<img src="([^">]*.gif)">//) {
    $gif = "$1";
    $ps = "$gif";
    $ps =~ s/.gif$/.ps/;
    if (-f "$ps") {
      print stderr "gif= $gif, ps= $ps\n";
      unlink("$prefix-$slide$plot.ps");
      system("ln -s $ps $prefix-$slide$plot.ps");
      ++$plot;
    } else {
      $ps =~ s/-small.ps$/.ps/;
      if (-f "$ps") {
	print stderr "gif= $gif, ps= $ps\n";
	unlink("$prefix-$slide$plot.ps");
	system("ln -s $ps $prefix-$slide$plot.ps");
	++$plot;
      } else {
	die "can't find $ps\n";
      }
    }
  }
  next if (/^\s*next\s*/);
  next if (/^\s*$/);
  next if (/Curtis Villamizar/);
  if ($depth >= 0 && $touched == 0) {
    next if (/<hr>/);
    ++$slide_no;
    $slide = sprintf("%.2d", $slide_no);
    $plot = "a";
    die "can't open root file\n"
      if ! open(root, ">$prefix-$slide.root");
    print root "\\documentstyle{slides}\n\n";
    print root "\\pagestyle{empty}\n";
    print root "\n\\begin{document}\n\n\\small\n";
    # print root "$title ---\n$body\n";
    die "can't open slide file\n"
      if ! open(slide, ">$prefix-$slide.tex");
    print root "\\blackandwhite{$prefix-$slide.tex}\n\n";
    print slide "\\begin{slide}{}\n\\small\n";
    $touched = 1;
  }
  if (/<hr>/) {
    if ($depth >= 0) {
      while ($depth > 0) {
	print slide "% oops\n\\end{itemize}}\n";
	--$depth;
      }
      print slide "\\end{slide}\n\n";
      close slide;
      print root "\\end{document}\n";
      close root;
    }
    $depth = 0;
    $touched = 0;
    next;
  } elsif (/^<h1>(.+)<\/h1> *$/) {
    print slide "{\\LARGE $1}\n\n";
    next;
  } elsif (/^<h2>(.+)<\/h2> *$/) {
    print slide "{\\large $1}\n";
    next;
  } elsif (/^<h2>(.+)$/) {
    $title = "$1";
    $title =~ s/\s+$//;
    while (<>) {
      if (/\s*(.+)<\/h2> *$/) {
	$title .= " $1";
	last;
      }
      s/\n//;
      s/^\s+//;
      s/\s+$//;
      $title .= " $_";
    }
    print slide "{\\large $title}\n";
    next;
  }
  $untouched = 0;
  while ($untouched == 0) {
    $untouched = 1;
    if (/^\s*<ul>/) {
      s/^\s*<ul>//;
      if ($depth < 0) {
	$depth = 1;
      } else {
	++$depth;
      }
      print slide "{\\$listfont[$depth]\n";
      print slide "\\begin{itemize}\n";
      if ($depth > 1) {
	print slide "\\itemsep 0in\n";
      }
      $untouched = 0;
    }
    if (/^\s*<\/ul>/) {
      s/^\s*<\/ul>//;
      if ($depth > 0) {
	--$depth;
	print slide "\\end{itemize}\n}\n";
      }
      $untouched = 0;
    }
    if (/^\s*<li>/) {
      s/^\s*<li>//;
      print slide "\\item\n";
      $untouched = 0;
    }
    if (/^\s*<p>/) {
      s/^\s*<p>//;
      print slide "\n";
      $untouched = 0;
    }
    if (s/^\s*<pre>//) {
      $untouched = 0;
    }
    if (s/^\s*<\/pre>//) {
      $untouched = 0;
    }
    if (s/^\s*<hr>//) {
      last;
    }
    if (s/^<<//) {
      print slide "\$<<\$";
      $untouched = 0;
    } elsif (s/^< //) {
      print slide "\$<\$ ";
      $untouched = 0;
    } elsif (/^\s*</) {
      die "unrecognized: $_\n";
    }
    s/%/\\%/;
    if (s/^\s*([^<]+)//) {
      if ($depth > 0) {
	$text = "$1";
	$text =~ s/>=/\$>=\$/;
	$text =~ s/>>/\$>>\$/;
	$text =~ s/> /\$>\$ /;
	print slide "$text\n";
      }
      $untouched = 0;
    }
  }
}

# Local Variables: --needed by emacs--
# mode: c --needed by emacs--
# comment-start: "#" --needed by emacs--
# comment-end: "\n" --needed by emacs--
# End: --needed by emacs--



More information about the NANOG mailing list