code: def _output_filename(file)
        sub_strings           = File.basename(file).split('.')
        base_name, extensions = sub_strings.first, sub_strings[1..-1]
  
        if extensions.last == 'haml'
          extensions.pop
          if extensions.empty?
            [base_name, options[:default_ext]].join('.')
          else
            [base_name, extensions].flatten.join('.')
          end
        else
          [base_name, extensions, options[:default_ext]].flatten.compact.join('.')
        end
      end
docs: Generate a file name based on the provided file path.
   Provide a logical extension.
  
   Examples:
     "path/foo.haml"     -> "foo.html"
     "path/foo"          -> "foo.html"
     "path/foo.bar"      -> "foo.bar.html"
     "path/foo.bar.haml" -> "foo.bar"
  
   @param file String path to file
   @return String file name including extension