1
0
Fork 0
mirror of https://github.com/sinatra/sinatra synced 2023-03-27 23:18:01 -04:00

Merge pull request #1558 from jkowens/fix-1172

Lookup Tilt class for template engine without loading files
This commit is contained in:
Jordan Owens 2019-10-26 17:15:06 -04:00 committed by GitHub
commit 80f8d3be48
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -169,15 +169,14 @@ module Sinatra
settings.template_engines[:all].each do |engine|
exts.each { |ext| possible << [engine, "#{name}.#{ext}"] }
end
exts.each do |ext|
settings.template_engines[ext].each { |e| possible << [e, name] }
end
possible.each do |engine, template|
begin
klass = Tilt[engine]
rescue LoadError
next
end
klass = Tilt.default_mapping.template_map[engine.to_s] ||
Tilt.lazy_map[engine.to_s].fetch(0, [])[0]
find_template(settings.views, template, klass) do |file|
next unless File.exist? file