Skip to content

Commit

Permalink
[Sass] Fix a minor comment-formatting bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
nex3 committed Jun 1, 2010
1 parent 2147a95 commit 8b15e2d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
3 changes: 3 additions & 0 deletions doc-src/SASS_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ For details see {file:SASS_REFERENCE.md#encodings the reference}.

* Fix a bug where interpolation would cause some selectors to render improperly.

* If a line in a Sass comment starts with `*foo`,
render it as `*foo` rather than `* *foo`.

## 3.0.6

[Tagged on GitHub](http://github.com/nex3/haml/commit/3.0.6).
Expand Down
3 changes: 1 addition & 2 deletions lib/sass/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -637,8 +637,7 @@ def format_comment_text(text, silent)
end

return silent ? "//" : "/* */" if content.empty?
content.each {|l| l.gsub!(/^\* /, '')}
content.map! {|l| (l.empty? ? "" : " ") + l}
content.map! {|l| l.gsub!(/^\*( ?)/, '\1') || (l.empty? ? "" : " ") + l}
content.first.gsub!(/^ /, '') unless removed_first
content.last.gsub!(%r{ ?\*/ *$}, '')
if silent
Expand Down
12 changes: 12 additions & 0 deletions test/sass/engine_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1423,6 +1423,18 @@ def test_loud_comments_with_starred_lines
SASS
end

def test_loud_comments_with_no_space_after_starred_lines
assert_equal(<<CSS, render(<<SASS))
/*bip bop
*beep boop
*bap blimp */
CSS
/*bip bop
*beep boop
*bap blimp
SASS
end

def test_comment_indentation_at_beginning_of_doc
assert_equal <<CSS, render(<<SASS)
/* foo
Expand Down

0 comments on commit 8b15e2d

Please sign in to comment.