From ccb808126418da81e0269fd64009d5e84e6c2ea3 Mon Sep 17 00:00:00 2001 From: Nathan Weizenbaum Date: Tue, 16 Feb 2010 17:05:43 -0800 Subject: [PATCH] [Sass] Retrofit some comment parsing and tests to fit the new comment stuff. --- lib/sass/engine.rb | 8 +++++++- test/sass/css2sass_test.rb | 4 ++-- test/sass/engine_test.rb | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/sass/engine.rb b/lib/sass/engine.rb index 48015900..5d94274f 100644 --- a/lib/sass/engine.rb +++ b/lib/sass/engine.rb @@ -524,9 +524,15 @@ WARNING def format_comment_text(text) content = text.split("\n") + + if content.first && content.first.strip.empty? + removed_first = true + content.shift + end + return "/* */" if content.empty? content.map! {|l| (l.empty? ? "" : " ") + l} - content.first.gsub!(/^ /, '') + content.first.gsub!(/^ /, '') unless removed_first content.last.gsub!(%r{ ?\*/ *$}, '') "/*" + content.join("\n *") + " */" end diff --git a/test/sass/css2sass_test.rb b/test/sass/css2sass_test.rb index c90173ac..14a95c36 100755 --- a/test/sass/css2sass_test.rb +++ b/test/sass/css2sass_test.rb @@ -117,8 +117,8 @@ span.turkey #overhere bored: sorta - /* it's for a good - cause + /* it's for a good + cause better_than: thread_pools #one_more diff --git a/test/sass/engine_test.rb b/test/sass/engine_test.rb index c02e259b..b592fc44 100755 --- a/test/sass/engine_test.rb +++ b/test/sass/engine_test.rb @@ -1077,7 +1077,7 @@ SOURCE RESULT .box :border - /*:color black + /* :color black :style solid SOURCE