Sha256: 805bf25552388b86815f8fd081cbae540015a56bc0db861d40562a48d940fa8c

Contents?: true

Size: 1.08 KB

Versions: 13

Compression:

Stored size: 1.08 KB

Contents

# ===========================================================================
# Project:   Abbot - SproutCore Build Tools
# Copyright: ©2009 Apple, Inc.
#            portions copyright @2006-2009 Sprout Systems, Inc.
#            and contributors
# ===========================================================================

module SC
  module RenderEngine

    class Haml
      def initialize(html_context)
        @html_context = html_context
      end

      def compile(input)
        begin
          require 'haml'
        rescue
          raise "Cannot render HAML file because haml is not installed. Try running 'sudo gem install haml' and try again"
        end
        ::Haml::Engine.new(input).send(:precompiled_with_ambles, [])
      end
      
      def concat(string, binding)
        eval("_hamlout", binding).push_text string
      end
      
      def capture(*args, &block)
        if @html_context.respond_to?(:is_haml?) && @html_context.is_haml?
          @html_context.capture_haml(nil, &block)
        else
          block.call(*args).to_s
        end
      end
    end

  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
sproutit-sproutcore-1.0.0.20090407205609 lib/sproutcore/render_engines/haml.rb
sproutit-sproutcore-1.0.0.20090408130025 lib/sproutcore/render_engines/haml.rb
sproutit-sproutcore-1.0.0.20090416161445 lib/sproutcore/render_engines/haml.rb
sproutit-sproutcore-1.0.0.20090720093355 lib/sproutcore/render_engines/haml.rb
sproutit-sproutcore-1.0.0.20090720202429 lib/sproutcore/render_engines/haml.rb
sproutit-sproutcore-1.0.0.20090721125122 lib/sproutcore/render_engines/haml.rb
sproutit-sproutcore-1.0.126 lib/sproutcore/render_engines/haml.rb
sproutit-sproutcore-1.0.20090721145236 lib/sproutcore/render_engines/haml.rb
sproutit-sproutcore-1.0.20090721145251 lib/sproutcore/render_engines/haml.rb
sproutit-sproutcore-1.0.20090721145280 lib/sproutcore/render_engines/haml.rb
sproutit-sproutcore-1.0.20090721145281 lib/sproutcore/render_engines/haml.rb
sproutit-sproutcore-1.0.20090721145282 lib/sproutcore/render_engines/haml.rb
sproutit-sproutcore-1.0.203 lib/sproutcore/render_engines/haml.rb