#!/usr/bin/perl $VERSION = '0.02'; =head1 NAME ansi2html - Convert ANSI sequence to HTML =head1 SYNOPSIS B S<[ B<-p> B<-f> B<-c> ]> 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. If the B<-f> option is specified columns will not be filled. If the B<-c> option is specified the cursor will be shown. =cut use strict; use Getopt::Std; use HTML::FromANSI (); my %args; getopts('pcf', \%args); my $h = HTML::FromANSI->new( fill_cols => !$args{f}, show_cursor => $args{c}, ); 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; $h->add_text($infile ? : ); if ($args{p}) { my $title = 'ansi2html' . ($infile ? " - $infile" : ''); print "$title" . $h->html . ""; } else { print $h->html; } exit; =head1 SEE ALSO L =head1 AUTHORS Audrey Tang Eaudreyt@audreyt.orgE =head1 COPYRIGHT Copyright 2001, 2002 by Audrey Tang Eaudreyt@audreyt.orgE. Copyright 2007 by Yuval Kogman Enothingmuch@woobling.orgE. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L =cut