View | Details | Raw Unified | Return to bug 35681
Collapse All | Expand All

(-)a/installer/install.pl (-4 / +7 lines)
Lines 23-29 use diagnostics; Link Here
23
use C4::InstallAuth qw( get_template_and_user );
23
use C4::InstallAuth qw( get_template_and_user );
24
use CGI qw ( -utf8 );
24
use CGI qw ( -utf8 );
25
use POSIX;
25
use POSIX;
26
use HTML::FromANSI::Tiny;
26
use HTML::FromANSI::Tiny::Bootstrap;
27
27
28
use C4::Context;
28
use C4::Context;
29
use C4::Output qw( output_html_with_http_headers );
29
use C4::Output qw( output_html_with_http_headers );
Lines 568-581 sub chk_log { #returns a logfile in $dir or - if that failed - in temp dir Link Here
568
568
569
sub colorize {
569
sub colorize {
570
    my ($report) = @_;
570
    my ($report) = @_;
571
    my $h = HTML::FromANSI::Tiny->new(
571
    my $h = HTML::FromANSI::Tiny::Bootstrap->new(
572
        auto_reverse => 0, background    => 'white', foreground => 'black',
572
        auto_reverse  => 0,
573
        inline_style => 1, no_plain_tags => 1
573
        background    => 'white',
574
        foreground    => 'black',
575
        no_plain_tags => 1
574
    );
576
    );
575
577
576
    my @states = ( 'success', 'error' );
578
    my @states = ( 'success', 'error' );
577
    for my $state (@states) {
579
    for my $state (@states) {
578
        for my $result ( @{ $report->{$state} } ) {
580
        for my $result ( @{ $report->{$state} } ) {
581
579
            #@{ $result->{output} } = map { s/^\t+//; $h->html($_) } @{ $result->{output} };
582
            #@{ $result->{output} } = map { s/^\t+//; $h->html($_) } @{ $result->{output} };
580
            for my $output ( @{ $result->{output} } ) {
583
            for my $output ( @{ $result->{output} } ) {
581
                $output = $h->html($output);
584
                $output = $h->html($output);
(-)a/lib/HTML/FromANSI/Tiny/Bootstrap.pm (-1 / +55 lines)
Line 0 Link Here
0
- 
1
use strict;
2
use warnings;
3
4
package HTML::FromANSI::Tiny::Bootstrap;
5
6
use parent qw(HTML::FromANSI::Tiny);
7
8
=head1 NAME
9
10
HTML::FromANSI::Tiny::Bootstrap - Convert ANSI colored text to HTML with Bootstrap classes
11
12
=head1 DESCRIPTION
13
14
HTML::FromANSI::Tiny::Bootstrap is a module that extends HTML::FromANSI::Tiny to convert ANSI colored text to HTML with Bootstrap classes. It provides a mapping between ANSI color attributes and Bootstrap classes.
15
16
=cut
17
18
our %ATTR_TO_CLASS = (
19
    black      => 'text-primary',
20
    red        => 'text-danger',
21
    green      => 'text-success',
22
    yellow     => 'text-warning',
23
    blue       => 'text-info',
24
    magenta    => '',
25
    cyan       => '',
26
    white      => 'text-muted',
27
    on_black   => 'bg-primary',
28
    on_red     => 'bg-danger',
29
    on_green   => 'bg-success',
30
    on_yellow  => 'bg-warning',
31
    on_blue    => 'bg-info',
32
    on_magenta => '',
33
    on_cyan    => '',
34
    on_white   => '',
35
);
36
37
=head1 METHODS
38
39
=head2 attr_to_class($attr)
40
41
Converts an ANSI color attribute to the corresponding Bootstrap class.
42
43
=cut
44
45
sub attr_to_class {
46
    $ATTR_TO_CLASS{ $_[1] } || $_[1];
47
}
48
49
=head1 AUTHOR
50
51
Martin Renvoize <martin.renvoize@ptfs-europe.com>
52
53
=cut
54
55
1;

Return to bug 35681