Sha256: 83839ab8758f715c81c3bc2bb177ee57a2fde1ee4ccfd2bbe8bb28b5b85585f7

Contents?: true

Size: 900 Bytes

Versions: 8

Compression:

Stored size: 900 Bytes

Contents

# ------------------------------------------------------------------------------
#  ~/_plugins/simple_search_filter.rb
#  Liquid filter's to be used with JekyllSimple Search
#
#  Product/Info:
#  http://jekyll.one
#
#  Copyright (C) 2019 Juergen Adams
#
#  J1 Template is licensed under the MIT License.
#  See: https://github.com/jekyll-one-org/j1_template/blob/master/LICENSE
#
# ------------------------------------------------------------------------------

module Jekyll
  module CharFilter
    def remove_chars(input)
      input.gsub! '\\','\'
      input.gsub! /\t/, '    '
      input.strip_control_and_extended_characters
    end
  end
end

Liquid::Template.register_filter(Jekyll::CharFilter)

class String
  def strip_control_and_extended_characters()
    chars.each_with_object("") do |char, str|
      str << char if char.ascii_only? and char.ord.between?(32,126)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
j1_template-2019.4.12 lib/starter_web/_plugins/simple_search_filter.rb
j1_template-2019.4.11 lib/starter_web/_plugins/simple_search_filter.rb
j1_template-2019.4.10 lib/starter_web/_plugins/simple_search_filter.rb
j1_template-2019.4.8 lib/starter_web/_plugins/simple_search_filter.rb
j1_template-2019.4.7 lib/starter_web/_plugins/simple_search_filter.rb
j1_template-2019.4.5 lib/starter_web/_plugins/simple_search_filter.rb
j1_template-2019.4.4 lib/starter_web/_plugins/simple_search_filter.rb
j1_template-2019.4.1 lib/starter_web/_plugins/simple_search_filter.rb