improve ruby-2.5 compatibility (epel8)

An unfortunate bug in rdoc-5.0 causes a build failure on epel8.  This is
fixed in ruby-2.6/rdoc-6.0.2¹.  Until/unless the fix is backported to
RHEL-8 (which seems unlikely), we can only patch around this.

Thanks, as usual, to Dan Allen for going above and beyond to patch this
upstream.

¹ https://github.com/ruby/rdoc/pull/586
  https://github.com/ruby/rdoc/commit/a1631aa
This commit is contained in:
Todd Zullinger 2023-05-25 23:06:29 -04:00
parent bd6465f42a
commit 22023dba55
3 changed files with 120 additions and 1 deletions

View File

@ -0,0 +1,25 @@
From cc9a8d3cd12f2c15e43bd263b8b8a9b32d097831 Mon Sep 17 00:00:00 2001
From: Dan Allen <dan.j.allen@gmail.com>
Date: Thu, 25 May 2023 18:39:56 -0600
Subject: [PATCH] use single-line block in manify method in manpage converter
to make it easier to patch
---
lib/asciidoctor/converter/manpage.rb | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/lib/asciidoctor/converter/manpage.rb b/lib/asciidoctor/converter/manpage.rb
index bcf2b784..a7aba996 100644
--- a/lib/asciidoctor/converter/manpage.rb
+++ b/lib/asciidoctor/converter/manpage.rb
@@ -716,9 +716,7 @@ def manify str, opts = {}
.gsub(LiteralBackslashRx) { $1 ? $& : '\\(rs' } # literal backslash (not a troff escape sequence)
.gsub(EllipsisCharRefRx, '...') # horizontal ellipsis
.gsub(LeadingPeriodRx, '\\\&.') # leading . is used in troff for macro call or other formatting; replace with \&.
- .gsub(EscapedMacroRx) do # drop orphaned \c escape lines, unescape troff macro, quote adjacent character, isolate macro line
- (rest = $3.lstrip).empty? ? %(.#{$1}"#{$2}") : %(.#{$1}"#{$2.rstrip}"#{LF}#{rest})
- end
+ .gsub(EscapedMacroRx) { (rest = $3.lstrip).empty? ? %(.#{$1}"#{$2}") : %(.#{$1}"#{$2.rstrip}"#{LF}#{rest}) } # drop orphaned \c escape lines, unescape troff macro, quote adjacent character, isolate macro line
.gsub('-', '\-')
.gsub('&lt;', '<')
.gsub('&gt;', '>')

View File

@ -0,0 +1,85 @@
From b7c03964cfc96af9ced5db3c1a6c7a7663de5cb2 Mon Sep 17 00:00:00 2001
From: Dan Allen <dan.j.allen@gmail.com>
Date: Fri, 26 May 2023 01:44:09 -0600
Subject: [PATCH] change dot layout in chained method call to be compatible
with rdoc generator from Ruby 2.5
---
lib/asciidoctor/converter/manpage.rb | 64 ++++++++++++++--------------
1 file changed, 32 insertions(+), 32 deletions(-)
diff --git a/lib/asciidoctor/converter/manpage.rb b/lib/asciidoctor/converter/manpage.rb
index a7aba996..be52e9be 100644
--- a/lib/asciidoctor/converter/manpage.rb
+++ b/lib/asciidoctor/converter/manpage.rb
@@ -712,38 +712,38 @@ def manify str, opts = {}
else
str = str.tr_s WHITESPACE, ' '
end
- str = str
- .gsub(LiteralBackslashRx) { $1 ? $& : '\\(rs' } # literal backslash (not a troff escape sequence)
- .gsub(EllipsisCharRefRx, '...') # horizontal ellipsis
- .gsub(LeadingPeriodRx, '\\\&.') # leading . is used in troff for macro call or other formatting; replace with \&.
- .gsub(EscapedMacroRx) { (rest = $3.lstrip).empty? ? %(.#{$1}"#{$2}") : %(.#{$1}"#{$2.rstrip}"#{LF}#{rest}) } # drop orphaned \c escape lines, unescape troff macro, quote adjacent character, isolate macro line
- .gsub('-', '\-')
- .gsub('&lt;', '<')
- .gsub('&gt;', '>')
- .gsub('&#43;', '+') # plus sign; alternately could use \c(pl
- .gsub('&#160;', '\~') # non-breaking space
- .gsub('&#169;', '\(co') # copyright sign
- .gsub('&#174;', '\(rg') # registered sign
- .gsub('&#8482;', '\(tm') # trademark sign
- .gsub('&#176;', '\(de') # degree sign
- .gsub('&#8201;', ' ') # thin space
- .gsub('&#8211;', '\(en') # en dash
- .gsub(EmDashCharRefRx, '\(em') # em dash
- .gsub('&#8216;', '\(oq') # left single quotation mark
- .gsub('&#8217;', '\(cq') # right single quotation mark
- .gsub('&#8220;', '\(lq') # left double quotation mark
- .gsub('&#8221;', '\(rq') # right double quotation mark
- .gsub('&#8592;', '\(<-') # leftwards arrow
- .gsub('&#8594;', '\(->') # rightwards arrow
- .gsub('&#8656;', '\(lA') # leftwards double arrow
- .gsub('&#8658;', '\(rA') # rightwards double arrow
- .gsub('&#8203;', '\:') # zero width space
- .gsub('&amp;', '&') # literal ampersand (NOTE must take place after any other replacement that includes &)
- .gsub('\'', '\*(Aq') # apostrophe / neutral single quote
- .gsub(MockMacroRx, '\1') # mock boundary
- .gsub(ESC_BS, '\\') # unescape troff backslash (NOTE update if more escapes are added)
- .gsub(ESC_FS, '.') # unescape full stop in troff commands (NOTE must take place after gsub(LeadingPeriodRx))
- .rstrip # strip trailing space
+ str = str.
+ gsub(LiteralBackslashRx) { $1 ? $& : '\\(rs' }. # literal backslash (not a troff escape sequence)
+ gsub(EllipsisCharRefRx, '...'). # horizontal ellipsis
+ gsub(LeadingPeriodRx, '\\\&.'). # leading . is used in troff for macro call or other formatting; replace with \&.
+ gsub(EscapedMacroRx) { (rest = $3.lstrip).empty? ? %(.#{$1}"#{$2}") : %(.#{$1}"#{$2.rstrip}"#{LF}#{rest}) }. # drop orphaned \c escape lines, unescape troff macro, quote adjacent character, isolate macro line
+ gsub('-', '\-').
+ gsub('&lt;', '<').
+ gsub('&gt;', '>').
+ gsub('&#43;', '+'). # plus sign; alternately could use \c(pl
+ gsub('&#160;', '\~'). # non-breaking space
+ gsub('&#169;', '\(co'). # copyright sign
+ gsub('&#174;', '\(rg'). # registered sign
+ gsub('&#8482;', '\(tm'). # trademark sign
+ gsub('&#176;', '\(de'). # degree sign
+ gsub('&#8201;', ' '). # thin space
+ gsub('&#8211;', '\(en'). # en dash
+ gsub(EmDashCharRefRx, '\(em'). # em dash
+ gsub('&#8216;', '\(oq'). # left single quotation mark
+ gsub('&#8217;', '\(cq'). # right single quotation mark
+ gsub('&#8220;', '\(lq'). # left double quotation mark
+ gsub('&#8221;', '\(rq'). # right double quotation mark
+ gsub('&#8592;', '\(<-'). # leftwards arrow
+ gsub('&#8594;', '\(->'). # rightwards arrow
+ gsub('&#8656;', '\(lA'). # leftwards double arrow
+ gsub('&#8658;', '\(rA'). # rightwards double arrow
+ gsub('&#8203;', '\:'). # zero width space
+ gsub('&amp;', '&'). # literal ampersand (NOTE must take place after any other replacement that includes &)
+ gsub('\'', '\*(Aq'). # apostrophe / neutral single quote
+ gsub(MockMacroRx, '\1'). # mock boundary
+ gsub(ESC_BS, '\\'). # unescape troff backslash (NOTE update if more escapes are added)
+ gsub(ESC_FS, '.'). # unescape full stop in troff commands (NOTE must take place after gsub(LeadingPeriodRx))
+ rstrip # strip trailing space
opts[:append_newline] ? %(#{str}#{LF}) : str
end

View File

@ -7,10 +7,16 @@
Summary: A fast, open source AsciiDoc implementation in Ruby
Name: rubygem-%{gem_name}
Version: 2.0.20
Release: 1%{?dist}
Release: 2%{?dist}
License: MIT
URL: https://asciidoctor.org
Source0: https://github.com/asciidoctor/asciidoctor/archive/%{gittag}/%{gem_name}-%{version}%{pre}.tar.gz
# improve ruby-2.5 compatibility
# https://github.com/asciidoctor/asciidoctor/issues/4462
# https://github.com/asciidoctor/asciidoctor/commit/cc9a8d3c
Patch0: 0001-use-single-line-block-in-manify-method-in-manpage-co.patch
# https://github.com/asciidoctor/asciidoctor/commit/b7c03964
Patch1: 0002-change-dot-layout-in-chained-method-call-to-be-compa.patch
%if 0%{?el7}
Requires: ruby(release)
BuildRequires: ruby(release)
@ -121,6 +127,9 @@ cp -a .%{gem_instdir}/man/*.1 \
%doc %{gem_docdir}
%changelog
* Thu May 25 2023 Todd Zullinger <tmz@pobox.com> - 2.0.20-2
- improve ruby-2.5 compatibility (epel8)
* Thu May 18 2023 Todd Zullinger <tmz@pobox.com> - 2.0.20-1
- update to asciidoctor 2.0.20 (rhbz#2208089)