1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00
haml--haml/lib/hamlit/rails_template.rb

31 lines
828 B
Ruby
Raw Normal View History

2015-11-18 11:54:41 -05:00
require 'temple'
require 'hamlit/engine'
require 'hamlit/rails_helpers'
2015-11-20 14:56:22 -05:00
require 'hamlit/parser/haml_helpers'
require 'hamlit/parser/haml_util'
2015-11-18 11:54:41 -05:00
module Hamlit
RailsTemplate = Temple::Templates::Rails.create(
Hamlit::Engine,
generator: Temple::Generators::RailsOutputBuffer,
register_as: :haml,
escape_html: true,
streaming: true,
)
2015-11-20 14:56:22 -05:00
# https://github.com/haml/haml/blob/4.0.7/lib/haml/template.rb
module HamlHelpers
require 'hamlit/parser/haml_xss_mods'
include Hamlit::HamlHelpers::XssMods
end
module HamlUtil
undef :rails_xss_safe? if defined? rails_xss_safe?
def rails_xss_safe?; true; end
end
2015-11-18 11:54:41 -05:00
end
# Haml extends Haml::Helpers in ActionView each time.
# It costs much, so Hamlit includes a compatible module at first.
ActionView::Base.send :include, Hamlit::RailsHelpers