Sha256: 25b32337a78e90c64c350499c67d9c645ef39cf6b6bd12e3305d0fc0cfd8c9bc

Contents?: true

Size: 431 Bytes

Versions: 22

Compression:

Stored size: 431 Bytes

Contents

module Haml::Filters::Opal
  include Haml::Filters::Base

  def render_with_options ruby, options
    text = ::Opal.parse(ruby)
    
    if options[:format] == :html5
      type = ''
    else
      type = " type=#{options[:attr_wrapper]}text/javascript#{options[:attr_wrapper]}"
    end
    
    text.rstrip!
    text.gsub!("\n", "\n    ")
    
    <<HTML
<script#{type}>
  //<![CDATA[
    #{text}
  //]]>
</script>
HTML
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
opal-rails-0.0.4 lib/opal/rails/haml_filter.rb
opal-rails-0.0.3 lib/opal/rails/haml_filter.rb