Created
April 27, 2023 06:09
-
-
Save tsibley/5a76253d4cd855247d9df14f20c35585 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use open qw< :std :encoding(UTF-8) >; | |
use utf8; | |
use HTML::FromANSI::Tiny; | |
my $conv = HTML::FromANSI::Tiny->new( | |
auto_reverse => 1, | |
background => 'white', | |
foreground => 'black', | |
remove_escapes => 1, | |
); | |
my $ansi = do { local $/; <> }; | |
my $template = do { local $/; <DATA> }; | |
printf $template, scalar $conv->css, scalar $conv->html($ansi); | |
__DATA__ | |
<html> | |
<head> | |
<style> | |
pre { line-height: 1em; } | |
%s | |
</style> | |
</head> | |
<body> | |
<pre>%s</pre> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment