module Haml::Filters::Javascript
def render_with_options(text, options)
- See: Base#render_with_options -
def render_with_options(text, options) indent = options[:cdata] ? ' ' : ' ' # 4 or 2 spaces if options[:format] == :html5 type = '' else type = " type=#{options[:attr_wrapper]}text/javascript#{options[:attr_wrapper]}" end text = text.rstrip text.gsub!("\n", "\n#{indent}") %!<script#{type}>\n#{" //<![CDATA[\n" if options[:cdata]}#{indent}#{text}\n#{" //]]>\n" if options[:cdata]}</script>! end