#!/usr/bin/perl

=head1 NAME
  abc2html - encode ABC music notation as HTML

=head1 SYNOPSIS
  abc2html [file]..

=head1 DESCRIPTION
  This reads the input files (or stdin), and writes (to  stdout)  the
  ABC text with < and > characters encoded as HTML entities.  We also
  surround the  text  with  <pre>>  and  </pre>,  complete  with  the
  required  blank  line  to  prevent  ABC  programs  from  trying  to
  interpret the </pre> tag and whatever follows.

  While we're at it, we  also  canonicalize  the  ends  of  lines  by
  trimming  away  all  white  stuff  and  replacing  it with a single
  newline.

=head1 OPTIONS

=head1 EXAMPLES

=head1 FILES

=head1 BUGS

=head1 SEE ALSO

=head1 AUTHOR
  John Chambers <jc@trillian.mit.edu>
=cut

$| = 1;
print "<pre>\n";

for $l (<>) {
	$l =~ s"\s+$"\n";
	$l =~ s"<"\&lt;"g;
	$l =~ s">"\&gt;"g;
	print $l;
}
print "\n</pre>\n";
