#!/usr/bin/perl -w
#
# Convert a single gnuplot demo script to a web page
# Usage:
# webify xxx
#
# Reads xxx.dem and creates xxx.html along with associated
# png images output to xxx..png
#
# If gpsavediff is present also create a set of scripts
# xxx..gnu corresponding to the minimal set of commands
# needed to generate that png image.
#
# If gnuplot_demo.css is present, link to it as a stylesheet.
#
# Ethan A Merritt
# December 2003
#
# EAM Jan 2004
# use gpsavediff if available
# link to gnuplot_demo.css if available
#
# EAM Aug 2005
# If DEMOTERM is present as an environmental variable, then use
# set term DEMOTERM
# rather than the default terminal settings
# setenv DEMOTERM "pngcairo font 'arial,10' transparent size 600,400"
# ./webify.pl image
#
# EAM Apr 2009
# new layout for generated web pages
#
use Env qw(DEMOTERM GNUPLOT_LIB);
use Time::localtime;
use HTML::Entities;
# Use the in-tree copy of gnuplot if there is one
my $gnuplot = ( -x "../../src/gnuplot" ) ? "../../src/gnuplot" : "gnuplot" ;
if ((!defined $ENV{GNUPLOT_LIB}) || $GNUPLOT_LIB eq "") {
$GNUPLOT_LIB = "..";
}
my $date = ctime();
my $plot = 1;
# input and output files
open(IN, "