[Haml] Silence regexp match warnings.

Closes gh-103
This commit is contained in:
Nathan Weizenbaum 2010-04-04 14:21:24 -07:00
parent 58b3d67600
commit 7dc2360c8b
2 changed files with 3 additions and 1 deletions

View File

@ -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).

View File

@ -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