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

Merge branch 'stable'

This commit is contained in:
Nathan Weizenbaum 2011-06-07 19:25:18 -07:00
commit 5c22304b9d
4 changed files with 11 additions and 5 deletions

View file

@ -10,6 +10,10 @@
* Don't throw errors when text is nested within comments.
* Fix html2haml.
* Fix an issue where destructive modification was sometimes performed on Rails SafeBuffers.
## 3.1.1
* Update the vendored Sass to version 3.1.0.

View file

@ -379,7 +379,7 @@ END
value = Haml::Helpers.preserve(escaped)
if escape_attrs
# We want to decide whether or not to escape quotes
value.gsub!('"', '"')
value = value.gsub('"', '"')
this_attr_wrapper = attr_wrapper
if value.include? attr_wrapper
if value.include? other_quote_char

View file

@ -9,7 +9,7 @@ module Haml
# @param args [Array<String>] The command-line arguments
def initialize(args)
@args = args
@options = {}
@options = {:for_engine => {}}
end
# Parses the command-line arguments and runs the executable.

View file

@ -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
@ -170,10 +172,10 @@ MESSAGE
result = capture_haml(i, &block)
if result.count("\n") > 1
result.gsub!("\n", "\n ")
result = result.gsub("\n", "\n ")
result = "\n #{result.strip}\n"
else
result.strip!
result = result.strip
end
"<li>#{result}</li>"