Module: CopyTunerClient::I18nCompat

Defined in:
lib/copy_tuner_client/i18n_compat.rb

Overview

_html サフィックス無しに HTML タグを含む訳文(i18n の HTML 安全規約違反)を検出する

Class Method Summary collapse

Class Method Details

.select_html_incompatible_blurbs(blurbs) ⇒ Object



6
7
8
9
10
11
# File 'lib/copy_tuner_client/i18n_compat.rb', line 6

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