summaryrefslogtreecommitdiffstats
path: root/scripts/ansi2html
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2011-07-01 22:10:59 +0200
committerFlorian Pritz <bluewind@xinu.at>2011-07-01 23:26:34 +0200
commitb4e0acc50ce686cc57ca854dd319bb722d1d7f7d (patch)
tree26890ad3716f02fd863b29aec2378f0310baf671 /scripts/ansi2html
parent92ac1086ce5d3de253a7bb8979bdfd108e227755 (diff)
add ascii highlighting with escape color support
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'scripts/ansi2html')
-rwxr-xr-xscripts/ansi2html20
1 files changed, 20 insertions, 0 deletions
diff --git a/scripts/ansi2html b/scripts/ansi2html
new file mode 100755
index 000000000..e33e24630
--- /dev/null
+++ b/scripts/ansi2html
@@ -0,0 +1,20 @@
+#!/usr/bin/perl
+use strict;
+use HTML::FromANSI ();
+
+my $h = HTML::FromANSI->new(
+ fill_cols => 0,
+ font_face => "",
+ style => "",
+ tt => 0
+);
+
+open IN, "<", $ARGV[0] or die "cannot read $ARGV[0]: $!";
+
+$h->add_text(<IN>);
+my $html = $h->html;
+$html =~ s/background: black; //g;
+$html =~ s/color: white; /color: black /g;
+$html =~ s/<br>/\n/g;
+
+print $html;