Skip to content

Commit

Permalink
Merge branch 'stable'
Browse files Browse the repository at this point in the history
Conflicts:
	CHANGELOG.md
	lib/haml/version.rb
	test/helper_test.rb
  • Loading branch information
norman committed Nov 5, 2013
2 parents 447813a + 4e61178 commit b5d8140
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@
* General performance and memory usage improvements. (Akira Matsuda)
* Don't treat the 'data' attribute specially when merging attribute hashes. (Matt Wildig and Norman Clarke)

## 4.0.4

Released on November 5, 2013 ([diff](https://github.com/haml/haml/compare/4.0.3...4.0.4)).

* Check for Rails::Railtie rather than Rails (thanks [Konstantin Shabanov](https://github.com/etehtsea)).
* Parser fix to allow literal '#' with suppress_eval (Matt Wildig).
* Helpers#escape_once works on frozen strings (as does
ERB::Util.html_escape_once for which it acts as a replacement in
Rails (thanks [Patrik Metzmacher](https://github.com/patrik)).
* Minor test fix (thanks [Mircea Moise](https://github.com/mmircea16)).

## 4.0.3

Released May 21, 2013 ([diff](https://github.com/haml/haml/compare/4.0.2...4.0.3)).
Expand Down
2 changes: 1 addition & 1 deletion haml.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'rails', '>= 3.0.0'
spec.add_development_dependency 'rbench'
spec.add_development_dependency 'minitest'
spec.add_development_dependency 'nokogiri'
spec.add_development_dependency 'nokogiri', '~> 1.5.10'

spec.description = <<-END
Haml (HTML Abstraction Markup Language) is a layer on top of HTML or XML that's
Expand Down
6 changes: 2 additions & 4 deletions lib/haml/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -614,14 +614,12 @@ def html_escape(text)
# @return [String] The sanitized string
def escape_once(text)
text = text.to_s
text.gsub!(HTML_ESCAPE_ONCE_REGEX, HTML_ESCAPE)
text
text.gsub(HTML_ESCAPE_ONCE_REGEX, HTML_ESCAPE)
end
else
def escape_once(text)
text = text.to_s
text.gsub!(HTML_ESCAPE_ONCE_REGEX){|s| HTML_ESCAPE[s]}
text
text.gsub(HTML_ESCAPE_ONCE_REGEX){|s| HTML_ESCAPE[s]}
end
end

Expand Down
9 changes: 9 additions & 0 deletions test/helper_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -622,5 +622,14 @@ def test_html_attrs_html5_other_lang
assert_equal("<html lang='es-AR'></html>\n",
render("%html{html_attrs('es-AR')}", :format => :html5))
end

def test_escape_once_should_work_on_frozen_strings
begin
Haml::Helpers.escape_once('foo'.freeze)
rescue => e
flunk e.message
end
end

end

0 comments on commit b5d8140

Please sign in to comment.