diff options
author | 2023-04-07 15:03:41 +0100 | |
---|---|---|
committer | 2023-04-07 15:25:23 +0100 | |
commit | e23a9359aab2c642efffb438795a52ca029941db (patch) | |
tree | f4cebc7ca8be7023ef1b8f874b57ce60fffc2c7b /dev-ruby/asciidoctor | |
parent | profiles: deprecate dev-ruby/erubis (diff) | |
download | gentoo-e23a9359aab2c642efffb438795a52ca029941db.tar.gz gentoo-e23a9359aab2c642efffb438795a52ca029941db.tar.bz2 gentoo-e23a9359aab2c642efffb438795a52ca029941db.zip |
dev-ruby/asciidoctor: enable ruby32
Adds two patches, but it's low risk:
1. Port to haml-6, but it's only a test dep;
2. Add a ruby32 patch which Fedora have been using for a while.
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'dev-ruby/asciidoctor')
3 files changed, 215 insertions, 0 deletions
diff --git a/dev-ruby/asciidoctor/asciidoctor-2.0.18-r1.ebuild b/dev-ruby/asciidoctor/asciidoctor-2.0.18-r1.ebuild new file mode 100644 index 000000000000..2ed8b6ee1b63 --- /dev/null +++ b/dev-ruby/asciidoctor/asciidoctor-2.0.18-r1.ebuild @@ -0,0 +1,56 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 +USE_RUBY="ruby27 ruby30 ruby31 ruby32" + +RUBY_FAKEGEM_TASK_TEST="CUCUMBER_PUBLISH_QUIET=true test features" +RUBY_FAKEGEM_EXTRADOC="CHANGELOG.adoc README.adoc" + +RUBY_FAKEGEM_EXTRAINSTALL="data" + +RUBY_FAKEGEM_GEMSPEC="asciidoctor.gemspec" + +inherit ruby-fakegem + +DESCRIPTION="Processor for converting AsciiDoc into HTML 5, DocBook 4.5 and other formats" +HOMEPAGE="https://github.com/asciidoctor/asciidoctor" +SRC_URI="https://github.com/${PN}/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~x86" +IUSE="" + +ruby_add_bdepend "test? ( + dev-util/cucumber + dev-ruby/rspec-expectations:* + dev-ruby/asciimath + dev-ruby/coderay + dev-ruby/concurrent-ruby + dev-ruby/erubi + dev-ruby/haml:6 + dev-ruby/nokogiri + dev-ruby/rouge + dev-ruby/slim + dev-ruby/tilt )" + +PATCHES=( + "${FILESDIR}"/${PN}-2.0.18-haml-6.patch + "${FILESDIR}"/${PN}-2.0.18-ruby32.patch +) + +all_ruby_prepare() { + rm Gemfile || die + + sed -i -e "s:_relative ': './:" ${RUBY_FAKEGEM_GEMSPEC} || die + + # Avoid broken blocks_test.rb (already appears to be fixed upstream) + rm -f test/blocks_test.rb || die +} + +all_ruby_install() { + all_fakegem_install + + doman man/asciidoctor.1 +} diff --git a/dev-ruby/asciidoctor/files/asciidoctor-2.0.18-haml-6.patch b/dev-ruby/asciidoctor/files/asciidoctor-2.0.18-haml-6.patch new file mode 100644 index 000000000000..b6896999f838 --- /dev/null +++ b/dev-ruby/asciidoctor/files/asciidoctor-2.0.18-haml-6.patch @@ -0,0 +1,130 @@ +https://sources.debian.org/patches/asciidoctor/2.0.18-2/0001-Port-tests-to-haml-6.patch/ (backport) +https://github.com/asciidoctor/asciidoctor/pull/4395 + +From 25ee484dd66cc813eaa421d1c104ae64478e51ff Mon Sep 17 00:00:00 2001 +From: Antonio Terceiro <terceiro@debian.org> +Date: Mon, 26 Dec 2022 13:11:36 -0300 +Subject: [PATCH] Port tests to haml 6 + +Forwarded: https://github.com/asciidoctor/asciidoctor/pull/4395 +Fixes: #4382 +--- a/asciidoctor.gemspec ++++ b/asciidoctor.gemspec +@@ -38,7 +38,7 @@ Gem::Specification.new do |s| + s.add_development_dependency 'cucumber', '~> 3.1.0' + # erubi is needed for testing alternate eRuby impls + s.add_development_dependency 'erubi', '~> 1.10.0' +- s.add_development_dependency 'haml', '~> 5.2.0' ++ s.add_development_dependency 'haml', '~> 6.1' + s.add_development_dependency 'minitest', '~> 5.14.0' + s.add_development_dependency 'nokogiri', '~> 1.10.0' + s.add_development_dependency 'rake', '~> 12.3.0' +--- a/lib/asciidoctor/converter/template.rb ++++ b/lib/asciidoctor/converter/template.rb +@@ -29,7 +29,7 @@ class Converter::TemplateConverter < Con + erb: { trim: 0 }, + # TODO line 466 of haml/compiler.rb sorts the attributes; file an issue to make this configurable + # NOTE AsciiDoc syntax expects HTML/XML output to use double quotes around attribute values +- haml: { format: :xhtml, attr_wrapper: '"', escape_attrs: false, ugly: true }, ++ haml: { format: :xhtml, attr_quote: '"', escape_attrs: false, ugly: true }, + slim: { disable_escape: true, sort_attrs: false, pretty: false }, + } + +--- a/test/converter_test.rb ++++ b/test/converter_test.rb +@@ -9,7 +9,7 @@ context 'Converter' do + assert_kind_of Asciidoctor::Converter::CompositeConverter, doc.converter + selected = doc.converter.find_converter('paragraph') + assert_kind_of Asciidoctor::Converter::TemplateConverter, selected +- assert_kind_of Tilt::HamlTemplate, selected.templates['paragraph'] ++ assert_kind_of Haml::Template, selected.templates['paragraph'] + assert_equal :html5, selected.templates['paragraph'].options[:format] + end + +@@ -18,7 +18,7 @@ context 'Converter' do + assert_kind_of Asciidoctor::Converter::CompositeConverter, doc.converter + selected = doc.converter.find_converter('paragraph') + assert_kind_of Asciidoctor::Converter::TemplateConverter, selected +- assert_kind_of Tilt::HamlTemplate, selected.templates['paragraph'] ++ assert_kind_of Haml::Template, selected.templates['paragraph'] + assert_equal :xhtml, selected.templates['paragraph'].options[:format] + end + +@@ -95,7 +95,7 @@ context 'Converter' do + %w(paragraph sidebar).each do |node_name| + selected = doc.converter.find_converter node_name + assert_kind_of Asciidoctor::Converter::TemplateConverter, selected +- assert_kind_of Tilt::HamlTemplate, selected.templates[node_name] ++ assert_kind_of Haml::Template, selected.templates[node_name] + assert_equal %(block_#{node_name}.html.haml), File.basename(selected.templates[node_name].file) + end + end +@@ -126,7 +126,7 @@ context 'Converter' do + %w(paragraph).each do |node_name| + selected = doc.converter.find_converter node_name + assert_kind_of Asciidoctor::Converter::TemplateConverter, selected +- assert_kind_of Tilt::HamlTemplate, selected.templates[node_name] ++ assert_kind_of Haml::Template, selected.templates[node_name] + assert_equal %(block_#{node_name}.xml.haml), File.basename(selected.templates[node_name].file) + end + end +@@ -215,7 +215,7 @@ context 'Converter' do + refute_empty caches[:templates] + paragraph_template = caches[:templates].values.find {|t| File.basename(t.file) == 'block_paragraph.html.haml' } + refute_nil paragraph_template +- assert_kind_of ::Tilt::HamlTemplate, paragraph_template ++ assert_kind_of Haml::Template, paragraph_template + end + + test 'should be able to disable template cache' do +--- a/test/fixtures/custom-backends/haml/docbook5/block_paragraph.xml.haml ++++ b/test/fixtures/custom-backends/haml/docbook5/block_paragraph.xml.haml +@@ -1,6 +1,6 @@ + - if title? + %formalpara{'xml:id'=>@id, role: (attr :role), xreflabel: (attr :reftext)} +- %title=title +- %para=content ++ %title!=title ++ %para!=content + - else +- %para{'xml:id'=>@id, role: (attr :role), xreflabel: (attr :reftext)}=content ++ %para{'xml:id'=>@id, role: (attr :role), xreflabel: (attr :reftext)}!=content +--- a/test/fixtures/custom-backends/haml/html5-tweaks/block_paragraph.html.haml ++++ b/test/fixtures/custom-backends/haml/html5-tweaks/block_paragraph.html.haml +@@ -1 +1 @@ +-%p=content ++%p!=content +--- a/test/fixtures/custom-backends/haml/html5-tweaks/embedded.html.haml ++++ b/test/fixtures/custom-backends/haml/html5-tweaks/embedded.html.haml +@@ -1 +1 @@ +-=content ++!=content +--- a/test/fixtures/custom-backends/haml/html5/block_paragraph.html.haml ++++ b/test/fixtures/custom-backends/haml/html5/block_paragraph.html.haml +@@ -1,3 +1,3 @@ + - if title? +- .title=title +-%p{id: @id, class: (attr 'role')}=content ++ .title!=title ++%p{id: @id, class: (attr 'role')}!=content +--- a/test/fixtures/custom-backends/haml/html5/block_sidebar.html.haml ++++ b/test/fixtures/custom-backends/haml/html5/block_sidebar.html.haml +@@ -1,5 +1,5 @@ + %aside{id: @id, class: (attr 'role')} + - if title? + %header +- %h1=title +- =content.chomp ++ %h1!=title ++ !=content.chomp +--- a/test/invoker_test.rb ++++ b/test/invoker_test.rb +@@ -616,7 +616,7 @@ context 'Invoker' do + assert_kind_of Asciidoctor::Converter::CompositeConverter, doc.converter + selected = doc.converter.find_converter 'paragraph' + assert_kind_of Asciidoctor::Converter::TemplateConverter, selected +- assert_kind_of Tilt::HamlTemplate, selected.templates['paragraph'] ++ assert_kind_of Haml::Template, selected.templates['paragraph'] + end + + test 'should load custom templates from multiple template directories' do diff --git a/dev-ruby/asciidoctor/files/asciidoctor-2.0.18-ruby32.patch b/dev-ruby/asciidoctor/files/asciidoctor-2.0.18-ruby32.patch new file mode 100644 index 000000000000..86e577c796ec --- /dev/null +++ b/dev-ruby/asciidoctor/files/asciidoctor-2.0.18-ruby32.patch @@ -0,0 +1,29 @@ +https://github.com/asciidoctor/asciidoctor/commit/b3c05398b1b4b483fe5f9c9ef89dc772863cf6f1 +https://src.fedoraproject.org/rpms/rubygem-asciidoctor/raw/rawhide/f/0001-resolves-4390-fix-call-order-so-use-of-an-include-fi.patch + +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 + +--- 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 |