def partial_path(filename)
      return filename if filename.nil? || Pathname.new(filename).absolute?

      # try relative to template
      if template
        base_folder = File.dirname(template)
        filename = File.expand_path(File.join(base_folder, filename))
        return filename if File.exists?(filename)
      end

      # try relative to PWD
      filename = File.expand_path(File.join(FileUtils.pwd, filename))
      return filename if File.exists?(filename)

      # try built in template folder
      filename = File.expand_path(File.join('../templates', filename), __FILE__)
    end
def partial_path(filename)
      return filename if filename.nil? || Pathname.new(filename).absolute?

      # try relative to template
      if template
        base_folder = File.dirname(template)
        filename = File.expand_path(File.join(base_folder, filename))
        return filename if File.exists?(filename)
      end

      # try relative to PWD
      filename = File.expand_path(File.join(FileUtils.pwd, filename))
      return filename if File.exists?(filename)

      # try built in template folder
      filename = File.expand_path(File.join('../templates', filename), __FILE__)
    end
full expanded path to the given partial