#!/usr/bin/perl # $File: //member/autrijus/HTML-FromANSI/script/ansi2html $ $Author: autrijus $ # $Revision: #1 $ $Change: 7865 $ $DateTime: 2003/09/04 15:24:44 $ $VERSION = '0.02'; =head1 NAME ansi2html - Convert ANSI sequence to HTML =head1 SYNOPSIS B S<[ B<-p> ]> S<[ I ]> S<[ I ]> =head1 DESCRIPTION This script takes one input file containing text with ANSI sequences, and outputs the converted HTML code into another file. If I is omitted, it defaults to STDOUT. If I is omitted, it defaults to STDIN. Note that this script will automatically set the C option to 1, filling empty columns with space characters. If the B<-p> option is specified, it will print HTML header and footers. =cut use strict; use Getopt::Std; use HTML::FromANSI qw|%Options ansi2html|; my %args; getopts('p', \%args); $Options{fill_cols} = 1; my ($infile, $outfile) = @ARGV; open IN, $infile or die "cannot read $infile: $!" if $infile; open OUT, ">$outfile" or die "cannot write $outfile: $!" if $outfile; select OUT if $outfile; if ($args{p}) { my $title = 'ansi2html' . ($infile ? " - $infile" : ''); print "$title". ansi2html($infile ? : ). ""; } else { print ansi2html($infile ? : ); } exit; =head1 SEE ALSO L =head1 AUTHORS Autrijus Tang Eautrijus@autrijus.orgE =head1 COPYRIGHT Copyright 2001, 2002 by Autrijus Tang Eautrijus@autrijus.orgE. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L =cut