lib/pretty_strings.rb in pretty_strings-0.4.0 vs lib/pretty_strings.rb in pretty_strings-0.5.0
- old
+ new
@@ -1,7 +1,6 @@
require "pretty_strings/version"
-require "rails-html-sanitizer"
module PrettyStrings
class Cleaner
attr_reader :text
def initialize(text)
@@ -71,10 +70,11 @@
def escape_text(text)
CGI.unescapeHTML(CGI.unescapeHTML(CGI.unescapeHTML(CGI.unescapeHTML(text))))
end
def sanitize_text(text)
- Rails::Html::FullSanitizer.new.sanitize(text)
+ text.gsub!(/(<[^>\d\/][^>]*>)|\n\t/, '') || text
+ text.gsub!(/(<\/[^>\d][^>]*>)|\n\t/, '') || text
end
def scan_for_code(text)
text =~ /(?<=\{\\f23).*?(?=})/ ? text.scan(/(?<=\{\\f23).*?(?=})/).join(" ") : text
end