From 22023dba550d8e1ddaec57f1433aa9992fd496b1 Mon Sep 17 00:00:00 2001 From: Todd Zullinger Date: Thu, 25 May 2023 23:06:29 -0400 Subject: [PATCH] improve ruby-2.5 compatibility (epel8) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- ...block-in-manify-method-in-manpage-co.patch | 25 ++++++ ...t-in-chained-method-call-to-be-compa.patch | 85 +++++++++++++++++++ rubygem-asciidoctor.spec | 11 ++- 3 files changed, 120 insertions(+), 1 deletion(-) create mode 100644 0001-use-single-line-block-in-manify-method-in-manpage-co.patch create mode 100644 0002-change-dot-layout-in-chained-method-call-to-be-compa.patch diff --git a/0001-use-single-line-block-in-manify-method-in-manpage-co.patch b/0001-use-single-line-block-in-manify-method-in-manpage-co.patch new file mode 100644 index 0000000..2db9cdb --- /dev/null +++ b/0001-use-single-line-block-in-manify-method-in-manpage-co.patch @@ -0,0 +1,25 @@ +From cc9a8d3cd12f2c15e43bd263b8b8a9b32d097831 Mon Sep 17 00:00:00 2001 +From: Dan Allen +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('<', '<') + .gsub('>', '>') diff --git a/0002-change-dot-layout-in-chained-method-call-to-be-compa.patch b/0002-change-dot-layout-in-chained-method-call-to-be-compa.patch new file mode 100644 index 0000000..351d5cc --- /dev/null +++ b/0002-change-dot-layout-in-chained-method-call-to-be-compa.patch @@ -0,0 +1,85 @@ +From b7c03964cfc96af9ced5db3c1a6c7a7663de5cb2 Mon Sep 17 00:00:00 2001 +From: Dan Allen +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('<', '<') +- .gsub('>', '>') +- .gsub('+', '+') # plus sign; alternately could use \c(pl +- .gsub(' ', '\~') # non-breaking space +- .gsub('©', '\(co') # copyright sign +- .gsub('®', '\(rg') # registered sign +- .gsub('™', '\(tm') # trademark sign +- .gsub('°', '\(de') # degree sign +- .gsub(' ', ' ') # thin space +- .gsub('–', '\(en') # en dash +- .gsub(EmDashCharRefRx, '\(em') # em dash +- .gsub('‘', '\(oq') # left single quotation mark +- .gsub('’', '\(cq') # right single quotation mark +- .gsub('“', '\(lq') # left double quotation mark +- .gsub('”', '\(rq') # right double quotation mark +- .gsub('←', '\(<-') # leftwards arrow +- .gsub('→', '\(->') # rightwards arrow +- .gsub('⇐', '\(lA') # leftwards double arrow +- .gsub('⇒', '\(rA') # rightwards double arrow +- .gsub('​', '\:') # zero width space +- .gsub('&', '&') # 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('<', '<'). ++ gsub('>', '>'). ++ gsub('+', '+'). # plus sign; alternately could use \c(pl ++ gsub(' ', '\~'). # non-breaking space ++ gsub('©', '\(co'). # copyright sign ++ gsub('®', '\(rg'). # registered sign ++ gsub('™', '\(tm'). # trademark sign ++ gsub('°', '\(de'). # degree sign ++ gsub(' ', ' '). # thin space ++ gsub('–', '\(en'). # en dash ++ gsub(EmDashCharRefRx, '\(em'). # em dash ++ gsub('‘', '\(oq'). # left single quotation mark ++ gsub('’', '\(cq'). # right single quotation mark ++ gsub('“', '\(lq'). # left double quotation mark ++ gsub('”', '\(rq'). # right double quotation mark ++ gsub('←', '\(<-'). # leftwards arrow ++ gsub('→', '\(->'). # rightwards arrow ++ gsub('⇐', '\(lA'). # leftwards double arrow ++ gsub('⇒', '\(rA'). # rightwards double arrow ++ gsub('​', '\:'). # zero width space ++ gsub('&', '&'). # 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 + diff --git a/rubygem-asciidoctor.spec b/rubygem-asciidoctor.spec index 899d317..95a3ef1 100644 --- a/rubygem-asciidoctor.spec +++ b/rubygem-asciidoctor.spec @@ -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 - 2.0.20-2 +- improve ruby-2.5 compatibility (epel8) + * Thu May 18 2023 Todd Zullinger - 2.0.20-1 - update to asciidoctor 2.0.20 (rhbz#2208089)