lib/bolognese/utils.rb in bolognese-1.2.5 vs lib/bolognese/utils.rb in bolognese-1.2.6
- old
+ new
@@ -749,10 +749,11 @@
options[:tags] ||= Set.new(%w(strong em b i code pre sub sup br))
content = options[:content] || "__content__"
custom_scrubber = Bolognese::WhitelistScrubber.new(options)
if text.is_a?(String)
- Loofah.scrub_fragment(text, custom_scrubber).to_s.gsub(/\u00a0/, ' ').strip
+ # remove excessive internal whitespace with squish
+ Loofah.scrub_fragment(text, custom_scrubber).to_s.squish
elsif text.is_a?(Hash)
sanitize(text.fetch(content, nil))
elsif text.is_a?(Array)
a = text.map { |e| e.is_a?(Hash) ? sanitize(e.fetch(content, nil)) : sanitize(e) }.uniq
a = options[:first] ? a.first : a.unwrap