diff --git a/rubygem-loofah.spec b/rubygem-loofah.spec index bd02cdf..5b6aa02 100644 --- a/rubygem-loofah.spec +++ b/rubygem-loofah.spec @@ -2,7 +2,7 @@ Name: rubygem-%{gem_name} Version: 2.18.0 -Release: 1 +Release: 2 Summary: Manipulate and transform HTML/XML documents and fragments License: MIT URL: https://github.com/flavorjones/loofah @@ -10,6 +10,7 @@ Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem # git clone https://github.com/flavorjones/loofah.git && cd loofah # git archive -v -o loofah-2.10.0-test.tar.gz v2.10.0 test/ Source1: https://github.com/flavorjones/loofah/archive/refs/tags/v2.18.0.tar.gz +Patch0: support-libxml2-2.10.4-backported.patch BuildRequires: ruby(release) rubygems-devel rubygem(nokogiri) >= 1.6.6.2 rubygem(minitest) BuildRequires: rubygem(crass) rubygem(rr) ruby BuildArch: noarch @@ -30,6 +31,7 @@ Documentation for %{name}. %prep %setup -q -n %{gem_name}-%{version} -b1 +%patch0 -p1 %build gem build ../%{gem_name}-%{version}.gemspec @@ -60,6 +62,9 @@ popd %doc %{gem_instdir}/SECURITY.md %changelog +* Mon Aug 14 2023 zouzhimin - 2.18.0-2 +- support libxml2-2.10.4 backported + * Thu Jul 14 2022 Ge Wang - 2.18.0-1 - update to 2.18.0 diff --git a/support-libxml2-2.10.4-backported.patch b/support-libxml2-2.10.4-backported.patch new file mode 100644 index 0000000..ae99d82 --- /dev/null +++ b/support-libxml2-2.10.4-backported.patch @@ -0,0 +1,57 @@ +From 5145b0da80cceaf6413e0ede3e0f384e07e3033e Mon Sep 17 00:00:00 2001 +From: zouzhimin +Date: Sat, 12 Aug 2023 03:38:46 +0800 +Subject: [PATCH] support libxml2 2.10.4 backported + +--- + test/integration/test_ad_hoc.rb | 4 ++-- + test/integration/test_scrubbers.rb | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/test/integration/test_ad_hoc.rb b/test/integration/test_ad_hoc.rb +index 9f87187..2efc8fa 100644 +--- a/test/integration/test_ad_hoc.rb ++++ b/test/integration/test_ad_hoc.rb +@@ -79,7 +79,7 @@ class IntegrationTestAdHoc < Loofah::TestCase + + def test_fragment_whitewash_on_microsofty_markup + whitewashed = Loofah.fragment(MSWORD_HTML).scrub!(:whitewash) +- if Nokogiri.uses_libxml?("<2.9.11") ++ if Nokogiri.uses_libxml?("<2.9.11") || Nokogiri.uses_libxml?(">=2.10.4") + assert_equal "

Foo BOLD

", whitewashed.to_s.strip + else + assert_equal "

Foo BOLD

", whitewashed.to_s.strip +@@ -88,7 +88,7 @@ class IntegrationTestAdHoc < Loofah::TestCase + + def test_document_whitewash_on_microsofty_markup + whitewashed = Loofah.document(MSWORD_HTML).scrub!(:whitewash) +- if Nokogiri.uses_libxml?("<2.9.11") ++ if Nokogiri.uses_libxml?("<2.9.11") || Nokogiri.uses_libxml?(">=2.10.4") + assert_equal "

Foo BOLD

", whitewashed.xpath("/html/body/*").to_s + else + assert_equal "

Foo BOLD

", whitewashed.xpath("/html/body/*").to_s +diff --git a/test/integration/test_scrubbers.rb b/test/integration/test_scrubbers.rb +index c8636a3..ed86b1b 100644 +--- a/test/integration/test_scrubbers.rb ++++ b/test/integration/test_scrubbers.rb +@@ -69,7 +69,7 @@ class IntegrationTestScrubbers < Loofah::TestCase + doc = Loofah::HTML::Document.parse "#{WHITEWASH_FRAGMENT}" + result = doc.scrub! :whitewash + +- ww_result = Nokogiri.uses_libxml?("<2.9.11") ? WHITEWASH_RESULT : WHITEWASH_RESULT_LIBXML2911 ++ ww_result = (Nokogiri.uses_libxml?("<2.9.11") || Nokogiri.uses_libxml?(">=2.10.4")) ? WHITEWASH_RESULT : WHITEWASH_RESULT_LIBXML2911 + assert_equal ww_result, doc.xpath("/html/body").inner_html + assert_equal doc, result + end +@@ -248,7 +248,7 @@ class IntegrationTestScrubbers < Loofah::TestCase + doc = Loofah::HTML::DocumentFragment.parse "
#{WHITEWASH_FRAGMENT}
" + result = doc.scrub! :whitewash + +- ww_result = Nokogiri.uses_libxml?("<2.9.11") ? WHITEWASH_RESULT : WHITEWASH_RESULT_LIBXML2911 ++ ww_result = (Nokogiri.uses_libxml?("<2.9.11") || Nokogiri.uses_libxml?(">=2.10.4")) ? WHITEWASH_RESULT : WHITEWASH_RESULT_LIBXML2911 + assert_equal ww_result, doc.xpath("./div").inner_html + assert_equal doc, result + end +-- +2.39.1 +