Bugzilla – Attachment 160750 Details for
Bug 35681
Add support for colored messages in the output of updatedatabase
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35681: [ALT] Use ::Bootstrap version of FromANSI
Bug-35681-ALT-Use-Bootstrap-version-of-FromANSI.patch (text/plain), 2.41 KB, created by
Martin Renvoize
on 2024-01-10 11:01:13 UTC
(
hide
)
Description:
Bug 35681: [ALT] Use ::Bootstrap version of FromANSI
Filename:
MIME Type:
Creator:
Martin Renvoize
Created:
2024-01-10 11:01:13 UTC
Size:
2.41 KB
patch
obsolete
>From 83dab7ac93ab67500183ba29d2771314cc9d6a4d Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 10 Jan 2024 10:51:27 +0000 >Subject: [PATCH] Bug 35681: [ALT] Use ::Bootstrap version of FromANSI > >With the next iteration of HTML::FromANSI::Tiny we can add our own subclass >to map ANSI strings to Bootstrap classes. > >This patch adds a local lib HTML::FromANSI::Tiny::Bootstrap module to >do said mapping and then uses it in the installer. >--- > 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 > >diff --git a/installer/install.pl b/installer/install.pl >index 07e93371df8..47b4067854f 100755 >--- a/installer/install.pl >+++ b/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' ); >diff --git a/lib/HTML/FromANSI/Tiny/Bootstrap.pm b/lib/HTML/FromANSI/Tiny/Bootstrap.pm >new file mode 100644 >index 00000000000..2fa58bccf9f >--- /dev/null >+++ b/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; >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 35681
:
160439
|
160440
|
160443
|
160444
|
160445
|
160447
|
160448
|
160449
|
160473
|
160503
|
160504
|
160505
|
160506
|
160750
|
160751
|
160772
|
164903
|
164904
|
164905
|
164906
|
164907
|
164908
|
164909
|
164942
|
164943
|
164944
|
164945
|
164946
|
164947
|
164948
|
164949