Module: EZML::Filters::Javascript
- Includes:
- Base
- Defined in:
- lib/ezml/filters.rb
Instance Method Summary collapse
Methods included from Base
#compile, included, #internal_compile, #render
Instance Method Details
#render_with_options(text, options) ⇒ Object
94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/ezml/filters.rb', line 94 def (text, ) indent = [:cdata] ? ' ' : ' ' # 4 or 2 spaces if [:format] == :html5 type = '' else type = " type=#{[:attr_wrapper]}text/javascript#{[:attr_wrapper]}" end text = text.rstrip text.gsub!("\n", "\n#{indent}") %!<script#{type}>\n#{" //<![CDATA[\n" if [:cdata]}#{indent}#{text}\n#{" //]]>\n" if [:cdata]}</script>! end |