#!/usr/bin/perl -w

# Convert an input file containing a Graph::Easy description to
# an HTML page.

# Example usage:
#  examples/as_html t/in/2nodes.txt >test.html
#  echo "[ A ] -> [ B ]" | examples/as_ascii

BEGIN { $|++; }

use strict;
use lib 'lib';
use Graph::Easy::Parser;

my $parser = Graph::Easy::Parser->new( debug => 0 );

my $file = shift;
my $id = shift || '';

$file = \*STDIN unless defined $file;
my $graph = $parser->from_file( $file );

die ($parser->error()) unless defined $graph;

$graph->id($id);
$graph->layout();

warn ($graph->error()) if $graph->error();

print $graph->as_html_page();

