diff --git a/doc-src/SASS_CHANGELOG.md b/doc-src/SASS_CHANGELOG.md index b2225f36..6e2380c8 100644 --- a/doc-src/SASS_CHANGELOG.md +++ b/doc-src/SASS_CHANGELOG.md @@ -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). diff --git a/lib/sass/engine.rb b/lib/sass/engine.rb index 7ac6bad2..ac04e066 100644 --- a/lib/sass/engine.rb +++ b/lib/sass/engine.rb @@ -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 diff --git a/test/sass/engine_test.rb b/test/sass/engine_test.rb index 1dbb2623..b1b261fd 100755 --- a/test/sass/engine_test.rb +++ b/test/sass/engine_test.rb @@ -1473,6 +1473,32 @@ foo SASS end + def test_loud_comment_with_close + assert_equal <