Fix pattern to match various magic comment formats

This commit is contained in:
Akira Matsuda
2009-07-01 16:25:33 -07:00
committed by Yehuda Katz + Carl Lerche
parent 49824e8ad6
commit 92bff2ebf1

View File

@@ -17,7 +17,7 @@ module ActionView
def compile(template)
require 'erb'
magic = $1 if template.source =~ /\A(<%#.*coding:\s*(\S+)\s*-?%>)/
magic = $1 if template.source =~ /\A(<%#.*coding[:=]\s*(\S+)\s*-?%>)/
erb = "#{magic}<% __in_erb_template=true %>#{template.source}"
::ERB.new(erb, nil, erb_trim_mode, '@output_buffer').src
end