module ERB::Util

def html_escape_once(s)

# => "<< Accept & Checkout"
html_escape_once('<< Accept & Checkout')

# => "1 < 2 & 3"
html_escape_once('1 < 2 & 3')

A utility method for escaping HTML without affecting existing escaped entities.
def html_escape_once(s)
  ActiveSupport::Multibyte::Unicode.tidy_bytes(s.to_s).gsub(HTML_ESCAPE_ONCE_REGEXP, HTML_ESCAPE).html_safe
end