Sha256: 4cf630465b6008f8449812a4cb1c545688979ed56833d30d595c0184586ec265

Contents?: true

Size: 836 Bytes

Versions: 18

Compression:

Stored size: 836 Bytes

Contents

require 'temple'
require 'hamlit/engine'
require 'hamlit/rails_helpers'
require 'hamlit/parser/haml_helpers'
require 'hamlit/parser/haml_util'

module Hamlit
  RailsTemplate = Temple::Templates::Rails.create(
    Hamlit::Engine,
    generator:     Temple::Generators::RailsOutputBuffer,
    register_as:   :haml,
    use_html_safe: true,
    streaming:     true,
  )

  # 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
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

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
hamlit-2.2.4 lib/hamlit/rails_template.rb
hamlit-2.6.1 lib/hamlit/rails_template.rb
hamlit-2.6.0 lib/hamlit/rails_template.rb
hamlit-2.5.0 lib/hamlit/rails_template.rb
hamlit-2.4.2 lib/hamlit/rails_template.rb
hamlit-2.4.1 lib/hamlit/rails_template.rb
hamlit-2.4.0 lib/hamlit/rails_template.rb
hamlit-2.3.1 lib/hamlit/rails_template.rb
hamlit-2.3.0 lib/hamlit/rails_template.rb
hamlit-2.2.3 lib/hamlit/rails_template.rb
hamlit-2.2.2 lib/hamlit/rails_template.rb
hamlit-2.2.1 lib/hamlit/rails_template.rb
hamlit-2.2.0 lib/hamlit/rails_template.rb
hamlit-2.1.2 lib/hamlit/rails_template.rb
hamlit-2.1.1 lib/hamlit/rails_template.rb
hamlit-2.1.0 lib/hamlit/rails_template.rb
hamlit-2.0.2 lib/hamlit/rails_template.rb
hamlit-2.0.1 lib/hamlit/rails_template.rb