From 7ef8110c2295fd45a2f79ca0002e66adae3ccd96 Mon Sep 17 00:00:00 2001 From: Nathan Weizenbaum Date: Mon, 9 Nov 2009 19:46:36 -0800 Subject: [PATCH] [Haml] Add a :css filter. --- doc-src/HAML_CHANGELOG.md | 5 +++++ doc-src/HAML_REFERENCE.md | 5 +++++ lib/haml/filters.rb | 17 +++++++++++++++++ test/haml/engine_test.rb | 15 +++++++++++++++ 4 files changed, 42 insertions(+) diff --git a/doc-src/HAML_CHANGELOG.md b/doc-src/HAML_CHANGELOG.md index 1de65a16..faa23b0c 100644 --- a/doc-src/HAML_CHANGELOG.md +++ b/doc-src/HAML_CHANGELOG.md @@ -29,6 +29,11 @@ Haml and `html2haml` now produce more descriptive errors when given a template with invalid byte sequences for that template's encoding, including the line number and the offending character. +### `:css` Filter + +Haml now supports a {file:HAML_REFERENCE.md#css-filter `:css` filter} +that surrounds the filtered text with ` +END + end + end + # Surrounds the filtered text with CDATA tags. module Cdata include Base diff --git a/test/haml/engine_test.rb b/test/haml/engine_test.rb index df228827..3d788bbc 100644 --- a/test/haml/engine_test.rb +++ b/test/haml/engine_test.rb @@ -909,6 +909,21 @@ END END end + def test_css_filter + assert_equal(< + /**/ + +CSS +:css + #foo { + bar: baz; } +SASS + end + def test_local_assigns_dont_modify_class assert_equal("bar\n", render("= foo", :locals => {:foo => 'bar'})) assert_equal(nil, defined?(foo))