#!/usr/bin/perl -w
# #######################################################################
# htmlslides: Main program for splitting of HTML slides 
#   Copyright (C) 2000 by Steve Litt (slitt@troubleshooters.com)
#   Version 0.5, 4/13/2000 by Steve Litt
#
#   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.
#
# Steve Litt, slitt@troubleshooters.com, http://www.troubleshooters.com
# #######################################################################


#### USE NEXT LINE (use lib 'dirstring') TO PREPEND LOCATION OF Wpager.pm ####
use lib '../';

use Wpager;
use strict;

sub usage
  {
  print "\n\n";
  print "Usage is: ./htmlslides infile ptemplate ttemplate\n";
  print "Where infile is the combined pre-split html presentation,\n";
  print "      ptemplate is the page template file for all non toc pages,\n";
  print "      ttemplate is the toc template file for the table of contents.\n";
  print "\n";
  print "Slides are delineated by titles in <address> </address> tags in pre-split HTML.\n";
  print "The page template can include the following substitution strings:\n";
  print "   zzzTITLEzzz      Page title (from address tags)\n";
  print "   zzzNAVzzz        Navigator (previous, contents, next)\n";
  print "   zzzPAGENOzzz     Calculated page number of present slide.\n";
  print "   zzzSLIDEzzz      Slide material from pre-split HTML file (slides only).\n";
  print "   zzzCONTENTSzzz   Calculated slide link list (TOC only).\n";
  }

my($numberOfArgs) = scalar(@ARGV);
if($numberOfArgs ne 3)
  {
  usage();
  print "\n";
  Wpager->shortCopyright();
  print "\n";
  exit(1);
  }

Wpager->shortCopyright();
my($presentationInputFile,$pageTemplate,$tocTemplate) = @ARGV;
my($pager)=Wpager->new(
       $presentationInputFile,
       $pageTemplate,
       $tocTemplate,
       "toc.html"
       );
