Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package rubygem-loofah for openSUSE:Factory checked in at 2022-03-07 17:48:14 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-loofah (Old) and /work/SRC/openSUSE:Factory/.rubygem-loofah.new.1958 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-loofah" Mon Mar 7 17:48:14 2022 rev:21 rq:959948 version:2.14.0 Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-loofah/rubygem-loofah.changes 2021-12-25 20:17:11.605276354 +0100 +++ /work/SRC/openSUSE:Factory/.rubygem-loofah.new.1958/rubygem-loofah.changes 2022-03-07 17:49:03.319083209 +0100 @@ -1,0 +2,14 @@ +Thu Mar 3 08:22:28 UTC 2022 - Stephan Kulow <co...@suse.com> + +updated to version 2.14.0 + see installed CHANGELOG.md + + ## 2.14.0 / 2022-02-11 + + ### Features + + * The `#to_text` method on `Loofah::HTML::{Document,DocumentFragment}` replaces `<br>` line break elements with a newline. [[#225](https://github.com/flavorjones/loofah/issues/225)] + + + +------------------------------------------------------------------- Old: ---- loofah-2.13.0.gem New: ---- loofah-2.14.0.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-loofah.spec ++++++ --- /var/tmp/diff_new_pack.JDzxnE/_old 2022-03-07 17:49:03.843083058 +0100 +++ /var/tmp/diff_new_pack.JDzxnE/_new 2022-03-07 17:49:03.847083057 +0100 @@ -1,7 +1,7 @@ # # spec file for package rubygem-loofah # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -24,7 +24,7 @@ # Name: rubygem-loofah -Version: 2.13.0 +Version: 2.14.0 Release: 0 %define mod_name loofah %define mod_full_name %{mod_name}-%{version} @@ -45,6 +45,7 @@ Loofah excels at HTML sanitization (XSS prevention). It includes some nice HTML sanitizers, which are based on HTML5lib's whitelist, so it most likely won't make your codes less secure. + %prep %build ++++++ loofah-2.13.0.gem -> loofah-2.14.0.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md --- old/CHANGELOG.md 2021-12-10 06:20:57.000000000 +0100 +++ new/CHANGELOG.md 2022-02-11 20:08:24.000000000 +0100 @@ -1,5 +1,12 @@ # Changelog +## 2.14.0 / 2022-02-11 + +### Features + +* The `#to_text` method on `Loofah::HTML::{Document,DocumentFragment}` replaces `<br>` line break elements with a newline. [[#225](https://github.com/flavorjones/loofah/issues/225)] + + ## 2.13.0 / 2021-12-10 ### Bug fixes diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/README.md new/README.md --- old/README.md 2021-12-10 06:20:57.000000000 +0100 +++ new/README.md 2022-02-11 20:08:24.000000000 +0100 @@ -133,13 +133,12 @@ doc.text # => "ohai! div is safe " ``` -Also, `to_text` is available, which does the right thing with -whitespace around block-level elements. +Also, `to_text` is available, which does the right thing with whitespace around block-level and line break elements. ``` ruby -doc = Loofah.fragment("<h1>Title</h1><div>Content</div>") -doc.text # => "TitleContent" # probably not what you want -doc.to_text # => "\nTitle\n\nContent\n" # better +doc = Loofah.fragment("<h1>Title</h1><div>Content<br>Next line</div>") +doc.text # => "TitleContentNext line" # probably not what you want +doc.to_text # => "\nTitle\n\nContent\nNext line\n" # better ``` ### Loofah::XML::Document and Loofah::XML::DocumentFragment Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/loofah/elements.rb new/lib/loofah/elements.rb --- old/lib/loofah/elements.rb 2021-12-10 06:20:57.000000000 +0100 +++ new/lib/loofah/elements.rb 2022-02-11 20:08:24.000000000 +0100 @@ -70,8 +70,6 @@ video ] - STRICT_BLOCK_LEVEL = STRICT_BLOCK_LEVEL_HTML4 + STRICT_BLOCK_LEVEL_HTML5 - # The following elements may also be considered block-level # elements since they may contain block-level elements LOOSE_BLOCK_LEVEL = Set.new %w[dd @@ -86,7 +84,12 @@ tr ] + # Elements that aren't block but should generate a newline in #to_text + INLINE_LINE_BREAK = Set.new(["br"]) + + STRICT_BLOCK_LEVEL = STRICT_BLOCK_LEVEL_HTML4 + STRICT_BLOCK_LEVEL_HTML5 BLOCK_LEVEL = STRICT_BLOCK_LEVEL + LOOSE_BLOCK_LEVEL + LINEBREAKERS = BLOCK_LEVEL + INLINE_LINE_BREAK end ::Loofah::MetaHelpers.add_downcased_set_members_to_all_set_constants ::Loofah::Elements diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/loofah/instance_methods.rb new/lib/loofah/instance_methods.rb --- old/lib/loofah/instance_methods.rb 2021-12-10 06:20:57.000000000 +0100 +++ new/lib/loofah/instance_methods.rb 2022-02-11 20:08:24.000000000 +0100 @@ -112,11 +112,11 @@ # Returns a plain-text version of the markup contained by the # fragment, with HTML entities encoded. # - # This method is slower than #to_text, but is clever about - # whitespace around block elements. + # This method is slower than #text, but is clever about + # whitespace around block elements and line break elements. # - # Loofah.document("<h1>Title</h1><div>Content</div>").to_text - # # => "\nTitle\n\nContent\n" + # Loofah.document("<h1>Title</h1><div>Content<br>Next line</div>").to_text + # # => "\nTitle\n\nContent\nNext line\n" # def to_text(options = {}) Loofah.remove_extraneous_whitespace self.dup.scrub!(:newline_block_elements).text(options) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/loofah/scrubbers.rb new/lib/loofah/scrubbers.rb --- old/lib/loofah/scrubbers.rb 2021-12-10 06:20:57.000000000 +0100 +++ new/lib/loofah/scrubbers.rb 2022-02-11 20:08:24.000000000 +0100 @@ -240,8 +240,13 @@ end def scrub(node) - return CONTINUE unless Loofah::Elements::BLOCK_LEVEL.include?(node.name) - node.add_next_sibling Nokogiri::XML::Text.new("\n#{node.content}\n", node.document) + return CONTINUE unless Loofah::Elements::LINEBREAKERS.include?(node.name) + replacement = if Loofah::Elements::INLINE_LINE_BREAK.include?(node.name) + "\n" + else + "\n#{node.content}\n" + end + node.add_next_sibling Nokogiri::XML::Text.new(replacement, node.document) node.remove end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/loofah/version.rb new/lib/loofah/version.rb --- old/lib/loofah/version.rb 2021-12-10 06:20:57.000000000 +0100 +++ new/lib/loofah/version.rb 2022-02-11 20:08:24.000000000 +0100 @@ -1,5 +1,5 @@ # frozen_string_literal: true module Loofah # The version of Loofah you are using - VERSION = "2.13.0" + VERSION = "2.14.0" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2021-12-10 06:20:57.000000000 +0100 +++ new/metadata 2022-02-11 20:08:24.000000000 +0100 @@ -1,7 +1,7 @@ --- !ruby/object:Gem::Specification name: loofah version: !ruby/object:Gem::Version - version: 2.13.0 + version: 2.14.0 platform: ruby authors: - Mike Dalessio @@ -9,7 +9,7 @@ autorequire: bindir: bin cert_chain: [] -date: 2021-12-10 00:00:00.000000000 Z +date: 2022-02-11 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: crass @@ -199,7 +199,7 @@ - !ruby/object:Gem::Version version: '0' requirements: [] -rubygems_version: 3.2.32 +rubygems_version: 3.3.5 signing_key: specification_version: 4 summary: Loofah is a general library for manipulating and transforming HTML/XML documents