Module: Haml::Filters::Css

Includes:
Base
Defined in:
/build/buildd/ruby-haml-3.1.4/lib/haml/filters.rb

Overview

Surrounds the filtered text with <style> and CDATA tags. Useful for including inline CSS.

Instance Method Summary (collapse)

Methods included from Base

#compile, included, #internal_compile, #lazy_require, #render

Instance Method Details

- render_with_options(text, options)



229
230
231
232
233
234
235
236
237
# File '/build/buildd/ruby-haml-3.1.4/lib/haml/filters.rb', line 229

def render_with_options(text, options)
  if options[:format] == :html5
    type = ''
  else
    type = " type=#{options[:attr_wrapper]}text/css#{options[:attr_wrapper]}"
  end

  "<style\#{type}>\n  /*<![CDATA[*/\n    \#{text.rstrip.gsub(\"\\n\", \"\\n    \")}\n  /*]]>*/\n</style>\n"
end