fixes for ruby-3.2.x and rouge-4.1.0 (rhbz#2171711)

Apply upstream fixes for ruby >= 3.2.0rc1¹ and rouge >= 4.1².

Many thanks to Dan Allen for fixing these issues in very short order!

¹ https://github.com/asciidoctor/asciidoctor/issues/4390
² https://github.com/asciidoctor/asciidoctor/issues/4406
This commit is contained in:
Todd Zullinger 2023-02-21 12:30:47 -05:00
parent 01966d7434
commit 24ce10d5c7
3 changed files with 67 additions and 1 deletions

View File

@ -0,0 +1,26 @@
From 066a4618b92fb08d6c9928e134d86bbbcaa4f8f2 Mon Sep 17 00:00:00 2001
From: Todd Zullinger <tmz@pobox.com>
Date: Tue, 21 Feb 2023 05:42:24 -0500
Subject: [PATCH] backport fix for #4406 fix test assertion for fallback Rouge
stylesheet to be compatible with Rouge 4.1
Co-authored-by: Dan Allen <dan.j.allen@gmail.com>
---
test/syntax_highlighter_test.rb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/test/syntax_highlighter_test.rb b/test/syntax_highlighter_test.rb
index a9f5c41f..43548a12 100644
--- a/test/syntax_highlighter_test.rb
+++ b/test/syntax_highlighter_test.rb
@@ -1017,8 +1017,8 @@ def highlight?
EOS
output = convert_string input, safe: :safe, linkcss_default: true
assert_css 'pre.rouge', output, 1
- assert_includes output, 'pre.rouge .no {'
- assert_match %r/pre\.rouge \{\s*background-color: #f8f8f8;/m, output
+ expected_css = (Asciidoctor::SyntaxHighlighter.for 'rouge').read_stylesheet 'github'
+ assert_includes output, expected_css
end
test 'should restore isolated callout mark on last line of source' do

View File

@ -0,0 +1,32 @@
From b3c05398b1b4b483fe5f9c9ef89dc772863cf6f1 Mon Sep 17 00:00:00 2001
From: Dan Allen <dan.j.allen@gmail.com>
Date: Mon, 20 Feb 2023 23:47:59 -0700
Subject: [PATCH] resolves #4390 fix call order so use of an include file with
invalid encoding continues to raise error when using Ruby >= 3.2.0
---
lib/asciidoctor/reader.rb | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/asciidoctor/reader.rb b/lib/asciidoctor/reader.rb
index d18b27c9..3e189498 100644
--- a/lib/asciidoctor/reader.rb
+++ b/lib/asciidoctor/reader.rb
@@ -1197,15 +1197,16 @@ def preprocess_include_directive target, attrlist
push_include inc_lines, inc_path, relpath, inc_offset, parsed_attrs
end
else
+ inc_content = nil
begin
# NOTE read content before shift so cursor is only advanced if IO operation succeeds
inc_content = reader.call(inc_path, read_mode) {|f| f.read }
shift
- push_include inc_content, inc_path, relpath, 1, parsed_attrs
rescue
logger.error message_with_context %(include #{target_type} not readable: #{inc_path}), source_location: cursor
return replace_next_line %(Unresolved directive in #{@path} - include::#{expanded_target}[#{attrlist}])
end
+ push_include inc_content, inc_path, relpath, 1, parsed_attrs
end
true
end

View File

@ -7,10 +7,15 @@
Summary: A fast, open source AsciiDoc implementation in Ruby Summary: A fast, open source AsciiDoc implementation in Ruby
Name: rubygem-%{gem_name} Name: rubygem-%{gem_name}
Version: 2.0.18 Version: 2.0.18
Release: 2%{?dist} Release: 3%{?dist}
License: MIT License: MIT
URL: https://asciidoctor.org URL: https://asciidoctor.org
Source0: https://github.com/asciidoctor/asciidoctor/archive/%{gittag}/%{gem_name}-%{version}%{pre}.tar.gz Source0: https://github.com/asciidoctor/asciidoctor/archive/%{gittag}/%{gem_name}-%{version}%{pre}.tar.gz
# https://bugzilla.redhat.com/2171711
# https://github.com/asciidoctor/asciidoctor/issues/4390
Patch0: 0001-resolves-4390-fix-call-order-so-use-of-an-include-fi.patch
# https://github.com/asciidoctor/asciidoctor/issues/4406
Patch1: 0001-backport-fix-for-4406-fix-test-assertion-for-fallbac.patch
%if 0%{?el7} %if 0%{?el7}
Requires: ruby(release) Requires: ruby(release)
BuildRequires: ruby(release) BuildRequires: ruby(release)
@ -121,6 +126,9 @@ cp -a .%{gem_instdir}/man/*.1 \
%doc %{gem_docdir} %doc %{gem_docdir}
%changelog %changelog
* Mon Feb 20 2023 Todd Zullinger <tmz@pobox.com> - 2.0.18-3
- fixes for ruby-3.2.x and rouge-4.1.0 (rhbz#2171711)
* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.18-2 * Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.18-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild