module Tilt

def self.[](file)

extension. Return nil when no implementation is found.
Lookup a template class given for the given filename or file
def self.[](file)
  if @template_mappings.key?(pattern = file.to_s.downcase)
    @template_mappings[pattern]
  elsif @template_mappings.key?(pattern = File.basename(pattern))
    @template_mappings[pattern]
  else
    while !pattern.empty?
      if @template_mappings.key?(pattern)
        return @template_mappings[pattern]
      else
        pattern = pattern.sub(/^[^.]*\.?/, '')
      end
    end
    nil
  end
end