#! /usr/bin/perl -n

# PinPoint -- Produce presentation graphics using the GIMP
# Copyright (C) 2001 by Martin Pool <mbp@linuxcare.com.au>

# $Id: pin2html.pl,v 1.2 2001/01/20 14:17:40 mbp Exp $
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

# usage: pin2html.pl PINFILE >HTMLFILE

# Generates an HTML file containing the readable text outline, plus
# links to generated image files in the current directory.

BEGIN { $i = 0; }

if (/^%page/ or !$i) {
  print "<br clear=all><hr>";
  print "<h3><a href=slide$i.jpg>Slide $i</a></h3>\n";
  print "<img align=right src=small$i.jpg>\n";
  $i++;
}

if (! /^[#%]/) {
  s((ftp|http|https)://[^\s]+[^\s.,?])(<a href="$&">$&</a>);
  print "<br>$_";
}

END { print <<FOO;
<br clear=all><hr><br clear=all>Produced by
  <a href=http://linuxcare.com.au/projects/pinpoint/>PinPoint</a>
  at
FOO
  print gmtime() . "UTC";
}
