diff --git a/lib/liquid/standardfilters.rb b/lib/liquid/standardfilters.rb index c5dbcb8..3d939ae 100644 --- a/lib/liquid/standardfilters.rb +++ b/lib/liquid/standardfilters.rb @@ -11,6 +11,12 @@ module Liquid "'".freeze => '''.freeze } HTML_ESCAPE_ONCE_REGEXP = /["><']|&(?!([a-zA-Z]+|(#\d+));)/ + STRIP_HTML = Regexp.union( + //m, + //m, + //m, + /<.*?>/m, + ) # Return the size of an array or of an string def size(input) @@ -102,8 +108,7 @@ module Liquid end def strip_html(input) - empty = ''.freeze - input.to_s.gsub(//m, empty).gsub(//m, empty).gsub(//m, empty).gsub(/<.*?>/m, empty) + input.to_s.gsub(STRIP_HTML, ''.freeze) end # Remove all newlines from the string