lib/opal/haml.rb in opal-haml-0.2.0 vs lib/opal/haml.rb in opal-haml-0.3.0
- old
+ new
@@ -1,17 +1,24 @@
require 'opal'
+require 'opal/haml/builder'
require 'opal/haml/processor'
require 'opal/haml/version'
module Opal
module Haml
def self.compile(source, file = '(haml)')
haml = ::Haml::Engine.new(source, :ugly => true).precompiled
+ haml = haml.gsub('_hamlout.buffer', '_hamlout')
Opal.compile(wrap(haml, file))
end
def self.wrap(haml, file)
- "Template.new('#{file}') do |_hamlout|\n#{haml}\n_hamlout.join\nend\n"
+ <<-EOS
+ Template.new('#{file}') do |_hamlout|
+ #{haml}
+ _hamlout.join
+ end
+ EOS
end
end
end
Opal.append_path File.expand_path('../../../opal', __FILE__).untaint