Sha256: 35bef27d55c8ef36e4ff59f481a40f2484bd854a7167fcab5acd2c88f5841917

Contents?: true

Size: 447 Bytes

Versions: 21

Compression:

Stored size: 447 Bytes

Contents

require 'nokogiri'

module CopyTunerClient
  module I18nCompat
    def select_html_incompatible_blurbs(blurbs)
      non_html_key_blurbs = blurbs.reject { |key| key.ends_with?('.html') || key.ends_with?('_html') }
      html_blurbs = non_html_key_blurbs.select do |key, content|
        Nokogiri::HTML.fragment(content).children.any? { |node| node.name != 'text' }
      end
    end

    module_function :select_html_incompatible_blurbs
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
copy_tuner_client-0.10.0 lib/copy_tuner_client/i18n_compat.rb