Skip to content

Commit

Permalink
Literal attribute parsing error fixed. Thanks to smok for pointing th…
Browse files Browse the repository at this point in the history
…is out.

git-svn-id: svn://hamptoncatlin.com/haml/tags/stable@592 7063305b-7217-0410-af8c-cdc13e5119b9
  • Loading branch information
nex3 committed Aug 22, 2007
1 parent 03bd467 commit 6888c0f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/haml/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 5 additions & 0 deletions test/haml/engine_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 6888c0f

Please sign in to comment.