diff options
author | Yehuda Katz <wycats@gmail.com> | 2009-10-16 17:28:29 -0700 |
---|---|---|
committer | Yehuda Katz <wycats@gmail.com> | 2009-10-16 17:28:44 -0700 |
commit | 7e9e370e031c20e36a52c04a20dbbd7b4fe4672f (patch) | |
tree | d9e954ff3a938785970b46b53f53075dec574d15 /actionpack/lib/action_view | |
parent | a22394295cd4ed30a4c2b63e9d59ca3f2505bb00 (diff) | |
download | rails-7e9e370e031c20e36a52c04a20dbbd7b4fe4672f.tar.gz rails-7e9e370e031c20e36a52c04a20dbbd7b4fe4672f.tar.bz2 rails-7e9e370e031c20e36a52c04a20dbbd7b4fe4672f.zip |
Make encodings work with Erubis and 1.9 again
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r-- | actionpack/lib/action_view/template/handlers/erb.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/actionpack/lib/action_view/template/handlers/erb.rb b/actionpack/lib/action_view/template/handlers/erb.rb index 8993dd2b35..88aeb4b053 100644 --- a/actionpack/lib/action_view/template/handlers/erb.rb +++ b/actionpack/lib/action_view/template/handlers/erb.rb @@ -42,9 +42,11 @@ module ActionView self.erubis_implementation = Erubis def compile(template) - magic = $1 if template.source =~ /\A(<%#.*coding[:=]\s*(\S+)\s*-?%>)/ - erb = "#{magic}<% __in_erb_template=true %>#{template.source}" - self.class.erubis_implementation.new(erb, :trim=>(self.class.erb_trim_mode == "-")).src + source = template.source.gsub(/\A(<%(#.*coding[:=]\s*(\S+)\s*)-?%>)\s*\n?/, '') + erb = "<% __in_erb_template=true %>#{source}" + result = self.class.erubis_implementation.new(erb, :trim=>(self.class.erb_trim_mode == "-")).src + result = "#{$2}\n#{result}" if $2 + result end end end |