Sha256: ba72248bfd1cca4599f6b1350c2bce3add621df4d50aae7d19d0dd0f95140211

Contents?: true

Size: 780 Bytes

Versions: 2

Compression:

Stored size: 780 Bytes

Contents

require "tilt"

module Middleman::Renderers::ERb
  class << self
    def registered(app)
      app.extend ClassMethods
      
      app.set :erb_engine, :erb
      
      if !app.respond_to? :erb_engine_prefix
        app.set :erb_engine_prefix, ::Tilt
      end
      
      app.after_configuration do
        engine = app.settings.erb_engine
        
        if engine.is_a? Symbol
          engine = app.tilt_template_from_symbol(engine)
        end
        
        ::Tilt.prefer(engine)
      end
    end
    alias :included :registered
  end
  
  module ClassMethods
    def tilt_template_from_symbol(engine)
      engine = engine.to_s
      engine = engine == "erb" ? "ERB" : engine.camelize
      settings.erb_engine_prefix.const_get("#{engine}Template")
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
middleman-2.0.14.pre2-x86-mingw32 lib/middleman/renderers/erb.rb
middleman-2.0.14.pre2 lib/middleman/renderers/erb.rb