Literal attribute parsing error fixed. Thanks to smok for pointing this out.
git-svn-id: svn://hamptoncatlin.com/haml/trunk@592 7063305b-7217-0410-af8c-cdc13e5119b9
This commit is contained in:
parent
9db4d2f38f
commit
3e35978259
|
@ -100,7 +100,7 @@ module Haml
|
|||
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*$/
|
||||
|
||||
# Creates a new instace of Haml::Engine that will compile the given
|
||||
# template string when <tt>render</tt> is called.
|
||||
|
|
|
@ -141,6 +141,11 @@ class EngineTest < Test::Unit::TestCase
|
|||
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)
|
||||
|
|
Loading…
Reference in New Issue