From 7dc2360c8b98dc985f7c60842a0af2e206388d0c Mon Sep 17 00:00:00 2001 From: Nathan Weizenbaum Date: Sun, 4 Apr 2010 14:21:24 -0700 Subject: [PATCH 1/2] [Haml] Silence regexp match warnings. Closes gh-103 --- doc-src/HAML_CHANGELOG.md | 2 ++ lib/haml/helpers.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/doc-src/HAML_CHANGELOG.md b/doc-src/HAML_CHANGELOG.md index ba2f26aa..09f66ff0 100644 --- a/doc-src/HAML_CHANGELOG.md +++ b/doc-src/HAML_CHANGELOG.md @@ -10,6 +10,8 @@ * Don't remove `\n` in filters with interpolation. +* Silence those annoying `"regexp match /.../n against to UTF-8 string"` warnings. + ## 2.2.22 [Tagged on GitHub](http://github.com/nex3/haml/commit/2.2.22). diff --git a/lib/haml/helpers.rb b/lib/haml/helpers.rb index 614b927a..c37c321d 100644 --- a/lib/haml/helpers.rb +++ b/lib/haml/helpers.rb @@ -502,7 +502,7 @@ END # @param text [String] The string to sanitize # @return [String] The sanitized string def html_escape(text) - text.to_s.gsub(/[\"><&]/n) {|s| HTML_ESCAPE[s]} + Haml::Util.silence_warnings {text.to_s.gsub(/[\"><&]/n) {|s| HTML_ESCAPE[s]}} end # Escapes HTML entities in `text`, but without escaping an ampersand From 0e6c5983c593710066138ce642c0c93290bb975f Mon Sep 17 00:00:00 2001 From: Nathan Weizenbaum Date: Sun, 11 Apr 2010 16:53:21 -0700 Subject: [PATCH 2/2] [Haml] Fix a weird infinite-recursion bug. --- doc-src/SASS_CHANGELOG.md | 3 +++ lib/haml/helpers/action_view_mods.rb | 5 ++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/doc-src/SASS_CHANGELOG.md b/doc-src/SASS_CHANGELOG.md index 175ffd92..3b92b73a 100644 --- a/doc-src/SASS_CHANGELOG.md +++ b/doc-src/SASS_CHANGELOG.md @@ -15,6 +15,9 @@ {file:SASS_REFERENCE.md#full_exception `:full_exception option`} is enabled, print the full exception rather than raising it. +* Fix a bug with a weird interaction with Haml, DataMapper, and Rails 3 + that caused some tag helpers to go into infinite recursion. + ## 2.2.22 [Tagged on GitHub](http://github.com/nex3/haml/commit/2.2.22). diff --git a/lib/haml/helpers/action_view_mods.rb b/lib/haml/helpers/action_view_mods.rb index e6806d7b..555e3906 100644 --- a/lib/haml/helpers/action_view_mods.rb +++ b/lib/haml/helpers/action_view_mods.rb @@ -125,9 +125,8 @@ module ActionView @template_object.send :is_haml? end - unless defined?(ActionView::Helpers) && defined?(ActionView::Helpers::ActiveRecordInstanceTag) - alias_method :content_tag_without_haml, :content_tag - alias_method :content_tag, :content_tag_with_haml + def content_tag(*args) + content_tag_with_haml(*args) end end