From 7974a92aaebe11c2b28829ab00a2c777e6264123 Mon Sep 17 00:00:00 2001 From: Nathan Weizenbaum Date: Sun, 21 Feb 2010 15:15:01 -0800 Subject: [PATCH] [Sass] [SCSS] Make sure multiple adjacent silent Sass comments count as a single block. --- lib/sass/engine.rb | 12 ++++++++++++ test/sass/conversion_test.rb | 18 ++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/lib/sass/engine.rb b/lib/sass/engine.rb index acf7a51d..b5474d7d 100644 --- a/lib/sass/engine.rb +++ b/lib/sass/engine.rb @@ -301,6 +301,7 @@ MSG def append_children(parent, children, root) continued_rule = nil + continued_comment = nil children.each do |line| child = build_tree(parent, line, root) @@ -323,6 +324,17 @@ MSG continued_rule, child = nil, continued_rule end + if child.is_a?(Tree::CommentNode) && child.silent + if continued_comment && + child.line == continued_comment.line + + continued_comment.value.count("\n") + 1 + continued_comment.value << "\n" << child.value + next + end + + continued_comment = child + end + check_for_no_children(child) validate_and_append_child(parent, child, line, root) end diff --git a/test/sass/conversion_test.rb b/test/sass/conversion_test.rb index 116db8c2..4384cc49 100755 --- a/test/sass/conversion_test.rb +++ b/test/sass/conversion_test.rb @@ -252,6 +252,24 @@ SASS foo bar { a: b; } SCSS + + assert_sass_to_scss <