@@ -, +, @@ --- installer/install.pl | 6 +++--- lib/HTML/FromANSI/Tiny/Bootstrap.pm | 31 +++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 lib/HTML/FromANSI/Tiny/Bootstrap.pm --- a/installer/install.pl +++ a/installer/install.pl @@ -23,7 +23,7 @@ use diagnostics; use C4::InstallAuth qw( get_template_and_user ); use CGI qw ( -utf8 ); use POSIX; -use HTML::FromANSI::Tiny; +use HTML::FromANSI::Tiny::Bootstrap; use C4::Context; use C4::Output qw( output_html_with_http_headers ); @@ -557,9 +557,9 @@ sub chk_log { #returns a logfile in $dir or - if that failed - in temp dir sub colorize { my ($report) = @_; - my $h = HTML::FromANSI::Tiny->new( + my $h = HTML::FromANSI::Tiny::Bootstrap->new( auto_reverse => 0, background => 'white', foreground => 'black', - inline_style => 1, no_plain_tags => 1 + no_plain_tags => 1 ); my @states = ( 'success', 'error' ); --- a/lib/HTML/FromANSI/Tiny/Bootstrap.pm +++ a/lib/HTML/FromANSI/Tiny/Bootstrap.pm @@ -0,0 +1,31 @@ +use strict; +use warnings; + +package HTML::FromANSI::Tiny::Bootstrap; + +use parent qw(HTML::FromANSI::Tiny); + +our %ATTR_TO_CLASS = ( + black => 'text-primary', + red => 'text-danger', + green => 'text-success', + yellow => 'text-warning', + blue => 'text-info', + magenta => '', + cyan => '', + white => 'text-muted', + on_black => 'bg-primary', + on_red => 'bg-danger', + on_green => 'bg-success', + on_yellow => 'bg-warning', + on_blue => 'bg-info', + on_magenta => '', + on_cyan => '', + on_white => '', +); + +sub attr_to_class { + $ATTR_TO_CLASS{ $_[1] } || $_[1]; +} + +1; --