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

Fixed nested brackets bug for ==. Thanks to Ryan T Mulligan for pointing it out.

git-svn-id: svn://hamptoncatlin.com/haml/trunk@576 7063305b-7217-0410-af8c-cdc13e5119b9
This commit is contained in:
nex3 2007-07-29 19:44:17 +00:00
parent 3cc372603d
commit 24403b79c7
3 changed files with 16 additions and 2 deletions

View file

@ -882,9 +882,21 @@ END
end
def unescape_interpolation(str)
str.dump.gsub('\\#', '#').gsub(/\#\{[^\}]+\}/) do |substr|
substr.gsub('\\"', '"')
first = str.index(/(^|[^\\])\#\{/)
if first.nil?
return str.dump
elsif first != 0
first -= 1
end
last = str.rindex '}'
interpolation = str.slice!(first, last + 1)
str.insert(first, "_haml_interpolation")
str = str.dump
str.gsub("_haml_interpolation", interpolation)
end
# Counts the tabulation of a line.

View file

@ -10,6 +10,7 @@
Embedded? false!
Embedded? true!
Embedded? true!
Embedded? twice! true!
<div class='render'><em>wow!</em></div>
stuff followed by whitespace
<strong>block with whitespace</strong>

View file

@ -11,6 +11,7 @@
== Embedded? #{true}!
- embedded = true
== Embedded? #{embedded}!
== Embedded? #{"twice! #{true}"}!
.render= render :inline => "%em= 'wow!'", :type => :haml
= "stuff followed by whitespace"