Sha256: 5f9d38eac484d2a640a48f2664e4d5494961caaf98e742de09eb2413d8ff64d6

Contents?: true

Size: 734 Bytes

Versions: 47

Compression:

Stored size: 734 Bytes

Contents

# frozen_string_literal: true
module Haml
  class Filters
    class Css < TextBase
      def compile(node)
        case @format
        when :xhtml
          compile_xhtml(node)
        else
          compile_html(node)
        end
      end

      private

      def compile_html(node)
        temple = [:multi]
        temple << [:static, "<style>\n"]
        compile_text!(temple, node, '  ')
        temple << [:static, "\n</style>"]
        temple
      end

      def compile_xhtml(node)
        temple = [:multi]
        temple << [:static, "<style type='text/css'>\n  /*<![CDATA[*/\n"]
        compile_text!(temple, node, '    ')
        temple << [:static, "\n  /*]]>*/\n</style>"]
        temple
      end
    end
  end
end

Version data entries

47 entries across 47 versions & 1 rubygems

Version Path
haml-6.3.0 lib/haml/filters/css.rb
haml-6.2.5 lib/haml/filters/css.rb
haml-6.2.4 lib/haml/filters/css.rb
haml-6.2.3 lib/haml/filters/css.rb
haml-6.2.2 lib/haml/filters/css.rb
haml-6.2.1 lib/haml/filters/css.rb
haml-6.2.0 lib/haml/filters/css.rb
haml-6.1.4-java lib/haml/filters/css.rb
haml-6.1.4 lib/haml/filters/css.rb
haml-6.1.3-java lib/haml/filters/css.rb
haml-6.1.3 lib/haml/filters/css.rb
haml-6.1.2-java lib/haml/filters/css.rb
haml-6.1.2 lib/haml/filters/css.rb
haml-6.1.1-java lib/haml/filters/css.rb
haml-6.1.1 lib/haml/filters/css.rb
haml-6.1.0-java lib/haml/filters/css.rb
haml-6.1.0 lib/haml/filters/css.rb
haml-6.0.12-java lib/haml/filters/css.rb
haml-6.0.12 lib/haml/filters/css.rb
haml-6.0.11-java lib/haml/filters/css.rb