The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

HTML::FromANSI - Mark up ANSI sequences as HTML

VERSION

This document describes version 1.01 of HTML::FromANSI, released September 5, 2003.

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.");

DESCRIPTION

This small module converts ANSI text sequences to corresponding HTML codes, using stylesheets to control color and blinking properties.

It exports ansi2html() 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 Term::VT102 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 Term::ANSIScreen module.

OPTIONS

There are various options stored in the %HTML::FromANSI::Options hash; you can also enter them explicitly from the use line. Below are brief description of each option:

linewrap

A boolean value to specify whether to wrap lines that exceeds width specified by col, or simply truncate them. Defaults to 1.

lf_to_crlf

A boolean value to specify whether to translate all incoming \n into \r\n or not; you generally wants to use this if your data is from a file using unix line endings. The default is 0 on MSWin32 and MacOS, and 1 on other platforms.

fill_cols

A boolean value to specify whether to fill empty columns with space; use this if you want to maintain a screen-like appearance in the resulting HTML, so that each row will be aligned properly. Defaults to 0.

html_entity

A boolean value to specify whether to escape all high-bit characters to HTML entities or not; defaults to 0, which means only <, >, " and & will be escaped. (Handy when processing most ANSI art entries.)

cols

A number specifying the width of the virtual terminal; defaults to 80.

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 ansi2html invocation, which is probably what you want in most cases.

font_face

A string used as the face attribute to the font tag enclosing the HTML text; defaults to fixedsys, lucida console, terminal, vga, monospace.

If this option and the style option are both set to empty strings, the font tag will be omitted.

style

A string used as the style attribute to the font tag enclosing the HTML text; defaults to <line-height: 1; letter-spacing: 0; font-size: 12pt>.

If this option and the font_face option are both set to empty strings, the font tag will be omitted.

tt

A boolean value specifying whether the HTML text should be enclosed in a tt tag or not. Defaults to 1.

show_cursor

A boolean value to control whether to highlight the character under the cursor position, by reversing its background and foregroud color. Defaults to 0.

SEE ALSO

Term::VT102, HTML::Entities, Term::ANSIScreen

AUTHORS

Autrijus Tang <autrijus@autrijus.org>

COPYRIGHT

Copyright 2001, 2002, 2003 by Autrijus Tang <autrijus@autrijus.org>.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See http://www.perl.com/perl/misc/Artistic.html

1 POD Error

The following errors were encountered while parsing the POD:

Around line 258:

You forgot a '=back' before '=head1'