!10 [sync] PR-9: support libxml2-2.10.4 backported

From: @openeuler-sync-bot 
Reviewed-by: @jxy_git 
Signed-off-by: @jxy_git
This commit is contained in:
openeuler-ci-bot 2023-08-14 09:58:42 +00:00 committed by Gitee
commit b202de5025
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 63 additions and 1 deletions

View File

@ -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 <zouzhimin@kylinos.cn> - 2.18.0-2
- support libxml2-2.10.4 backported
* Thu Jul 14 2022 Ge Wang <wangge20@h-partners.com> - 2.18.0-1
- update to 2.18.0

View File

@ -0,0 +1,57 @@
From 5145b0da80cceaf6413e0ede3e0f384e07e3033e Mon Sep 17 00:00:00 2001
From: zouzhimin <zouzhimin@kylinos.cn>
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 "<p>Foo <b>BOLD</b></p>", whitewashed.to_s.strip
else
assert_equal "<p>Foo <b>BOLD<p></p></b></p>", 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 "<p>Foo <b>BOLD</b></p>", whitewashed.xpath("/html/body/*").to_s
else
assert_equal "<p>Foo <b>BOLD<p></p></b></p>", 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 "<html><body>#{WHITEWASH_FRAGMENT}</body></html>"
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 "<div>#{WHITEWASH_FRAGMENT}</div>"
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