mirror of
https://github.com/sinatra/sinatra
synced 2023-03-27 23:18:01 -04:00
When reading inline templates, don't set encoding
for each line, but only once for the complete file.
This commit is contained in:
parent
ff18f868a9
commit
8240bb7fbb
1 changed files with 2 additions and 1 deletions
|
@ -930,13 +930,14 @@ module Sinatra
|
||||||
end
|
end
|
||||||
lines = app.count("\n") + 1
|
lines = app.count("\n") + 1
|
||||||
template = nil
|
template = nil
|
||||||
|
force_encoding data, encoding
|
||||||
data.each_line do |line|
|
data.each_line do |line|
|
||||||
lines += 1
|
lines += 1
|
||||||
if line =~ /^@@\s*(.*\S)\s*$/
|
if line =~ /^@@\s*(.*\S)\s*$/
|
||||||
template = force_encoding('', encoding)
|
template = force_encoding('', encoding)
|
||||||
templates[$1.to_sym] = [template, file, lines]
|
templates[$1.to_sym] = [template, file, lines]
|
||||||
elsif template
|
elsif template
|
||||||
template << force_encoding(line, encoding)
|
template << line
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue