Sha256: 68f9d04e1e76e75adc480c3b0921690a1164c3643bf3d299f9ee9ec4785ac664
Contents?: true
Size: 893 Bytes
Versions: 23
Compression:
Stored size: 893 Bytes
Contents
# ------------------------------------------------------------------------------ # ~/_plugins/simple_search_filter.rb # Liquid filter's to be used with JekyllSimple Search # # Product/Info: # http://jekyll.one # # Copyright (C) 2020 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
23 entries across 23 versions & 1 rubygems