Permalink
Browse files

Literal attribute parsing error fixed. Thanks to smok for pointing th…

…is out.

git-svn-id: svn://hamptoncatlin.com/haml/tags/stable@592 7063305b-7217-0410-af8c-cdc13e5119b9
  • Loading branch information...
1 parent 03bd467 commit 6888c0f9edbd9df4fa01eb8e27f8f88ee34903a2 @nex3 nex3 committed Aug 22, 2007
Showing with 6 additions and 1 deletion.
  1. +1 −1 lib/haml/engine.rb
  2. +5 −0 test/haml/engine_test.rb
View
@@ -100,7 +100,7 @@ class Engine
TAG_REGEX = /[%]([-:\w]+)([-\w\.\#]*)(\{.*\})?(\[.*\])?([=\/\~]?)?(.*)?/
# The Regex that matches a literal string or symbol value
- LITERAL_VALUE_REGEX = /^\s*(:(\w*)|(('|")([^\\\#]*?)\4))\s*$/
+ LITERAL_VALUE_REGEX = /^\s*(:(\w*)|(('|")([^\\\#'"]*?)\4))\s*$/
FLAT_WARNING = <<END
Haml deprecation warning:
@@ -114,6 +114,11 @@ def test_recompile_with_new_locals
assert_equal("NOT RECOMPILED\n", render(template, :locals => { :text => "first time" }))
assert_equal("<p>first time</p>\n", render(template, :locals => { :text => "first time", :foo => 'bar' }))
end
+
+ def test_dynamc_attrs_shouldnt_register_as_literal_values
+ assert_equal("<p a='b2c'>\n</p>\n", render('%p{:a => "b#{1 + 1}c"}'))
+ assert_equal("<p a='b2c'>\n</p>\n", render("%p{:a => 'b' + (1 + 1).to_s + 'c'}"))
+ end
def test_comps
assert_equal(-1, "foo" <=> nil)

0 comments on commit 6888c0f

Please sign in to comment.