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.5.2 lib/opal/rails/haml_filter.rb
opal-rails-0.5.1 lib/opal/rails/haml_filter.rb
opal-rails-0.5.0 lib/opal/rails/haml_filter.rb
opal-rails-0.5.0.pre.2 lib/opal/rails/haml_filter.rb
opal-rails-0.5.0.pre lib/opal/rails/haml_filter.rb
opal-rails-0.4.0 lib/opal/rails/haml_filter.rb
opal-rails-0.3.8 lib/opal/rails/haml_filter.rb
opal-rails-0.3.7 lib/opal/rails/haml_filter.rb
opal-rails-0.3.6 lib/opal/rails/haml_filter.rb
opal-rails-0.3.5 lib/opal/rails/haml_filter.rb
opal-rails-0.3.4 lib/opal/rails/haml_filter.rb
opal-rails-0.3.3 lib/opal/rails/haml_filter.rb
opal-rails-0.3.2 lib/opal/rails/haml_filter.rb
opal-rails-0.3.1 lib/opal/rails/haml_filter.rb
opal-rails-0.3.0 lib/opal/rails/haml_filter.rb
opal-rails-0.2.1 lib/opal/rails/haml_filter.rb
opal-rails-0.2.0 lib/opal/rails/haml_filter.rb
opal-rails-0.1.0 lib/opal/rails/haml_filter.rb
opal-rails-0.0.6 lib/opal/rails/haml_filter.rb
opal-rails-0.0.5 lib/opal/rails/haml_filter.rb