Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
devel:languages:perl:CPAN-T
perl-Text-ANSI-Fold
perl-Text-ANSI-Fold.spec
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File perl-Text-ANSI-Fold.spec of Package perl-Text-ANSI-Fold
# # spec file for package perl-Text-ANSI-Fold # # 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-Fold Name: perl-Text-ANSI-Fold Version: 2.23 Release: 0 License: Artistic-1.0 OR GPL-1.0-or-later Summary: Text folding library supporting ANSI terminal sequence and Asian wide ch[cut] URL: https://metacpan.org/release/%{cpan_name} Source0: https://cpan.metacpan.org/authors/id/U/UT/UTASHIRO/%{cpan_name}-%{version}.tar.gz BuildArch: noarch BuildRequires: perl BuildRequires: perl-macros BuildRequires: perl(List::Util) >= 1.45 BuildRequires: perl(Module::Build) BuildRequires: perl(Module::Build::Tiny) >= 0.035 BuildRequires: perl(Test::More) >= 0.98 BuildRequires: perl(Text::VisualWidth::PP) >= 0.05 Requires: perl(List::Util) >= 1.45 Requires: perl(Text::VisualWidth::PP) >= 0.05 %{perl_requires} %description Text::ANSI::Fold provides capability to divide a text into two parts by given width. Text can include ANSI terminal sequences and the width is calculated by its visible representation. If the text is divided in the middle of colored region, reset sequence is appended to the former text, and color recover sequence is inserted before the latter string. This module also support Unicode Asian full-width and non-spacing combining characters properly. Japanese text formatting with head-or-end of line prohibition character is also supported. Set the linebreak mode to enable it. Since the overhead of ANSI escape sequence handling is not significant when the data does not include them, this module can be used for normal text processing with small penalty. Use exported *ansi_fold* function to fold original text, with number of visual columns you want to cut off the text. ($folded, $remain, $w) = ansi_fold($text, $width); It returns a pair of strings; first one is folded text, and second is the rest. Additional third result is visual width of the folded text. It is not always same as given width, and you may want to know how many columns returned string takes for further processing. Negative width value is taken as unlimited. So the string is never folded, but you can use this to expand tabs and to get visual string width. This function returns at least one character in any situation. If you provide Asian wide string and just one column as width, it trims off the first wide character even if it does not fit to given width. Default parameter can be set by *configure* class method: Text::ANSI::Fold->configure(width => 80, padding => 1); Then you don't have to pass second argument. ($folded, $remain) = ansi_fold($text); Because second argument is always taken as width, use _undef_ when using default width with additional parameter: ($folded, $remain) = ansi_fold($text, undef, padding => 1); Some other easy-to-use interfaces are provided by sister module Text::ANSI::Fold::Util. %prep %autosetup -n %{cpan_name}-%{version} %build perl Build.PL --installdirs=vendor ./Build build --flags=%{?_smp_mflags} %check ./Build test %install ./Build install --destdir=%{buildroot} --create_packlist=0 %perl_gen_filelist %files -f %{name}.files %doc Changes README.md %license LICENSE %changelog
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor