# $File: //member/autrijus/HTML-FromANSI/lib/HTML/FromANSI.pm $ $Author: autrijus $ # $Revision: #3 $ $Change: 7867 $ $DateTime: 2003/09/04 17:11:36 $ package HTML::FromANSI; $HTML::FromANSI::VERSION = '1.01'; use strict; use base qw/Exporter/; use vars qw/@EXPORT @EXPORT_OK @Color %Options/; use Term::VT102; use HTML::Entities; =head1 NAME HTML::FromANSI - Mark up ANSI sequences as HTML =head1 VERSION This document describes version 1.01 of HTML::FromANSI, released September 5, 2003. =head1 SYNOPSIS use HTML::FromANSI; use Term::ANSIColor; $HTML::FromANSI::Options{fill_cols} = 1; # fill all 80 cols print ansi2html(color('bold blue'), "This text is bold blue."); =head1 DESCRIPTION This small module converts ANSI text sequences to corresponding HTML codes, using stylesheets to control color and blinking properties. It exports C by default, which takes an array, joins it it into a single scalar, and returns its HTML rendering. From version 0.99 and above, this module has been changed to use the excellent B module, so cursor movement and other terminal control codes are properly handled. If you want to generate these movement codes in perl, please take a look at my B module. =head1 OPTIONS There are various options stored in the C<%HTML::FromANSI::Options> hash; you can also enter them explicitly from the C line. Below are brief description of each option: =over 4 =item linewrap A boolean value to specify whether to wrap lines that exceeds width specified by C, or simply truncate them. Defaults to C<1>. =item lf_to_crlf A boolean value to specify whether to translate all incoming \n into C<\r\n> or not; you generally wants to use this if your data is from a file using unix line endings. The default is C<0> on MSWin32 and MacOS, and C<1> on other platforms. =item fill_cols A boolean value to specify whether to fill empty columns with space; use this if you want to maintain a I appearance in the resulting HTML, so that each row will be aligned properly. Defaults to C<0>. =item html_entity A boolean value to specify whether to escape all high-bit characters to HTML entities or not; defaults to C<0>, which means only C>, C>, C<"> and C<&> will be escaped. (Handy when processing most ANSI art entries.) =item cols A number specifying the width of the virtual terminal; defaults to 80. =item rows A number specifying the height of the virtual terminal; rows that exceeds this number will be truncated. If left unspecified, it will be recalculated automatically on each C invocation, which is probably what you want in most cases. =item font_face A string used as the C attribute to the C tag enclosing the HTML text; defaults to C. If this option and the C