Sha256: 77eb31124bb75b79b81ee85d18b742ffd0a96f00bd928e93a4be2213f874f179

Contents?: true

Size: 639 Bytes

Versions: 6

Compression:

Stored size: 639 Bytes

Contents

# frozen_string_literal: true
require 'action_view'

module Haml

  class ErubisTemplateHandler < ActionView::Template::Handlers::Erubis

    def initialize(*args, &blk)
      @newline_pending = 0
      super
    end
  end

  class SafeErubisTemplate < Tilt::ErubisTemplate

    def initialize_engine
    end

    def prepare
      @options.merge! :engine_class => Haml::ErubisTemplateHandler
      super
    end

    def precompiled_preamble(locals)
      [super, "@output_buffer = ActionView::OutputBuffer.new;"].join("\n")
    end

    def precompiled_postamble(locals)
      [super, '@output_buffer.to_s'].join("\n")
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
files.com-1.0.55 docs/vendor/bundle/ruby/2.5.0/gems/haml-5.0.4/lib/haml/helpers/safe_erubis_template.rb
haml-5.0.4 lib/haml/helpers/safe_erubis_template.rb
haml-5.0.3 lib/haml/helpers/safe_erubis_template.rb
haml-5.0.2 lib/haml/helpers/safe_erubis_template.rb
haml-5.0.1 lib/haml/helpers/safe_erubis_template.rb
haml-5.0.0 lib/haml/helpers/safe_erubis_template.rb