Compare commits

...

No commits in common. 'c9' and 'c8' have entirely different histories.
c9 ... c8

@ -1,205 +0,0 @@
From aa7a2c99bff2a8d02d75f6b9f7155483cc94318c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Tue, 13 Aug 2019 16:49:21 +0200
Subject: [PATCH 2/2] Search for X<> in the whole perlop document
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
perlop documents many operators before "Regexp Quote-Like Operators"
(X<operator, regexp>) section. A change introduced with "Refactor
search_perlop RT#86506" (d8b23dcb1a) commit started to ignore those
operators. E.g. A search for '==' did not found anything. A search for
'<>' returned too many text and broke POD syntax.
This patch searches for X<> index entries in all sections and
considers =head keywords in addition to =item as section delimeters.
Because some X<> entries exists on more places, this patch implements
this strategy: First =item section that contains the X<> entry is
returned. If there is no =item sections, last =head section is
returned. If the =item entry is empty (like for 'tr'), the the output
continues up to and including a next non-empty =item. This strategy is
implemented in one pass.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
lib/Pod/Perldoc.pm | 116 ++++++++++++++++++++++++++------------
t/03_builtin_pod_output.t | 8 +++
2 files changed, 89 insertions(+), 35 deletions(-)
diff --git a/lib/Pod/Perldoc.pm b/lib/Pod/Perldoc.pm
index cd52aa2..b54cc23 100644
--- a/lib/Pod/Perldoc.pm
+++ b/lib/Pod/Perldoc.pm
@@ -1153,6 +1153,20 @@ sub search_perlvar {
#..........................................................................
+# Check whether an item POD section contains any documentation text. The POD
+# section is passed as refernce to list of lines.
+# If there is no text, return true; otherwise false.
+sub item_has_no_text {
+ for (@{$_[0]}) {
+ next if /^=over\s/;
+ next if /^=item\s/;
+ next if /^X</;
+ next if /^\s*$/;
+ return 0;
+ }
+ return 1;
+}
+
sub search_perlop {
my ($self,$found_things,$pod) = @_;
@@ -1166,60 +1180,92 @@ sub search_perlop {
my $thing = $self->opt_f;
- my $previous_line;
+ my @previous_lines;
+ my $stop_line;
+ my $wrap_into_over;
my $push = 0;
- my $seen_item = 0;
- my $skip = 1;
+ my $pod_candidate = [];
while( my $line = <$fh> ) {
$line =~ /^=encoding\s+(\S+)/ && $self->set_encoding($fh, $1);
- # only start search after we hit the operator section
- if ($line =~ m!^X<operator, regexp>!) {
- $skip = 0;
- }
- next if $skip;
-
- # strategy is to capture the previous line until we get a match on X<$thingy>
- # if the current line contains X<$thingy>, then we push "=over", the previous line,
- # the current line and keep pushing current line until we see a ^X<some-other-thing>,
- # then we chop off final line from @$pod and add =back
+ # A strategy is to capture the previous lines from =head or =item until we
+ # get a match on X<$thing>. If the current line contains X<$thing>, then
+ # we push "=over" (in case of =item), the previous lines, the current line
+ # and keep pushing current line until we see a terminating POD keyworkd
+ # (=head, =item, =over, corrsponding to the starting POD keyword). Then we
+ # append =back (in case of =item).
#
- # At that point, Bob's your uncle.
-
- if ( $line =~ m!X<+\s*\Q$thing\E\s*>+!) {
- if ( $previous_line ) {
- push @$pod, "=over 8\n\n", $previous_line;
- $previous_line = "";
+ # If this was =item, we are done. If the =item was empty (like two
+ # consequtive =item-s documented at once) we continue gathering other
+ # =item-s until we get some content. Then we are done.
+ #
+ # If this was a =head, we stash the POD section and do another search in
+ # hope we will found =item section. (=item sections tends to be more
+ # focused on =X<$thing> than =head sections.) If did not found any =item
+ # section, we will return the last found =head section.
+
+ if ( $line =~ m!X<+\s*\Q$thing\E\s*>+! ) {
+ if ( @previous_lines ) {
+ push @$pod_candidate, "=over 8\n\n" if $wrap_into_over;
+ push @$pod_candidate, @previous_lines;
+ @previous_lines = ();
}
- push @$pod, $line;
+ push @$pod_candidate, $line;
$push = 1;
}
- elsif ( $push and $line =~ m!^=item\s*.*$! ) {
- $seen_item = 1;
- }
- elsif ( $push and $seen_item and $line =~ m!^X<+\s*[ a-z,?-]+\s*>+!) {
+ elsif ( $push and $line =~ m/$stop_line/ ) {
$push = 0;
- $seen_item = 0;
- last;
+
+ # X<tr> exists twice in perlop. Prefer =item location over =head
+ # location. We assume =item is more specific.
+ if ($wrap_into_over) {
+ # However, the X<tr> =item section is empty (except of bunch of
+ # X<> kewords) and documented in the next =item section. Thus
+ # continue until the so far gathered text looks empty.
+ if ($line =~ /^=item\s/ && item_has_no_text($pod_candidate)) {
+ $push = 1;
+ push @$pod_candidate, $line;
+ # and continue appending following =item section
+ } else {
+ # We have an =item with a content.
+ push @$pod_candidate, "\n\n=back\n";
+ # Replace pod with the candidate
+ @$pod = @$pod_candidate;
+ last;
+ }
+ } else {
+ # Copy the candidate to pod
+ push @$pod, @$pod_candidate;
+ $pod_candidate = [];
+ # And search for another occurance of the X<> reference with the
+ # prospect it will be an =item.
+ }
}
elsif ( $push ) {
- push @$pod, $line;
- }
-
- else {
- $previous_line = $line;
+ push @$pod_candidate, $line;
+ }
+
+ if ( !$push ) {
+ # Gather a smallest block starting with "=head" or "=item"
+ if ($line =~ /^=head([1234])\s/) {
+ $stop_line = join('', 1..$1);
+ $stop_line = qr/^=head[$stop_line]\s/;
+ $wrap_into_over = 0;
+ @previous_lines = ();
+ } elsif ($line =~ /^=item\s/) {
+ $stop_line = qr/^=(?:item\s|back\b)/;
+ $wrap_into_over = 1;
+ @previous_lines = ();
+ }
+ push @previous_lines, $line;
}
} #end while
# we overfilled by 1 line, so pop off final array element if we have any
if ( scalar @$pod ) {
- pop @$pod;
-
- # and add the =back
- push @$pod, "\n\n=back\n";
DEBUG > 8 and print "PERLOP POD --->" . (join "", @$pod) . "<---\n";
}
else {
diff --git a/t/03_builtin_pod_output.t b/t/03_builtin_pod_output.t
index 70f8549..d42a242 100644
--- a/t/03_builtin_pod_output.t
+++ b/t/03_builtin_pod_output.t
@@ -24,6 +24,14 @@ my %builtins = (
qr/\A\s+"tr\/\*SEARCHLIST\*\/\*REPLACEMENTLIST\*\/cdsr"\n/,
qr/\n\s+eval "tr\/\$oldlist\/\$newlist\/, 1" or die \$\@;\n\n\z/
],
+ '==' => [ # CPAN RT#126015
+ qr/\A\s+Equality Operators\n/,
+ qr/\n\s+if \( fc\(\$x\) eq fc\(\$y\) \) \{ \.\.\. \}\n\n\z/
+ ],
+ '<>' => [ # CPAN RT#126015
+ qr/\A\s+I\/O Operators\n/,
+ qr/\n\s+for its regular truth value\.\n\n\z/
+ ]
);
plan tests => 5 * scalar keys %builtins;
--
2.21.0

@ -1,49 +0,0 @@
From d469b8609b566b972c7cc3ed74029cdddea50eee Mon Sep 17 00:00:00 2001
From: Jitka Plesnikova <jplesnik@redhat.com>
Date: Thu, 24 May 2018 10:48:47 +0200
Subject: [PATCH] Upgrade to 3.2801
---
lib/Pod/Perldoc.pm | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/lib/Pod/Perldoc.pm b/lib/Pod/Perldoc.pm
index 8d695b2..bb6ffc8 100644
--- a/lib/Pod/Perldoc.pm
+++ b/lib/Pod/Perldoc.pm
@@ -12,7 +12,7 @@ use File::Spec::Functions qw(catfile catdir splitdir);
use vars qw($VERSION @Pagers $Bindir $Pod2man
$Temp_Files_Created $Temp_File_Lifetime
);
-$VERSION = '3.28';
+$VERSION = '3.2801';
#..........................................................................
@@ -486,11 +486,6 @@ sub init_formatter_class_list {
$self->opt_M_with('Pod::Perldoc::ToPod'); # the always-there fallthru
$self->opt_o_with('text');
- $self->opt_o_with('term')
- unless $self->is_mswin32 || $self->is_dos || $self->is_amigaos
- || !($ENV{TERM} && (
- ($ENV{TERM} || '') !~ /dumb|emacs|none|unknown/i
- ));
return;
}
@@ -1937,11 +1932,6 @@ sub page { # apply a pager to the output file
} elsif($self->is_amigaos) {
last if system($pager, $output) == 0;
} else {
- my $formatter = $self->{'formatter_class'};
- if ( $formatter->can('pager_configuration') ) {
- $self->aside("About to call $formatter" . "->pager_configuration(\"$pager\")\n");
- $formatter->pager_configuration($pager, $self);
- }
last if system("$pager \"$output\"") == 0;
}
}
--
2.14.3

@ -4,26 +4,21 @@
# Support for groff
%bcond_without perl_enables_groff
%global base_version 3.28
Name: perl-Pod-Perldoc
# let's overwrite the module from perl.srpm
Version: 3.28.01
Release: 461%{?dist}
Version: 3.28
Release: 396%{?dist}
Summary: Look up Perl documentation in Pod format
License: GPL+ or Artistic
URL: https://metacpan.org/release/Pod-Perldoc
Source0: https://cpan.metacpan.org/authors/id/M/MA/MALLEN/Pod-Perldoc-%{base_version}.tar.gz
# Unbundled from perl 5.28.0-RC1
Patch0: Pod-Perldoc-3.28-Upgrade-to-3.2801.patch
# 1/2 Fix searching for builtins in perlop POD, bug #1739463, CPAN RT#126015
Patch1: Pod-Perldoc-3.28-Add-a-test-for-a-truncated-perldoc-f-tr-output.patch
# 1/2 Fix searching for builtins in perlop POD, bug #1739463, CPAN RT#126015
Patch2: Pod-Perldoc-3.28-Search-for-X-in-the-whole-perlop-document.patch
Group: Development/Libraries
URL: http://search.cpan.org/dist/Pod-Perldoc/
Source0: http://www.cpan.org/authors/id/M/MA/MALLEN/Pod-Perldoc-%{version}.tar.gz
BuildArch: noarch
BuildRequires: findutils
BuildRequires: make
BuildRequires: perl-generators
BuildRequires: perl-interpreter
BuildRequires: perl(ExtUtils::MakeMaker) >= 6.76
BuildRequires: perl-generators
BuildRequires: perl(ExtUtils::MakeMaker)
BuildRequires: perl(strict)
BuildRequires: perl(warnings)
# Run-time:
@ -56,9 +51,6 @@ BuildRequires: perl(Pod::Text::Termcap)
# Text::ParseWords not used by tests
BuildRequires: perl(vars)
# Tests:
BuildRequires: perl(blib)
BuildRequires: perl(File::Spec)
BuildRequires: perl(FindBin)
BuildRequires: perl(Test::More)
# Optional tests:
%if !%{defined perl_bootstrap}
@ -92,23 +84,21 @@ Requires: perl(Symbol)
%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}^perl\\((Pod::Man|Pod::Simple::XMLOutStream|Pod::Simple::RTF)\\)$
%description
perldoc looks up a piece of documentation in POD format that is embedded
in the perl installation tree or in a Perl script, and displays it via
perldoc looks up a piece of documentation in .pod format that is embedded
in the perl installation tree or in a perl script, and displays it via
"groff -man | $PAGER". This is primarily used for the documentation for
the Perl library modules.
the perl library modules.
%prep
%setup -q -n Pod-Perldoc-%{base_version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%setup -q -n Pod-Perldoc-%{version}
%build
perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1
%{make_build}
perl Makefile.PL INSTALLDIRS=vendor
make %{?_smp_mflags}
%install
%{make_install}
make pure_install DESTDIR=$RPM_BUILD_ROOT
find $RPM_BUILD_ROOT -type f -name .packlist -delete
%{_fixperms} $RPM_BUILD_ROOT/*
%check
@ -122,61 +112,6 @@ make test
%{_mandir}/man3/*
%changelog
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 3.28.01-461
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 3.28.01-460
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.28.01-459
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.28.01-458
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Fri Jun 26 2020 Jitka Plesnikova <jplesnik@redhat.com> - 3.28.01-457
- Perl 5.32 re-rebuild of bootstrapped packages
* Mon Jun 22 2020 Jitka Plesnikova <jplesnik@redhat.com> - 3.28.01-456
- Increase release to favour standalone package
* Tue Mar 03 2020 Petr Pisar <ppisar@redhat.com> - 3.28.01-444
- Specify all dependencies
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.28.01-443
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Fri Aug 16 2019 Petr Pisar <ppisar@redhat.com> - 3.28.01-442
- Build-require blib module for tests (bug #1739463)
* Thu Aug 15 2019 Petr Pisar <ppisar@redhat.com> - 3.28.01-441
- Fix searching for builtins in perlop POD (bug #1739463)
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.28.01-440
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Sun Jun 02 2019 Jitka Plesnikova <jplesnik@redhat.com> - 3.28.01-439
- Perl 5.30 re-rebuild of bootstrapped packages
* Thu May 30 2019 Jitka Plesnikova <jplesnik@redhat.com> - 3.28.01-438
- Increase release to favour standalone package
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.28.01-419
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.28.01-418
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Sat Jun 30 2018 Jitka Plesnikova <jplesnik@redhat.com> - 3.28.01-417
- Perl 5.28 re-rebuild of bootstrapped packages
* Wed Jun 27 2018 Jitka Plesnikova <jplesnik@redhat.com> - 3.28.01-416
- Increase release to favour standalone package
* Thu May 24 2018 Jitka Plesnikova <jplesnik@redhat.com> - 3.28.01-1
- Upgrade to 3.2801 as provided in perl-5.28.0-RC1
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.28-396
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

Loading…
Cancel
Save