module Haml::Template

def precompiled_method_return_value_with_haml_xss

def precompiled_method_return_value_with_haml_xss
  "(#{precompiled_method_return_value_without_haml_xss}).html_safe!"
end

def rails_xss_safe?; true; end}

def rails_xss_safe?; true; end}

def try_enabling_xss_integration

Returns:
  • (Boolean) - Whether the XSS integration was enabled.
def try_enabling_xss_integration
  return false unless ActionView::Base.respond_to?(:xss_safe?) && ActionView::Base.xss_safe?
  Haml::Template.options[:escape_html] = true
  Haml::Util.module_eval {def rails_xss_safe?; true; end}
  require 'haml/helpers/xss_mods'
  Haml::Helpers.send(:include, Haml::Helpers::XssMods)
  Haml::Precompiler.module_eval do
    def precompiled_method_return_value_with_haml_xss
      "(#{precompiled_method_return_value_without_haml_xss}).html_safe!"
    end
    alias_method :precompiled_method_return_value_without_haml_xss, :precompiled_method_return_value
    alias_method :precompiled_method_return_value, :precompiled_method_return_value_with_haml_xss
  end
  true
end