class Middleman::Renderers::Haml

Haml Renderer

def self.render_with_options(text, compiler_options)

def self.render_with_options(text, compiler_options)
  modified_options = options.dup
  modified_options[:context] = compiler_options[:context]
  text = template_class.new(nil, 1, modified_options) { text }.render
  super(text, compiler_options)
end

def add_exposed_to_context(context)

def add_exposed_to_context(context)
  super
  context.init_haml_helpers if context.respond_to?(:init_haml_helpers)
end

def initialize(app, options={}, &block)

def initialize(app, options={}, &block)
  super
  ::Haml::Options.defaults[:context] = nil
  ::Haml::Options.send :attr_accessor, :context
  [::Haml::Filters::Sass, ::Haml::Filters::Scss, ::Haml::Filters::Markdown].each do |f|
    f.class_exec do
      def self.render_with_options(text, compiler_options)
        modified_options = options.dup
        modified_options[:context] = compiler_options[:context]
        text = template_class.new(nil, 1, modified_options) { text }.render
        super(text, compiler_options)
      end
    end
  end
  ::Tilt.prefer(::Middleman::Renderers::HamlTemplate, :haml)
  # Add haml helpers to context
  ::Middleman::TemplateContext.send :include, ::Haml::Helpers
end