mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Fix find_and_preserve with the new #gsub behavior.
This commit is contained in:
parent
fc5a5cb21d
commit
ee10d546ff
1 changed files with 3 additions and 1 deletions
|
@ -107,7 +107,9 @@ MESSAGE
|
|||
# @yield The block within which to escape newlines
|
||||
def find_and_preserve(input = nil, tags = haml_buffer.options[:preserve], &block)
|
||||
return find_and_preserve(capture_haml(&block), input || tags) if block
|
||||
input.to_s.gsub(/<(#{tags.map(&Regexp.method(:escape)).join('|')})([^>]*)>(.*?)(<\/\1>)/im) do
|
||||
re = /<(#{tags.map(&Regexp.method(:escape)).join('|')})([^>]*)>(.*?)(<\/\1>)/im
|
||||
input.to_s.gsub(re) do |s|
|
||||
s =~ re # Can't rely on $1, etc. existing since Rails' SafeBuffer#gsub is incompatible
|
||||
"<#{$1}#{$2}>#{preserve($3)}</#{$1}>"
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue