Module: Haml::Filters::Css

### Home Classes Methods

### In Files

- lib/haml/filters.rb

### Methods

- #render_with_options

### Included Modules

- Haml::Filters::Base

### Class/Module Index

Quicksearch

- Haml
- Haml::Buffer
- Haml::Compiler
- Haml::Engine
- Haml::Error
- Haml::ErubisTemplateHandler
- Haml::Exec
- Haml::Exec::Generic
- Haml::Exec::Haml
- Haml::Filters
- Haml::Filters::Base
- Haml::Filters::Cdata
- Haml::Filters::Css
- Haml::Filters::Erb
- Haml::Filters::Escaped
- Haml::Filters::Javascript
- Haml::Filters::Plain
- Haml::Filters::PrecompiledTiltFilter
- Haml::Filters::Preserve
- Haml::Filters::Ruby
- Haml::Filters::SassRailsTemplate
- Haml::Filters::ScssRailsTemplate
- Haml::Filters::TiltFilter
- Haml::Helpers
- Haml::Helpers::ActionViewExtensions
- Haml::Helpers::ErrorReturn
- Haml::Helpers::XssMods
- Haml::Options
- Haml::Parser
- Haml::Parser::Line
- Haml::Parser::ParseNode
- Haml::Plugin
- Haml::Railtie
- Haml::SafeErubisTemplate
- Haml::SyntaxError
- Haml::Template
- Haml::Util
- Haml::Util::StaticConditionalContext
- ActionView
- ActionView::Base
- ActionView::Helpers
- ActionView::Helpers::CaptureHelper
- ActionView::Helpers::FormHelper
- ActionView::Helpers::FormTagHelper
- ActionView::Helpers::HamlSupport
- ActionView::Helpers::InstanceTag
- ActionView::Helpers::TagHelper
- ActionView::Helpers::Tags
- ActionView::Helpers::Tags::TextArea
- ActionView::Helpers::TextHelper
- Object

No matching classes.

# Haml::Filters::Css

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

### Public Instance Methods

render_with_options(text, options) click to toggle source

@see Base#render_with_options

    # File lib/haml/filters.rb, line 235
    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/css#{options[:attr_wrapper]}"
      end

      str = "<style#{type}>\n"
      str << "  /*<![CDATA[*/\n" if options[:cdata]
      str << "#{indent}#{text.rstrip.gsub("\n", "\n#{indent}")}\n"
      str << "  /*]]>*/\n" if options[:cdata]
      str << "</style>"

      str
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.