.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "HTML::FromANSI::Tiny 3" .TH HTML::FromANSI::Tiny 3 2024-03-08 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME HTML::FromANSI::Tiny \- Easily convert colored command line output to HTML .SH VERSION .IX Header "VERSION" version 0.107 .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 4 \& use HTML::FromANSI::Tiny; \& my $h = HTML::FromANSI::Tiny\->new( \& auto_reverse => 1, background => \*(Aqwhite\*(Aq, foreground => \*(Aqblack\*(Aq, \& ); \& \& # output from some command \& my $output = "\ee[31mfoo\e033[1;32mbar\e033[0m"; \& \& # include the default styles if you don\*(Aqt want to define your own: \& print $h\->style_tag(); # or just $h\->css() to insert into your own stylesheet \& \& print $h\->html($output); \& # prints \*(Aqfoobar\*(Aq .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" Convert the output from a terminal command that is decorated with ANSI escape sequences into customizable HTML (with a small amount of code). .PP This module complements Parse::ANSIColor::Tiny by providing a simple HTML markup around its output. .PP Parse::ANSIColor::Tiny returns a data structure that's easy to reformat into any desired output. Reformatting to HTML seemed simple and common enough to warrant this module as well. .SH METHODS .IX Header "METHODS" .SS new .IX Subsection "new" Constructor. .PP Takes a hash or hash ref of options: .IP \(bu 4 \&\f(CW\*(C`ansi_parser\*(C'\fR \- Instance of Parse::ANSIColor::Tiny; One will be created automatically, but you can provide one if you want to configure it. .IP \(bu 4 \&\f(CW\*(C`class_prefix\*(C'\fR \- String to prefix class names; Blank by default for brevity. See "html". .IP \(bu 4 \&\f(CW\*(C`html_encode\*(C'\fR \- Code ref that should encode HTML entities; See "html_encode". .IP \(bu 4 \&\f(CW\*(C`inline_style\*(C'\fR \- Boolean to toggle using inline \f(CW\*(C`style=""\*(C'\fR attributes instead of \f(CW\*(C`class=""\*(C'\fR attributes. .IP \(bu 4 \&\f(CW\*(C`no_plain_tags\*(C'\fR \- Boolean for omitting the \f(CW\*(C`tag\*(C'\fR when the text has no style attributes; Defaults to false for consistency. .IP \(bu 4 \&\f(CW\*(C`selector_prefix\*(C'\fR \- String to prefix each css selector; Blank by default. See "css". .IP \(bu 4 \&\f(CW\*(C`styles\*(C'\fR \- Tree of hashrefs for customizing style output (for \f(CW\*(C`