Sha256: a4f001f31060593e46e8011b0448e0527da85be104d870ccf7a3083368b77576

Contents?: true

Size: 854 Bytes

Versions: 15

Compression:

Stored size: 854 Bytes

Contents

# ERb renderer
module Middleman
  module Renderers
    module ERb
      # Setup extension
      class << self
        # once registered
        def registered(app)
          app.before_configuration do
            template_extensions erb: :html
          end

          # After config
          app.after_configuration do
            ::Tilt.prefer(Template, :erb)
          end
        end
        alias_method :included, :registered
      end

      class Template < ::Tilt::ErubisTemplate
        ##
        # In preamble we need a flag `__in_erb_template` and SafeBuffer for padrino apps.
        #
        def precompiled_preamble(locals)
          original = super
          "__in_erb_template = true\n" << original
          # .rpartition("\n").first << "#{@outvar} = _buf = ActiveSupport::SafeBuffer.new\n"
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
middleman-core-3.4.1 lib/middleman-core/renderers/erb.rb
middleman-core-3.4.0 lib/middleman-core/renderers/erb.rb
middleman-core-3.3.12 lib/middleman-core/renderers/erb.rb
middleman-core-3.3.11 lib/middleman-core/renderers/erb.rb
middleman-core-3.3.10 lib/middleman-core/renderers/erb.rb
middleman-core-3.3.9 lib/middleman-core/renderers/erb.rb
middleman-core-3.3.8 lib/middleman-core/renderers/erb.rb
middleman-core-3.3.7 lib/middleman-core/renderers/erb.rb
middleman-core-3.3.6 lib/middleman-core/renderers/erb.rb
middleman-core-3.3.5 lib/middleman-core/renderers/erb.rb
middleman-core-cj-3.3.6 lib/middleman-core/renderers/erb.rb
middleman-core-cj-3.3.5 lib/middleman-core/renderers/erb.rb
middleman-core-cj-3.3.4 lib/middleman-core/renderers/erb.rb
middleman-core-3.3.4 lib/middleman-core/renderers/erb.rb
middleman-core-3.3.3 lib/middleman-core/renderers/erb.rb