Files
perl-Text-ANSI-Util/perl-Text-ANSI-Util.spec
2025-08-12 18:18:00 +02:00

92 lines
2.9 KiB
RPMSpec

#
# spec file for package perl-Text-ANSI-Util
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define cpan_name Text-ANSI-Util
Name: perl-Text-ANSI-Util
Version: 0.234.0
Release: 0
# 0.234 -> normalize -> 0.234.0
%define cpan_version 0.234
License: Artistic-1.0 OR GPL-1.0-or-later
Summary: Routines for text containing ANSI color codes
URL: https://metacpan.org/release/%{cpan_name}
Source0: https://cpan.metacpan.org/authors/id/P/PE/PERLANCAR/%{cpan_name}-%{cpan_version}.tar.gz
Source1: cpanspec.yml
Source100: README.md
BuildArch: noarch
BuildRequires: perl
BuildRequires: perl-macros
BuildRequires: perl(Data::Dump)
BuildRequires: perl(List::Util) >= 1.54
BuildRequires: perl(Test::More) >= 0.98
Requires: perl(List::Util) >= 1.54
Provides: perl(Text::ANSI::BaseUtil) = %{version}
Provides: perl(Text::ANSI::Util) = %{version}
%undefine __perllib_provides
%{perl_requires}
%description
This module provides routines for dealing with text that contains ANSI
color codes, e.g. for determining its length/width (excluding the color
codes), stripping the color codes, extracting the color codes, and so on.
For functions that support wide characters, see Text::ANSI::WideUtil.
Current caveats:
* * Other ANSI codes (non-color codes) are ignored
These are codes like for altering cursor positions, etc.
* * Single-character CSI (control sequence introducer) currently ignored
Only 'ESC+[' (two-character CSI) is currently parsed.
BTW, in ASCII terminals, single-character CSI is '0x9b'. In UTF-8
terminals, it is '0xc2, 0x9b' (2 bytes).
* * Private-mode- and trailing-intermediate character currently not parsed
* * Only color reset code \e[0m is recognized
For simplicity, currently multiple SGR parameters inside a single ANSI
color code is not parsed. This means that color reset code like '\e[1;0m'
or '\e[31;47;0m' is not recognized, only '\e[0m' is. I believe this should
not be a problem with most real-world text out there.
%prep
%autosetup -n %{cpan_name}-%{cpan_version}
%build
perl Makefile.PL INSTALLDIRS=vendor
%make_build
%check
make test
%install
%perl_make_install
%perl_process_packlist
%perl_gen_filelist
%files -f %{name}.files
%doc Changes README
%license LICENSE
%changelog