[Sass] Make sure empty comments are indented properly.

This commit is contained in:
Nathan Weizenbaum 2009-07-11 16:54:33 -04:00
parent a894e18694
commit 8d43fabc3c
2 changed files with 8 additions and 2 deletions

View File

@ -49,14 +49,14 @@ module Sass::Tree
# @see #invisible?
def to_s(tabs = 0, _ = nil)
return if invisible?
spaces = ' ' * (tabs - 1)
content = (value.split("\n") + lines.map {|l| l.text})
return "/* */" if content.empty?
return spaces + "/* */" if content.empty?
content.map! {|l| (l.empty? ? "" : " ") + l}
content.first.gsub!(/^ /, '')
content.last.gsub!(%r{ ?\*/ *$}, '')
spaces = ' ' * (tabs - 1)
spaces + "/* " + content.join(style == :compact ? '' : "\n#{spaces} *") + " */"
end

View File

@ -793,8 +793,14 @@ SASS
def test_empty_comment
assert_equal(<<CSS, render(<<SASS))
/* */
a {
/* */
b: c; }
CSS
/*
a
/*
b: c
SASS
end