1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

[Sass] [Indented] Always allow a trailing */ in loud comments.

This commit is contained in:
Nathan Weizenbaum 2010-08-01 18:35:31 -07:00
parent 458b7b968b
commit 7805567a79
3 changed files with 31 additions and 2 deletions

View file

@ -8,6 +8,8 @@
* Fix a bug where certain sorts of comments would get improperly
rendered in the `:compact` style.
* Always allow a trailing `*/` in loud comments in the indented syntax.
## 3.0.15
[Tagged on GitHub](http://github.com/nex3/haml/commit/3.0.15).

View file

@ -667,13 +667,14 @@ WARNING
end
return silent ? "//" : "/* */" if content.empty?
content.last.gsub!(%r{ ?\*/ *$}, '')
content.map! {|l| l.gsub!(/^\*( ?)/, '\1') || (l.empty? ? "" : " ") + l}
content.first.gsub!(/^ /, '') unless removed_first
content.last.gsub!(%r{ ?\*/ *$}, '')
if silent
"//" + content.join("\n//")
else
"/*" + content.join("\n *") + " */"
# The #gsub fixes the case of a trailing */
"/*" + content.join("\n *").gsub(/ \*\Z/, '') + " */"
end
end

View file

@ -1473,6 +1473,32 @@ foo
SASS
end
def test_loud_comment_with_close
assert_equal <<CSS, render(<<SASS)
foo {
/* foo
* bar */ }
CSS
foo
/* foo
bar */
SASS
end
def test_loud_comment_with_separate_line_close
assert_equal <<CSS, render(<<SASS)
foo {
/* foo
* bar
*/ }
CSS
foo
/* foo
* bar
*/
SASS
end
def test_attribute_selector_with_spaces
assert_equal(<<CSS, render(<<SASS))
a b[foo=bar] {