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

html2haml: support multiple interpolations in attributes

This commit is contained in:
Mislav Marohnić 2008-10-16 22:31:24 +02:00
parent f2bd161544
commit 06212371fc
2 changed files with 6 additions and 1 deletions

View file

@ -166,7 +166,7 @@ module Haml
name, value = pair
unless value.empty?
full_match = nil
ruby_value = value.sub(%r{<haml:loud>\s*(.+?)\s*</haml:loud>}) do
ruby_value = value.gsub(%r{<haml:loud>\s*(.+?)\s*</haml:loud>}) do
full_match = $`.empty? && $'.empty?
full_match ? $1: "\#{#{$1}}"
end

View file

@ -65,6 +65,11 @@ class Html2HamlTest < Test::Unit::TestCase
assert_equal %(%div{ :class => "\#{12}!" }\n Bang!),
render_rhtml(%Q{<div class="<%= 12 %>!">Bang!</div>})
end
def test_rhtml_in_attribute_to_multiple_interpolations
assert_equal %(%div{ :class => "\#{12} + \#{13}" }\n Math is super),
render_rhtml(%Q{<div class="<%= 12 %> + <%= 13 %>">Math is super</div>})
end
protected