[Haml] [Html] Fix a bug with single-line comments.

This commit is contained in:
Nathan Weizenbaum 2010-06-07 00:16:59 -07:00
parent 547b2a0583
commit 7dd7108639
3 changed files with 12 additions and 1 deletions

View File

@ -11,6 +11,10 @@ The way we determine the location of the Haml installation
no longer breaks the version of JRuby
used by [`appengine-jruby`](http://code.google.com/p/appengine-jruby/).
### Bug Fixes
* Single-line comments are now handled properly by `html2haml`.
## 3.0.9
[Tagged on GitHub](http://github.com/nex3/haml/commit/3.0.9).

View File

@ -221,7 +221,7 @@ module Haml
if content.include?("\n")
"#{tabulate(tabs)}/#{condition}\n#{parse_text(content, tabs + 1)}"
else
"#{tabulate(tabs)}/#{condition} #{content.strip}"
"#{tabulate(tabs)}/#{condition} #{content.strip}\n"
end
end
end

View File

@ -86,6 +86,13 @@ HTML
def test_inline_comment
assert_equal("/ foo", render("<!-- foo -->"))
assert_equal(<<HAML.strip, render(<<HTML))
/ foo
%p bar
HAML
<!-- foo -->
<p>bar</p>
HTML
end
def test_non_inline_comment