[Haml] Fix a parsing bug for HTML-style attributes.
This commit is contained in:
parent
fc26667ae3
commit
e724b98cd7
|
@ -15,6 +15,8 @@
|
|||
make sure error reporting uses the correct line numbers,
|
||||
and allow multi-line expressions.
|
||||
|
||||
* Fix a parsing bug for HTML-style attributes including `#`.
|
||||
|
||||
## [2.2.17](http://github.com/nex3/haml/commit/2.2.16)
|
||||
|
||||
* Fix compilation of HTML5 doctypes when using `html2haml`.
|
||||
|
|
|
@ -673,7 +673,7 @@ END
|
|||
return name, [:dynamic, var]
|
||||
end
|
||||
|
||||
re = /((?:\\.|\#[^{]|[^#{quote}\\#])*#?)(#{quote}|#\{)/
|
||||
re = /((?:\\.|\#(?!\{)|[^#{quote}\\#])*)(#{quote}|#\{)/
|
||||
content = []
|
||||
loop do
|
||||
return false unless scanner.scan(re)
|
||||
|
|
|
@ -607,6 +607,15 @@ HTML
|
|||
HAML
|
||||
end
|
||||
|
||||
def test_html_attributes_with_hash
|
||||
assert_equal("<a href='#' rel='top'>Foo</a>\n",
|
||||
render('%a(href="#" rel="top") Foo'))
|
||||
assert_equal("<a href='#'>Foo</a>\n",
|
||||
render('%a(href="#") #{"Foo"}'))
|
||||
|
||||
assert_equal("<a href='#\"'></a>\n", render('%a(href="#\\"")'))
|
||||
end
|
||||
|
||||
# HTML escaping tests
|
||||
|
||||
def test_ampersand_equals_should_escape
|
||||
|
|
Loading…
Reference in New Issue