NAME
Term::ANSIColor::Tag - Colorize tagged strings for screen output
SYNOPSIS
use Term::ANSIColor::Tag;
my $text = qq{aaa<red>bbb<bold>ccc</bold>ddd<black><on_yellow>eee</on_yellow></black>fff</red> > ggg};
my $parser = Term::ANSIColor::Tag->new;
$parser->parse($text);
print $parser->text;
# or just call colorize method this way:
print Term::ANSIColor::Tag->colorize($text);
DESCRIPTION
Term::ANSIColor::Tag provides a simple and friendly way to colorize screen output; You can do it using HTML-like tags.
METHODS
new ()
my $parser = Term::ANSIColor::Tag->new;
Creates and returns a new Term::ANSIColor::Tag object.
parse ( $text )
$parser->parse($text);
Parses given $text
. If start tag and end tag aren't correspondent with each other, this method croaks immediately.
Note that "<" and ">" must be escaped into "<" and ">".
text ()
print $parser->text;
Returns parsed text.
colorize ($text)
print Term::ANSIColor::Tag->colorize($text);
Returns parsed text in just one way.
REPOSITORY
http://github.com/kentaro/perl-term-ansicolor-tag/tree/master
SEE ALSO
termcolor
The idea, converts tagged string to colorized one for term, was borrowed from http://github.com/jugyo/termcolor/tree/master
Term::ANSIColor
You might want to consult the documentation of Term::ANSIColor to get to know what tags you can use.
AUTHOR
Kentaro Kuribayashi <kentaro@cpan.org>
SEE ALSO
COPYRIGHT AND LICENSE (The MIT License)
Copyright (c) Kentaro Kuribayashi <kentaro@cpan.org>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.