Sha256: 2074a3813350b937aca83b6fc95413bc3d9eddacd4836d50f7660c9376360d59

Contents?: true

Size: 673 Bytes

Versions: 8

Compression:

Stored size: 673 Bytes

Contents

# coding: utf-8
=begin
Each of the following characters has a different unicode values:
  ⋅··∙・•
Some are supported on galakei, but others aren't. The correct version will be used.
=end
class Galakei::Filter::NonStandardChar < Galakei::Filter::Base
  # :stopdoc:
  def condition?
    html_content_type? && (response.charset || Rails.application.config.encoding).downcase == "utf-8"
  end

  def filter
    body = response.body
    full_dot = "\u30FB"
    body.gsub!(/&middot;|&#x30FB;|\u00B7|&#183;|&#xB7;|&#12539;/, full_dot)
    half_dot = "\uFF65"
    body.gsub!(/&#xFF65;|&sdot;|&#x22C5;|&#8901;|&#65381;|\u22C5/, half_dot)
    response.body = body
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
galakei-0.15.2 lib/galakei/filter/non_standard_char.rb
galakei-0.15.1 lib/galakei/filter/non_standard_char.rb
galakei-0.15.0 lib/galakei/filter/non_standard_char.rb
galakei-0.14.4 lib/galakei/filter/non_standard_char.rb
galakei-0.14.3 lib/galakei/filter/non_standard_char.rb
galakei-0.14.2 lib/galakei/filter/non_standard_char.rb
galakei-0.14.1 lib/galakei/filter/non_standard_char.rb
galakei-0.14.0 lib/galakei/filter/non_standard_char.rb