2015-04-13 16:40:54 +00:00
|
|
|
#
|
|
|
|
# spec file for package perl-String-Diff
|
|
|
|
#
|
|
|
|
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
|
|
|
|
#
|
|
|
|
# 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 http://bugs.opensuse.org/
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
Name: perl-String-Diff
|
2018-10-07 13:13:39 +00:00
|
|
|
Version: 0.07
|
2015-04-13 16:40:54 +00:00
|
|
|
Release: 0
|
|
|
|
%define cpan_name String-Diff
|
|
|
|
Summary: Simple diff to String
|
|
|
|
License: Artistic-1.0 or GPL-1.0+
|
|
|
|
Group: Development/Libraries/Perl
|
2018-10-07 13:13:39 +00:00
|
|
|
Url: https://metacpan.org/release/%{cpan_name}
|
|
|
|
Source: https://cpan.metacpan.org/authors/id/Y/YA/YAPPO/%{cpan_name}-%{version}.tar.gz
|
2015-04-13 16:40:54 +00:00
|
|
|
BuildArch: noarch
|
|
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
|
|
|
BuildRequires: perl
|
|
|
|
BuildRequires: perl-macros
|
|
|
|
BuildRequires: perl(Algorithm::Diff)
|
2018-10-07 13:10:24 +00:00
|
|
|
BuildRequires: perl(HTML::Entities)
|
2018-10-07 13:15:50 +00:00
|
|
|
BuildRequires: perl(Module::Install::ReadmeFromPod)
|
2018-10-07 13:17:06 +00:00
|
|
|
BuildRequires: perl(Module::Install::ReadmeMarkdownFromPod)
|
2015-04-13 16:40:54 +00:00
|
|
|
BuildRequires: perl(Test::Base)
|
|
|
|
BuildRequires: perl(YAML)
|
|
|
|
Requires: perl(Algorithm::Diff)
|
2018-10-07 13:10:24 +00:00
|
|
|
Requires: perl(HTML::Entities)
|
2015-04-13 16:40:54 +00:00
|
|
|
%{perl_requires}
|
2010-05-09 17:51:52 +00:00
|
|
|
|
|
|
|
%description
|
2015-04-13 16:40:54 +00:00
|
|
|
String::Diff is the difference of a consecutive string is made. after
|
|
|
|
general diff is done, the difference in the line is searchable.
|
|
|
|
|
|
|
|
the mark of the addition and the deletion can be freely changed. the color
|
|
|
|
is colored to the terminal with ANSI, using the HTML display it.
|
|
|
|
|
|
|
|
after the line is divided, diff is taken when 'linebreak' option is
|
|
|
|
specified.
|
|
|
|
|
|
|
|
my($old_string, $new_string) = String::Diff::diff_fully('this is Perl', 'this is Ruby', linebreak => 1);
|
|
|
|
my($old_string, $new_string) = String::Diff::diff('this is Perl', 'this is Ruby', linebreak => 1);
|
|
|
|
my $string = String::Diff::diff_merge('this is Perl', 'this is Ruby', linebreak => 1);
|
|
|
|
my $string = String::Diff::diff_regexp('this is Perl', 'this is Ruby', linebreak => 1);
|
2010-05-09 17:51:52 +00:00
|
|
|
|
2015-04-13 16:40:54 +00:00
|
|
|
In diff and diff_merge methods the mark of the difference can be changed.
|
|
|
|
|
|
|
|
my $diff = String::Diff::diff('this is Perl', 'this is Ruby',{
|
|
|
|
remove_open => '<del>',
|
|
|
|
remove_close => '</del>',
|
|
|
|
append_open => '<ins>',
|
|
|
|
append_close => '</ins>',
|
|
|
|
});
|
|
|
|
|
|
|
|
You can escape callback set to diff function and diff_merge function.
|
|
|
|
|
|
|
|
use HTML::Entities
|
|
|
|
my($diff_old, $diff_new) = String::Diff::diff(
|
|
|
|
'this is <b>Perl</b>',
|
|
|
|
'this is <b><BIG>R</BIG>uby</b>',
|
|
|
|
remove_open => '<del>',
|
|
|
|
remove_close => '</del>',
|
|
|
|
append_open => '<ins>',
|
|
|
|
append_close => '</ins>',
|
|
|
|
escape => sub { encode_entities($_[0]) },
|
|
|
|
});
|
|
|
|
is($diff_old, 'this is <b><del>Perl</del></b>');
|
|
|
|
is($diff_new, 'this is <b><ins><BIG>R</BIG>uby</ins></b>');
|
2010-05-09 17:51:52 +00:00
|
|
|
|
|
|
|
%prep
|
2015-04-13 16:40:54 +00:00
|
|
|
%setup -q -n %{cpan_name}-%{version}
|
2010-05-09 17:51:52 +00:00
|
|
|
|
|
|
|
%build
|
2015-04-13 16:40:54 +00:00
|
|
|
%{__perl} Makefile.PL INSTALLDIRS=vendor
|
|
|
|
%{__make} %{?_smp_mflags}
|
|
|
|
|
|
|
|
%check
|
|
|
|
%{__make} test
|
2010-05-09 17:51:52 +00:00
|
|
|
|
|
|
|
%install
|
|
|
|
%perl_make_install
|
|
|
|
%perl_process_packlist
|
2015-04-13 16:40:54 +00:00
|
|
|
%perl_gen_filelist
|
2010-05-09 17:51:52 +00:00
|
|
|
|
2015-04-13 16:40:54 +00:00
|
|
|
%files -f %{name}.files
|
|
|
|
%defattr(-,root,root,755)
|
|
|
|
%doc Changes README README.mkdn
|
2010-05-09 17:51:52 +00:00
|
|
|
|
|
|
|
%changelog
|