提交 7e9e370e 编写于 作者: Y Yehuda Katz

Make encodings work with Erubis and 1.9 again

上级 a2239429
......@@ -42,9 +42,11 @@ class ERB < TemplateHandler
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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册