[Haml] [html2haml] Teach Hpricot that haml:* tags can contain one another.
Closes gh-314
This commit is contained in:
parent
feb8eb26e3
commit
01ecd6bfaf
|
@ -3,6 +3,11 @@
|
|||
* Table of contents
|
||||
{:toc}
|
||||
|
||||
## 3.0.24 (Unreleased)
|
||||
|
||||
* `html2haml` now properly generates Haml for silent script expressions
|
||||
nested within blocks.
|
||||
|
||||
## 3.0.23
|
||||
|
||||
[Tagged on GitHub](http://github.com/nex3/haml/commit/3.0.23).
|
||||
|
|
|
@ -103,13 +103,6 @@ require 'hpricot'
|
|||
# @private
|
||||
HAML_TAGS = %w[haml:block haml:loud haml:silent]
|
||||
|
||||
Hpricot::ElementContent.keys.each do |k|
|
||||
HAML_TAGS.each do |el|
|
||||
val = Hpricot::ElementContent[k]
|
||||
val[el.hash] = true if val.is_a?(Hash)
|
||||
end
|
||||
end
|
||||
|
||||
HAML_TAGS.each do |t|
|
||||
Hpricot::ElementContent[t] = {}
|
||||
Hpricot::ElementContent.keys.each do |key|
|
||||
|
@ -117,6 +110,13 @@ HAML_TAGS.each do |t|
|
|||
end
|
||||
end
|
||||
|
||||
Hpricot::ElementContent.keys.each do |k|
|
||||
HAML_TAGS.each do |el|
|
||||
val = Hpricot::ElementContent[k]
|
||||
val[el.hash] = true if val.is_a?(Hash)
|
||||
end
|
||||
end
|
||||
|
||||
module Haml
|
||||
# Converts HTML documents into Haml templates.
|
||||
# Depends on [Hpricot](http://github.com/whymirror/hpricot) for HTML parsing.
|
||||
|
|
|
@ -421,6 +421,20 @@ HAML
|
|||
<tr></tr>
|
||||
<% end %>
|
||||
</table>
|
||||
ERB
|
||||
end
|
||||
|
||||
def test_silent_inside_block_inside_tag
|
||||
assert_equal(<<HAML.rstrip, render_erb(<<ERB))
|
||||
%table
|
||||
- foo.each do
|
||||
- haml_puts "foo"
|
||||
HAML
|
||||
<table>
|
||||
<% foo.each do %>
|
||||
<% haml_puts "foo" %>
|
||||
<% end %>
|
||||
</table>
|
||||
ERB
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue